From 3fb387f5134f209e6a73fbcab809e3777b9477fd Mon Sep 17 00:00:00 2001 From: vivek Date: Tue, 10 May 2016 09:29:25 -0700 Subject: [PATCH] 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 --- bgpd/bgp_updgrp_adv.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) 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 */ -- 2.39.5