This is a discussion on Re: bgpd ebgp loops within the mailing.openbsd.tech forums, part of the OpenBSD category; --> New diff that also fixes the same problem for route-reflecting. I did not change up_test_update() even though the assumption ...
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| New diff that also fixes the same problem for route-reflecting. I did not change up_test_update() even though the assumption there is that a looped prefixes should be blocked outgoing. /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 23 Nov 2007 00:05:33 -0000 @@ -59,7 +59,7 @@ const struct rde_peer *, const struct bgpd_addr *, const struct bgpd_addr *, u_int8_t); void rde_as4byte_fixup(struct rde_peer *, struct rde_aspath *); -int rde_reflector(struct rde_peer *, struct rde_aspath *); +void rde_reflector(struct rde_peer *, struct rde_aspath *); void rde_dump_rib_as(struct prefix *, struct rde_aspath *,pid_t, int); @@ -806,10 +806,7 @@ goto done; } - if (rde_reflector(peer, asp) != 1) { - error = 0; - goto done; - } + rde_reflector(peer, asp); } p = imsg->data; @@ -921,8 +918,7 @@ /* 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; + asp->flags |= F_IMPLICIT_WITHDRAW; } /* parse nlri prefix */ @@ -1621,7 +1617,7 @@ /* * route reflector helper function */ -int +void rde_reflector(struct rde_peer *peer, struct rde_aspath *asp) { struct attr *a; @@ -1631,9 +1627,11 @@ /* check for originator id if eq router_id drop */ if ((a = attr_optget(asp, ATTR_ORIGINATOR_ID)) != NULL) { - if (memcmp(&conf->bgpid, a->data, sizeof(conf->bgpid)) == 0) + if (memcmp(&conf->bgpid, a->data, sizeof(conf->bgpid)) == 0) { /* this is coming from myself */ - return (0); + asp->flags |= F_IMPLICIT_WITHDRAW; + return; + } } else if (conf->flags & BGPD_FLAG_REFLECTOR) { if (peer->conf.ebgp == 0) id = htonl(peer->remote_bgpid); @@ -1651,8 +1649,10 @@ len += sizeof(conf->clusterid)) /* check if coming from my cluster */ if (memcmp(&conf->clusterid, a->data + len, - sizeof(conf->clusterid)) == 0) - return (0); + sizeof(conf->clusterid)) == 0) { + asp->flags |= F_IMPLICIT_WITHDRAW; + return; + } /* prepend own clusterid by replacing attribute */ len = a->len + sizeof(conf->clusterid); @@ -1671,7 +1671,7 @@ &conf->clusterid, sizeof(conf->clusterid)) == -1) fatalx("attr_optadd failed but impossible"); } - return (1); + return; } /* Index: rde.h ================================================== ================= RCS file: /cvs/src/usr.sbin/bgpd/rde.h,v retrieving revision 1.100 diff -u -r1.100 rde.h --- rde.h 1 Jun 2007 04:17:30 -0000 1.100 +++ rde.h 23 Nov 2007 00:05:33 -0000 @@ -154,6 +154,7 @@ #define F_ATTR_MP_REACH 0x00040 #define F_ATTR_MP_UNREACH 0x00080 #define F_ATTR_AS4BYTE_NEW 0x00100 /* NEW_ASPATH or NEW_AGGREGATOR */ +#define F_IMPLICIT_WITHDRAW 0x00200 /* Looped updates */ #define F_PREFIX_ANNOUNCED 0x01000 #define F_NEXTHOP_REJECT 0x02000 #define F_NEXTHOP_BLACKHOLE 0x04000 Index: rde_rib.c ================================================== ================= RCS file: /cvs/src/usr.sbin/bgpd/rde_rib.c,v retrieving revision 1.96 diff -u -r1.96 rde_rib.c --- rde_rib.c 1 Jun 2007 04:17:30 -0000 1.96 +++ rde_rib.c 23 Nov 2007 00:05:33 -0000 @@ -90,6 +90,11 @@ struct rde_aspath *asp; struct prefix *p, *oldp = NULL; + if (nasp->flags & F_IMPLICIT_WITHDRAW) { + prefix_remove(peer, prefix, prefixlen, flags); + return; + } + if (flags & F_LOCAL) { rde_send_pftable(nasp->pftableid, prefix, prefixlen, 0); rde_send_pftable_commit(); -- --- Tony Sarendal - tony@polarcap.org IP/Unix -= The scorpion replied, "I couldn't help it, it's my nature" =- |