From d32dfc22011c79c87edcdf05b66f4598443ee7b2 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Tue, 15 Nov 2016 10:16:52 -0500 Subject: [PATCH 1/3] bgpd: Fix ADJCHANGE message to include more info When bgp logs ADJCHANGE messages include the hostname and vrf that this change is being made in. Ticket: CM-10922 Signed-off-by: Donald Sharp --- bgpd/bgp_fsm.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c index e669b4f9b7..f20bd3bf26 100644 --- a/bgpd/bgp_fsm.c +++ b/bgpd/bgp_fsm.c @@ -1021,8 +1021,14 @@ bgp_stop (struct peer *peer) /* bgp log-neighbor-changes of neighbor Down */ if (bgp_flag_check (peer->bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES)) - zlog_info ("%%ADJCHANGE: neighbor %s Down %s", peer->host, - peer_down_str [(int) peer->last_reset]); + { + struct vrf *vrf = vrf_lookup_by_id (peer->bgp->vrf_id); + zlog_info ("%%ADJCHANGE: neighbor %s(%s) in vrf %s Down %s", + peer->host, + (peer->hostname) ? peer->hostname : "Unknown", + (vrf->vrf_id != VRF_DEFAULT) ? vrf->name : "Default", + peer_down_str [(int) peer->last_reset]); + } /* graceful restart */ if (peer->t_gr_stale) @@ -1459,8 +1465,13 @@ bgp_establish (struct peer *peer) /* bgp log-neighbor-changes of neighbor Up */ if (bgp_flag_check (peer->bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES)) - zlog_info ("%%ADJCHANGE: neighbor %s Up", peer->host); - + { + struct vrf *vrf = vrf_lookup_by_id (peer->bgp->vrf_id); + zlog_info ("%%ADJCHANGE: neighbor %s(%s) in vrf %s Up", + peer->host, + (peer->hostname) ? peer->hostname : "Unknown", + (vrf->vrf_id != VRF_DEFAULT ) ? vrf->name : "Default"); + } /* assign update-group/subgroup */ update_group_adjust_peer_afs(peer); From 2e37f307ee663c3955044c6fa97914c37fed9751 Mon Sep 17 00:00:00 2001 From: Don Slice Date: Tue, 22 Nov 2016 09:48:16 -0800 Subject: [PATCH 2/3] bgpd: fix crash in bgp_stop due to missing vrf Problem found to be derefencing a vrf that had already been deleted. Fix verifies that vrf exists before using it. Ticket: CM-13682 Signed-off-by: Don Slice Reviewed By: Vivek Venkatraman Testing Done: manual testing, re-run of failing scripts good --- bgpd/bgp_fsm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c index f20bd3bf26..e3968d21cd 100644 --- a/bgpd/bgp_fsm.c +++ b/bgpd/bgp_fsm.c @@ -1026,7 +1026,7 @@ bgp_stop (struct peer *peer) zlog_info ("%%ADJCHANGE: neighbor %s(%s) in vrf %s Down %s", peer->host, (peer->hostname) ? peer->hostname : "Unknown", - (vrf->vrf_id != VRF_DEFAULT) ? vrf->name : "Default", + vrf ? ((vrf->vrf_id != VRF_DEFAULT) ? vrf->name : "Default") : "", peer_down_str [(int) peer->last_reset]); } From fa14eb2c0b408982a6634459b3afb21e9df6326a Mon Sep 17 00:00:00 2001 From: Don Slice Date: Wed, 5 Apr 2017 07:13:45 -0700 Subject: [PATCH 3/3] bgpd: resolve ipv6 ecmp issue with vrfs and ll nexthop Problem reported that ecmp wasn't working correctly in a vrf with ipv6. Issue was that originator of the routes were sending the updates with a link-local nexthop and nhlen of 16. In this particular case, bgp_zebra_announce was using the wrong call to get the ifindex and was not supplying the vrf. This caused ecmp to work only in the case of the default vrf. Ticket: CM-15545 Signed-off-by: Don Slice Reviewed-by: CCR-6017 --- bgpd/bgp_zebra.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c index 3d3bd90f5b..d07fc65bdf 100644 --- a/bgpd/bgp_zebra.c +++ b/bgpd/bgp_zebra.c @@ -1469,7 +1469,8 @@ bgp_zebra_announce (struct prefix *p, struct bgp_info *info, struct bgp *bgp, if (!ifindex) { if (info->peer->conf_if || info->peer->ifname) - ifindex = if_nametoindex (info->peer->conf_if ? info->peer->conf_if : info->peer->ifname); + ifindex = ifname2ifindex_vrf (info->peer->conf_if ? info->peer->conf_if : + info->peer->ifname, bgp->vrf_id); else if (info->peer->nexthop.ifp) ifindex = info->peer->nexthop.ifp->ifindex; }