summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpd/rde_attr.c
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2009-12-18 15:51:38 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2009-12-18 15:51:38 +0000
commita2d857b386ce67105a5e6b313baa6c7fbf68d45f (patch)
tree2d9e843c761ac0f23c0351a2cedc52389fd1fbfa /usr.sbin/bgpd/rde_attr.c
parent72acd1253a98e26198842a0b9f56858d381ad542 (diff)
Merge rde_filter_community() with community_match() and kill a useless
indirection.
Diffstat (limited to 'usr.sbin/bgpd/rde_attr.c')
-rw-r--r--usr.sbin/bgpd/rde_attr.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/usr.sbin/bgpd/rde_attr.c b/usr.sbin/bgpd/rde_attr.c
index 8aa418e1dc4..c83a3d2736d 100644
--- a/usr.sbin/bgpd/rde_attr.c
+++ b/usr.sbin/bgpd/rde_attr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde_attr.c,v 1.80 2009/12/16 15:40:55 claudio Exp $ */
+/* $OpenBSD: rde_attr.c,v 1.81 2009/12/18 15:51:37 claudio Exp $ */
/*
* Copyright (c) 2004 Claudio Jeker <claudio@openbsd.org>
@@ -978,12 +978,19 @@ aspath_match(struct aspath *a, enum as_spec type, u_int32_t as)
int community_ext_conv(struct filter_extcommunity *, u_int16_t, u_int64_t *);
int
-community_match(void *data, u_int16_t len, int as, int type)
+community_match(struct rde_aspath *asp, int as, int type)
{
- u_int8_t *p = data;
- u_int16_t eas, etype;
+ struct attr *a;
+ u_int8_t *p;
+ u_int16_t eas, etype, len;
+
+ a = attr_optget(asp, ATTR_COMMUNITIES);
+ if (a == NULL)
+ /* no communities, no match */
+ return (0);
- len >>= 2; /* divide by four */
+ len = a->len / 4;
+ p = a->data;
for (; len > 0; len--) {
eas = *p++;