From 061e9fdea56b6078b68ab23191449abd92aa71cf Mon Sep 17 00:00:00 2001 From: Philippe Guibert Date: Fri, 20 Jan 2017 14:02:49 +0100 Subject: [PATCH] bgpd: update mp_nexthop field in case mp-bgp entry is created In case a manual set of MPLS, ENCAP, or EVPN entry is set, then the nexthop attribute localted in attr->extra structure must be changed too. In standard cases, where IPv4 IGP nexthop address is picked up, the same address ie chosen. Signed-off-by: Philippe Guibert --- bgpd/bgp_route.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 6d8336032f..e303cbb644 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -4006,6 +4006,14 @@ bgp_static_update_safi (struct bgp *bgp, struct prefix *p, attr.med = bgp_static->igpmetric; attr.flag |= ATTR_FLAG_BIT (BGP_ATTR_MULTI_EXIT_DISC); + if ((safi == SAFI_EVPN) || (safi == SAFI_MPLS_VPN) || (safi == SAFI_ENCAP)) + { + if (bgp_static->igpnexthop.s_addr) + { + bgp_attr_extra_get (&attr)->mp_nexthop_global_in = bgp_static->igpnexthop; + bgp_attr_extra_get (&attr)->mp_nexthop_len = IPV4_MAX_BYTELEN; + } + } if(afi == AFI_L2VPN) { if (bgp_static->gatewayIp.family == AF_INET)