From: vivek Date: Tue, 10 May 2016 16:29:25 +0000 (-0700) Subject: BGP: Fix nexthop setting for default originate X-Git-Tag: frr-2.0-rc1~928 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=3fb387f5134f209e6a73fbcab809e3777b9477fd;p=matthieu%2Ffrr.git BGP: Fix nexthop setting for default originate The nexthop setting for IPv6 default origination was incorrect, resulting in the same (incorrect) IPv6 link-local nexthop being advertised to multiple peers. The issue was also present for IPv4 default origination when IPv4 routes are advertised with IPv6 nextops (RFC 5549). For default origination, we should just reset the nexthop when forming the update for the update-group and let the outbound update/nexthop setting code set it correctly. Signed-off-by: Vivek Venkatraman Reviewed-by: Daniel Walton Reviewed-by: Donald Sharp Reviewed-by: Don Slice Ticket: CM-10623 Reviewed By: CCR-4677 Testing Done: Manual, bgp-min --- diff --git a/bgpd/bgp_updgrp_adv.c b/bgpd/bgp_updgrp_adv.c index 27597bf428..e3c4beb300 100644 --- a/bgpd/bgp_updgrp_adv.c +++ b/bgpd/bgp_updgrp_adv.c @@ -704,7 +704,6 @@ subgroup_default_originate (struct update_subgroup *subgrp, int withdraw) bgp_attr_default_set (&attr, BGP_ORIGIN_IGP); aspath = attr.aspath; attr.local_pref = bgp->default_local_pref; - memcpy (&attr.nexthop, &peer->nexthop.v4, IPV4_MAX_BYTELEN); if (afi == AFI_IP) str2prefix ("0.0.0.0/0", &p); @@ -716,19 +715,13 @@ subgroup_default_originate (struct update_subgroup *subgrp, int withdraw) str2prefix ("::/0", &p); /* IPv6 global nexthop must be included. */ - memcpy (&ae->mp_nexthop_global, &peer->nexthop.v6_global, - IPV6_MAX_BYTELEN); ae->mp_nexthop_len = BGP_ATTR_NHLEN_IPV6_GLOBAL; /* If the peer is on shared nextwork and we have link-local nexthop set it. */ if (peer->shared_network && !IN6_IS_ADDR_UNSPECIFIED (&peer->nexthop.v6_local)) - { - memcpy (&ae->mp_nexthop_local, &peer->nexthop.v6_local, - IPV6_MAX_BYTELEN); - ae->mp_nexthop_len = BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL; - } + ae->mp_nexthop_len = BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL; } #endif /* HAVE_IPV6 */