diff options
-rw-r--r-- | usr.sbin/bgpd/rde.c | 16 | ||||
-rw-r--r-- | usr.sbin/bgpd/rde.h | 11 | ||||
-rw-r--r-- | usr.sbin/bgpd/rde_rib.c | 26 |
3 files changed, 21 insertions, 32 deletions
diff --git a/usr.sbin/bgpd/rde.c b/usr.sbin/bgpd/rde.c index d3bddc0ab50..1ca29f3b4ff 100644 --- a/usr.sbin/bgpd/rde.c +++ b/usr.sbin/bgpd/rde.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde.c,v 1.244 2009/05/17 13:22:10 claudio Exp $ */ +/* $OpenBSD: rde.c,v 1.245 2009/05/17 14:45:25 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -850,8 +850,8 @@ rde_update_dispatch(struct imsg *imsg) peer->prefix_rcvd_withdraw++; rde_update_log("withdraw", peer, NULL, &prefix, prefixlen); - prefix_remove(&ribs[1], peer, &prefix, prefixlen, F_LOCAL); - prefix_remove(&ribs[0], peer, &prefix, prefixlen, F_ORIGINAL); + prefix_remove(&ribs[1], peer, &prefix, prefixlen, 0); + prefix_remove(&ribs[0], peer, &prefix, prefixlen, 0); } if (attrpath_len == 0) { @@ -910,9 +910,9 @@ rde_update_dispatch(struct imsg *imsg) rde_update_log("withdraw", peer, NULL, &prefix, prefixlen); prefix_remove(&ribs[1], peer, &prefix, - prefixlen, F_LOCAL); + prefixlen, 0); prefix_remove(&ribs[0], peer, &prefix, - prefixlen, F_ORIGINAL); + prefixlen, 0); } break; default: @@ -2206,7 +2206,7 @@ rde_softreconfig_in(struct rib_entry *re, void *ptr) } if (oa == ACTION_ALLOW && na == ACTION_DENY) { /* remove from Local-RIB */ - prefix_remove(&ribs[1], peer, &addr, pt->prefixlen, F_LOCAL); + prefix_remove(&ribs[1], peer, &addr, pt->prefixlen, 0); goto done; } if (oa == ACTION_ALLOW && na == ACTION_ALLOW) { @@ -2731,9 +2731,9 @@ network_delete(struct network_config *nc, int flagstatic) flags |= F_ANN_DYNAMIC; prefix_remove(&ribs[0], peerself, &nc->prefix, nc->prefixlen, - flags | F_LOCAL); + flags); prefix_remove(&ribs[1], peerself, &nc->prefix, nc->prefixlen, - flags | F_ORIGINAL); + flags); } void diff --git a/usr.sbin/bgpd/rde.h b/usr.sbin/bgpd/rde.h index 7bf5e71f58c..a89934971c3 100644 --- a/usr.sbin/bgpd/rde.h +++ b/usr.sbin/bgpd/rde.h @@ -1,4 +1,4 @@ -/* $OpenBSD: rde.h,v 1.107 2009/05/17 12:25:15 claudio Exp $ */ +/* $OpenBSD: rde.h,v 1.108 2009/05/17 14:45:25 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Claudio Jeker <claudio@openbsd.org> and @@ -157,16 +157,13 @@ LIST_HEAD(prefix_head, prefix); #define F_ATTR_MP_UNREACH 0x00080 #define F_ATTR_AS4BYTE_NEW 0x00100 /* AS4_PATH or AS4_AGGREGATOR */ #define F_ATTR_LOOP 0x00200 /* path would cause a route loop */ -#define F_PREFIX_ANNOUNCED 0x01000 +#define F_PREFIX_ANNOUNCED 0x00400 +#define F_ANN_DYNAMIC 0x00800 +#define F_NEXTHOP_SELF 0x01000 #define F_NEXTHOP_REJECT 0x02000 #define F_NEXTHOP_BLACKHOLE 0x04000 #define F_NEXTHOP_NOMODIFY 0x08000 -#define F_NEXTHOP_SELF 0x10000 #define F_ATTR_LINKED 0x20000 -#define F_LOCAL 0x40000 /* Local-RIB */ -#define F_ORIGINAL 0x80000 /* Adj-RIB-In */ -#define F_RIB_MASK (F_LOCAL | F_ORIGINAL) -#define F_ANN_DYNAMIC 0x100000 #define ORIGIN_IGP 0 diff --git a/usr.sbin/bgpd/rde_rib.c b/usr.sbin/bgpd/rde_rib.c index 3c12c3f9efe..28edd8dcfbc 100644 --- a/usr.sbin/bgpd/rde_rib.c +++ b/usr.sbin/bgpd/rde_rib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde_rib.c,v 1.100 2009/05/17 13:20:12 claudio Exp $ */ +/* $OpenBSD: rde_rib.c,v 1.101 2009/05/17 14:45:25 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Claudio Jeker <claudio@openbsd.org> @@ -339,13 +339,10 @@ path_update(struct rib *rib, struct rde_peer *peer, struct rde_aspath *nasp, struct rde_aspath *asp; struct prefix *p; -#if 0 - /* XXX NEEDS SOMETHING BETTER HERE */ - if (flags & F_LOCAL) { + if (nasp->pftableid) { rde_send_pftable(nasp->pftableid, prefix, prefixlen, 0); rde_send_pftable_commit(); } -#endif /* * First try to find a prefix in the specified RIB. @@ -442,16 +439,14 @@ path_remove(struct rde_aspath *asp) struct prefix *p; while ((p = LIST_FIRST(&asp->prefix_h)) != NULL) { -#if 0 - /* Commit is done in peer_down() */ - /* XXX AGAIN NEEDS A BETTER SOLUTION */ - struct bgpd_addr addr; + if (asp->pftableid) { + struct bgpd_addr addr; - pt_getaddr(p->prefix, &addr); - if (p->flags & F_LOCAL) + pt_getaddr(p->prefix, &addr); + /* Commit is done in peer_down() */ rde_send_pftable(p->aspath->pftableid, &addr, p->prefix->prefixlen, 1); -#endif + } prefix_destroy(p); } @@ -745,14 +740,11 @@ prefix_remove(struct rib *rib, struct rde_peer *peer, struct bgpd_addr *prefix, asp = p->aspath; -#if 0 - /* XXX AGAIN THIS NEEDS A BETTER SOLUTION */ - if (p->flags & F_LOCAL) { + if (asp->pftableid) { /* only prefixes in the local RIB were pushed into pf */ rde_send_pftable(asp->pftableid, prefix, prefixlen, 1); rde_send_pftable_commit(); } -#endif prefix_unlink(p); prefix_free(p); @@ -817,7 +809,7 @@ prefix_updateall(struct rde_aspath *asp, enum nexthop_state state, /* * XXX THIS IS MISSING AT THE MOMENT * skip non local-RIB nodes, only local-RIB prefixes are - * eligible. Both F_LOCAL and F_ORIGINAL may be set. + * eligible. */ if (oldstate == state && state == NEXTHOP_REACH) { |