summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpd/rde_update.c
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2018-11-28 08:32:28 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2018-11-28 08:32:28 +0000
commit4616ded38b097acb4dabb216f122347b6b264824 (patch)
treeaab8161807a61ba2fcfeb7d3efe2d1742924086f /usr.sbin/bgpd/rde_update.c
parent5d43c7d095930844d937a582c4f5b73e3958e2ac (diff)
Start reworking community handling. Merge standard communities and large
communities into one filter_community struct and allow it that more then one community can be used in filter rules (currently up to 3). Also rework the code handling bgpctl show rib commands. The special IMSG types for the various filters are gone and the code is in general simpler. OK job@, phessler@
Diffstat (limited to 'usr.sbin/bgpd/rde_update.c')
-rw-r--r--usr.sbin/bgpd/rde_update.c32
1 files changed, 24 insertions, 8 deletions
diff --git a/usr.sbin/bgpd/rde_update.c b/usr.sbin/bgpd/rde_update.c
index a20922782b1..8157342058e 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.103 2018/11/04 12:34:54 claudio Exp $ */
+/* $OpenBSD: rde_update.c,v 1.104 2018/11/28 08:32:27 claudio Exp $ */
/*
* Copyright (c) 2004 Claudio Jeker <claudio@openbsd.org>
@@ -66,6 +66,22 @@ RB_GENERATE(uptree_attr, update_attr, entry, up_attr_cmp)
SIPHASH_KEY uptree_key;
+static struct filter_community comm_no_advertise = {
+ .type = COMMUNITY_TYPE_BASIC,
+ .data1 = COMMUNITY_WELLKNOWN,
+ .data2 = COMMUNITY_NO_ADVERTISE
+};
+static struct filter_community comm_no_export = {
+ .type = COMMUNITY_TYPE_BASIC,
+ .data1 = COMMUNITY_WELLKNOWN,
+ .data2 = COMMUNITY_NO_EXPORT
+};
+static struct filter_community comm_no_expsubconfed = {
+ .type = COMMUNITY_TYPE_BASIC,
+ .data1 = COMMUNITY_WELLKNOWN,
+ .data2 = COMMUNITY_NO_EXPSUBCONFED
+};
+
void
up_init(struct rde_peer *peer)
{
@@ -329,14 +345,14 @@ up_test_update(struct rde_peer *peer, struct prefix *p)
}
/* well known communities */
- if (community_match(asp, COMMUNITY_WELLKNOWN, COMMUNITY_NO_ADVERTISE))
- return (0);
- if (peer->conf.ebgp && community_match(asp, COMMUNITY_WELLKNOWN,
- COMMUNITY_NO_EXPORT))
- return (0);
- if (peer->conf.ebgp && community_match(asp, COMMUNITY_WELLKNOWN,
- COMMUNITY_NO_EXPSUBCONFED))
+ if (community_match(asp, &comm_no_advertise, NULL))
return (0);
+ if (peer->conf.ebgp) {
+ if (community_match(asp, &comm_no_export, NULL))
+ return (0);
+ if (community_match(asp, &comm_no_expsubconfed, NULL))
+ return (0);
+ }
/*
* Don't send messages back to originator