Skip to content

Commit

Permalink
* fix, BGP daemon: improved BGP next-hop setting and comparison in ca…
Browse files Browse the repository at this point in the history
…ses of MP_REACH_NLRI and MPLS VPNs. To address issue #80.
  • Loading branch information
paololucente committed Feb 28, 2017
1 parent 6e67f4a commit 89047c0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 15 deletions.
2 changes: 2 additions & 0 deletions src/bgp/bgp_msg.c
Expand Up @@ -823,6 +823,8 @@ int bgp_attr_parse_mp_reach(struct bgp_peer *peer, u_int16_t len, struct bgp_att
/* IPv4 (4), RD+IPv4 (12), IPv6 (16), RD+IPv6 (24), IPv6 link-local+IPv6 global (32) */
if (mpnhoplen == 4 || mpnhoplen == 12 || mpnhoplen == 16 || mpnhoplen == 24 || mpnhoplen == 32) {
if (mpreachlen > mpnhoplen) {
memset(&attr->mp_nexthop, 0, sizeof(struct host_addr));

switch (mpnhoplen) {
case 4:
attr->mp_nexthop.family = AF_INET;
Expand Down
18 changes: 4 additions & 14 deletions src/bgp/bgp_util.c
Expand Up @@ -363,21 +363,11 @@ int attrhash_cmp(const void *p1, const void *p2)
&& attr1->med == attr2->med
&& attr1->local_pref == attr2->local_pref
&& attr1->pathlimit.ttl == attr2->pathlimit.ttl
&& attr1->pathlimit.as == attr2->pathlimit.as) {
if (attr1->mp_nexthop.family == attr2->mp_nexthop.family) {
if (attr1->mp_nexthop.family == AF_INET
&& attr1->mp_nexthop.address.ipv4.s_addr == attr2->mp_nexthop.address.ipv4.s_addr)
return 1;
#if defined ENABLE_IPV6
else if (attr1->mp_nexthop.family == AF_INET6
&& !memcmp(&attr1->mp_nexthop.address.ipv6, &attr2->mp_nexthop.address.ipv6, 16))
return 1;
#endif
else return 1;
}
}
&& attr1->pathlimit.as == attr2->pathlimit.as
&& !memcmp(&attr1->mp_nexthop, &attr2->mp_nexthop, sizeof(struct host_addr)))
return TRUE;

return SUCCESS;
return FALSE;
}

void attrhash_init(int buckets, struct hash **loc_attrhash)
Expand Down
2 changes: 1 addition & 1 deletion src/pmacct-build.h
@@ -1 +1 @@
#define PMACCT_BUILD "20170227-00"
#define PMACCT_BUILD "20170228-00"

0 comments on commit 89047c0

Please sign in to comment.