On 11/6/07, Tony Sarendal <[EMAIL PROTECTED]> wrote: > > New version. Less duplication and a nice feature as bonus. > With softreconfig in enabled the looped prefixes are accepted > into the Adj-RIB-In. > > This means that I can tell if my neighbor AS is using > a path via myself. Either I'm tired or that is cool. > > router-02# bgpctl show rib 192.168.0.0 > flags: * = Valid, > = Selected, I = via IBGP, A = Announced > origin: i = IGP, e = EGP, ? = Incomplete > > flags destination gateway lpref med aspath origin > *> 192.168.0.0/16 192.168.100.5 100 0 65100 i > * 192.168.0.0/16 172.17.1.1 100 0 65200 65100 i > * 192.168.0.0/16 172.17.1.5 100 0 65200 65200 65200 > 65200 65100 i > router-02# > > I now kill the peering that 65200 has to 65100, removing their > direct path to 192.168.0.0/16. > > router-02# bgpctl show rib 192.168.0.0 > flags: * = Valid, > = Selected, I = via IBGP, A = Announced > origin: i = IGP, e = EGP, ? = Incomplete > > flags destination gateway lpref med aspath origin > *> 192.168.0.0/16 192.168.100.5 100 0 65100 i > router-02# > > Sweet, the looping issue is gone. > Here is the bonus: > > router-02# bgpctl show rib neigh 172.17.1.5 in | grep 65300 > * 172.17.0.2/32 172.17.1.5 100 0 65200 65300 i > * 192.168.0.0/16 172.17.1.5 100 0 65200 65300 65100 i > * 192.168.100.4/30 172.17.1.5 100 0 65200 65300 i > router-02# > > I now see the paths that the peer uses my network to access. > Note that this depends a bit on remote implementation. > I think this works agains a cisco router. > > /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 17:08:50 -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, > @@ -977,10 +971,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); > @@ -1075,9 +1077,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) > -- > --- > Tony Sarendal - [EMAIL PROTECTED] > IP/Unix > -= The scorpion replied, > "I couldn't help it, it's my nature" =- > >
Added is if course the drawback that a softreconfig inbound brings back the behaviour I was trying to avoid... Need to stick code into rde_softreconfig_in() if I want this, not nice.