diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2006-05-27 15:39:57 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2006-05-27 15:39:57 +0000 |
commit | 61786072d2835793eb9d02eca9d60f9ffb3c5441 (patch) | |
tree | 1e72fd58768ef413e800974a899dbee0766bee4c | |
parent | c23f38a450e0aa79f5c2b009a2d84e68d744afd5 (diff) |
Unfuck community delete. The if () statement to match communities was FUBAR
instead reverse logic and use the same if statement as in the match function.
Issue found and debugged by Leen Besselink. Thanks.
-rw-r--r-- | usr.sbin/bgpd/rde_attr.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/usr.sbin/bgpd/rde_attr.c b/usr.sbin/bgpd/rde_attr.c index e772d81f76e..9e43f1ee546 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.65 2006/04/12 14:05:46 claudio Exp $ */ +/* $OpenBSD: rde_attr.c,v 1.66 2006/05/27 15:39:56 claudio Exp $ */ /* * Copyright (c) 2004 Claudio Jeker <claudio@openbsd.org> @@ -799,9 +799,11 @@ community_delete(struct rde_aspath *asp, int as, int type) etype <<= 8; etype |= *p++; - if (as != COMMUNITY_ANY && (u_int16_t)as != eas && - type != COMMUNITY_ANY && (u_int16_t)type != etype) - len += 4; + if ((as == COMMUNITY_ANY || (u_int16_t)as == eas) && + (type == COMMUNITY_ANY || (u_int16_t)type == etype)) + /* match */ + continue; + len += 4; } if (len == 0) { @@ -821,13 +823,14 @@ community_delete(struct rde_aspath *asp, int as, int type) etype <<= 8; etype |= *p++; - if (as != COMMUNITY_ANY && (u_int16_t)as != eas && - type != COMMUNITY_ANY && (u_int16_t)type != etype) { - n[l++] = eas >> 8; - n[l++] = eas & 0xff; - n[l++] = etype >> 8; - n[l++] = etype & 0xff; - } + if ((as == COMMUNITY_ANY || (u_int16_t)as == eas) && + (type == COMMUNITY_ANY || (u_int16_t)type == etype)) + /* match */ + continue; + n[l++] = eas >> 8; + n[l++] = eas & 0xff; + n[l++] = etype >> 8; + n[l++] = etype & 0xff; } f = attr->flags; |