On Fri, Oct 18, 2013 at 03:33:45PM +0400, Alexander V. Chernikov wrote:
On 18.10.2013 15:23, Milan Kocian wrote:
Sometimes its useful feature. So make it optional per bgp protocol. Based on hint http://permalink.gmane.org/gmane.network.bird.user/944
Signed-off-by: Milan Kocian <milon@wq.cz> --- proto/bgp/attrs.c | 5 +++-- proto/bgp/bgp.h | 1 + proto/bgp/config.Y | 4 +++- 3 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/proto/bgp/attrs.c b/proto/bgp/attrs.c index c27a498..27a2694 100644 --- a/proto/bgp/attrs.c +++ b/proto/bgp/attrs.c @@ -1704,8 +1704,9 @@ bgp_decode_attrs(struct bgp_conn *conn, byte *attr, unsigned int len, struct lin bgp_remove_as4_attrs(bgp, a); /* If the AS path attribute contains our AS, reject the routes */ - if (bgp_as_path_loopy(bgp, a)) - goto withdraw; + if (!bgp->cf->allow_as_in) + if (bgp_as_path_loopy(bgp, a)) + goto withdraw; Removing loop check at all is wrong (as it can lead to real loops). Typical implementation include configurable maximum number of local ASn that can be contained in path.
Sorry for late reply (I lost bird's emails in wrong folder). I am happy with santiago's solution. Many thanks. -- Milan Kocian