diff options
Diffstat (limited to 'usr.sbin')
-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; |