]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: fix bug in ecommunity_match
authorRenato Westphal <renatowestphal@gmail.com>
Wed, 27 Jun 2012 20:18:08 +0000 (17:18 -0300)
committerDonald Sharp <sharpd@cumulusnetwroks.com>
Sat, 3 Sep 2016 15:05:51 +0000 (11:05 -0400)
The offset used to compare extended communities should be increased by
steps of ECOMMUNITY_SIZE and not one by one.

bgpd/bgp_ecommunity.c

index e55ce3528c1c5653848219b0bba6411ac2e51010..926e2650a234bf3f95e6f1523daf613715241b62 100644 (file)
@@ -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;
 }
-