diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2021-01-09 16:49:42 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2021-01-09 16:49:42 +0000 |
commit | 55257514c671be7c12e989f5ff8f08aa4b2c85a6 (patch) | |
tree | 10771253ef1db28a76c6a3411b9fc1d1402e1eb5 /usr.sbin/bgpd/rde.c | |
parent | b0e648e721006f8c068bdc99132f12395d2ba062 (diff) |
Move peer related checks from up_test_update() to rde_generate_updates()
both the export check and the address family check should be done as
early as possible since these peers will not need any kind of updates
to happen. Also remove the non-standard ORIGINATOR_ID check.
With this up_test_update() becomes a simple true/false function which
makes the rest of the code a bit simpler.
OK benno@
Diffstat (limited to 'usr.sbin/bgpd/rde.c')
-rw-r--r-- | usr.sbin/bgpd/rde.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/usr.sbin/bgpd/rde.c b/usr.sbin/bgpd/rde.c index 177046b8a69..627fcd3b1ea 100644 --- a/usr.sbin/bgpd/rde.c +++ b/usr.sbin/bgpd/rde.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde.c,v 1.510 2020/12/30 07:29:56 claudio Exp $ */ +/* $OpenBSD: rde.c,v 1.511 2021/01/09 16:49:41 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -2814,7 +2814,8 @@ rde_send_kroute(struct rib *rib, struct prefix *new, struct prefix *old) void rde_generate_updates(struct rib *rib, struct prefix *new, struct prefix *old) { - struct rde_peer *peer; + struct rde_peer *peer; + u_int8_t aid; /* * If old is != NULL we know it was active and should be removed. @@ -2824,6 +2825,11 @@ rde_generate_updates(struct rib *rib, struct prefix *new, struct prefix *old) if (old == NULL && new == NULL) return; + if (new) + aid = new->pt->aid; + else + aid = old->pt->aid; + LIST_FOREACH(peer, &peerlist, peer_l) { if (peer->conf.id == 0) continue; @@ -2831,6 +2837,14 @@ rde_generate_updates(struct rib *rib, struct prefix *new, struct prefix *old) continue; if (peer->state != PEER_UP) continue; + /* check if peer actually supports the address family */ + if (peer->capa.mp[aid] == 0) + continue; + /* skip peers with special export types */ + if (peer->conf.export_type == EXPORT_NONE || + peer->conf.export_type == EXPORT_DEFAULT_ROUTE) + continue; + up_generate_updates(out_rules, peer, new, old); } } |