From: Renato Westphal Date: Wed, 27 Jun 2012 20:18:08 +0000 (-0300) Subject: bgpd: fix bug in ecommunity_match X-Git-Tag: frr-2.0-rc1~335 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=9cc8cd02790ce8d7cac29963cfd2a35c42b5301f;p=mirror%2Ffrr.git bgpd: fix bug in ecommunity_match The offset used to compare extended communities should be increased by steps of ECOMMUNITY_SIZE and not one by one. --- diff --git a/bgpd/bgp_ecommunity.c b/bgpd/bgp_ecommunity.c index e55ce3528c..926e2650a2 100644 --- a/bgpd/bgp_ecommunity.c +++ b/bgpd/bgp_ecommunity.c @@ -770,7 +770,9 @@ ecommunity_match (const struct ecommunity *ecom1, /* Every community on com2 needs to be on com1 for this to match */ while (i < ecom1->size && j < ecom2->size) { - if (memcmp (ecom1->val + i, ecom2->val + j, ECOMMUNITY_SIZE) == 0) + if (memcmp (ecom1->val + i * ECOMMUNITY_SIZE, + ecom2->val + j * ECOMMUNITY_SIZE, + ECOMMUNITY_SIZE) == 0) j++; i++; } @@ -780,4 +782,3 @@ ecommunity_match (const struct ecommunity *ecom1, else return 0; } -