diff -u version. /Tony
Index: rde.c =================================================================== RCS file: /cvs/src/usr.sbin/bgpd/rde.c,v retrieving revision 1.228 diff -u -r1.228 rde.c --- rde.c 16 Sep 2007 15:20:50 -0000 1.228 +++ rde.c 6 Nov 2007 10:38:23 -0000 @@ -919,12 +919,6 @@ /* shift to NLRI information */ p += 2 + attrpath_len; - /* aspath needs to be loop free nota bene this is not a hard error */ - if (peer->conf.ebgp && !aspath_loopfree(asp->aspath, conf->as)) { - error = 0; - goto done; - } - /* parse nlri prefix */ while (nlri_len > 0) { if ((pos = rde_update_get_prefix(p, nlri_len, &prefix, @@ -954,9 +948,17 @@ peer->prefix_rcvd_update++; /* add original path to the Adj-RIB-In */ - if (peer->conf.softreconfig_in) - path_update(peer, asp, &prefix, prefixlen, F_ORIGINAL); - + if (peer->conf.softreconfig_in) { + /* handle an update with loop as a withdraw */ + if (peer->conf.ebgp && !aspath_loopfree(asp->aspath, + conf->as)) + prefix_remove(peer, &prefix, prefixlen, + F_ORIGINAL); + else + path_update(peer, asp, &prefix, prefixlen, + F_ORIGINAL); + + } /* input filter */ if (rde_filter(&fasp, rules_l, peer, asp, &prefix, prefixlen, peer, DIR_IN) == ACTION_DENY) { @@ -977,10 +979,18 @@ if (fasp == NULL) fasp = asp; - rde_update_log("update", peer, &fasp->nexthop->exit_nexthop, - &prefix, prefixlen); - path_update(peer, fasp, &prefix, prefixlen, F_LOCAL); - + rde_update_log("update", peer, + &fasp->nexthop->exit_nexthop,&prefix, + prefixlen); + /* handle an update with loop as a withdraw */ + if (peer->conf.ebgp && !aspath_loopfree(asp->aspath, + conf->as)) + prefix_remove(peer, &prefix, prefixlen, + F_LOCAL); + else + path_update(peer, fasp, &prefix, prefixlen, + F_LOCAL); + /* free modified aspath */ if (fasp != asp) path_put(fasp); @@ -1047,10 +1057,16 @@ peer->prefix_rcvd_update++; /* add original path to the Adj-RIB-In */ - if (peer->conf.softreconfig_in) - path_update(peer, asp, &prefix, - prefixlen, F_ORIGINAL); - + if (peer->conf.softreconfig_in) { + /* handle an update with loop as a withdraw */ + if (peer->conf.ebgp && + !aspath_loopfree(asp->aspath,conf->as)) + prefix_remove(peer, &prefix, + prefixlen,F_ORIGINAL); + else + path_update(peer, asp, &prefix, + prefixlen, F_ORIGINAL); + } /* input filter */ if (rde_filter(&fasp, rules_l, peer, asp, &prefix, prefixlen, peer, DIR_IN) == @@ -1075,9 +1091,15 @@ rde_update_log("update", peer, &asp->nexthop->exit_nexthop, - &prefix, prefixlen); - path_update(peer, fasp, &prefix, prefixlen, - F_LOCAL); + &prefix, prefixlen); + /* handle an update with loop as a withdraw */ + if (peer->conf.ebgp && + !aspath_loopfree(asp->aspath,conf->as)) + prefix_remove(peer, &prefix, + prefixlen,F_LOCAL); + else + path_update(peer, fasp, &prefix, + prefixlen,F_LOCAL); /* free modified aspath */ if (fasp != asp)