summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.sbin/bgpd/rde.c18
-rw-r--r--usr.sbin/bgpd/rde_update.c37
2 files changed, 18 insertions, 37 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);
}
}
diff --git a/usr.sbin/bgpd/rde_update.c b/usr.sbin/bgpd/rde_update.c
index 6e8c1ce4b9f..c448060f9b7 100644
--- a/usr.sbin/bgpd/rde_update.c
+++ b/usr.sbin/bgpd/rde_update.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde_update.c,v 1.123 2020/01/24 05:44:05 claudio Exp $ */
+/* $OpenBSD: rde_update.c,v 1.124 2021/01/09 16:49:41 claudio Exp $ */
/*
* Copyright (c) 2004 Claudio Jeker <claudio@openbsd.org>
@@ -47,11 +47,9 @@ static struct community comm_no_expsubconfed = {
static int
up_test_update(struct rde_peer *peer, struct prefix *p)
{
- struct bgpd_addr addr;
struct rde_aspath *asp;
struct rde_community *comm;
struct rde_peer *prefp;
- struct attr *attr;
if (p == NULL)
/* no prefix available */
@@ -70,10 +68,6 @@ up_test_update(struct rde_peer *peer, struct prefix *p)
if (asp->flags & F_ATTR_LOOP)
fatalx("try to send out a looped path");
- pt_getaddr(p->pt, &addr);
- if (peer->capa.mp[addr.aid] == 0)
- return (-1);
-
if (!prefp->conf.ebgp && !peer->conf.ebgp) {
/*
* route reflector redistribution rules:
@@ -90,16 +84,6 @@ up_test_update(struct rde_peer *peer, struct prefix *p)
return (0);
}
- /* export type handling */
- if (peer->conf.export_type == EXPORT_NONE ||
- peer->conf.export_type == EXPORT_DEFAULT_ROUTE) {
- /*
- * no need to withdraw old prefix as this will be
- * filtered out as well.
- */
- return (-1);
- }
-
/* well known communities */
if (community_match(comm, &comm_no_advertise, NULL))
return (0);
@@ -110,18 +94,6 @@ up_test_update(struct rde_peer *peer, struct prefix *p)
return (0);
}
- /*
- * Don't send messages back to originator
- * this is not specified in the RFC but seems logical.
- */
- if ((attr = attr_optget(asp, ATTR_ORIGINATOR_ID)) != NULL) {
- if (memcmp(attr->data, &peer->remote_bgpid,
- sizeof(peer->remote_bgpid)) == 0) {
- /* would cause loop don't send */
- return (-1);
- }
- }
-
return (1);
}
@@ -149,13 +121,8 @@ withdraw:
peer->up_wcnt++;
}
} else {
- switch (up_test_update(peer, new)) {
- case 1:
- break;
- case 0:
+ if (!up_test_update(peer, new)) {
goto withdraw;
- case -1:
- return;
}
rde_filterstate_prep(&state, prefix_aspath(new),