From c358f112a6733d3507ad8cdc16fb54235dd065f9 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Tue, 15 Nov 2016 09:39:35 -0500 Subject: [PATCH] bgpd: Fix occassional turn off of extended-nexthop for an if Sometimes, like once every 400 iterations, when you restart Quagga, extended-nexthop has been turned off for interface based config( for 5549 ). Examining the code, there is only 1 real path to setting the PEER_FLAG_CAPABILITITY_ENHE and that is through peer_conf_interface_get. Modify this code path to always set the PEER_FLAG_CAPABILITY_ENHE if it is not already set. In addition, fix a possible pointer dereference. Ticket: CM-12929 Signed-off-by: Donald Sharp --- bgpd/bgp_vty.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 347d026aff..4187654244 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -2882,7 +2882,10 @@ peer_conf_interface_get (struct vty *vty, const char *conf_if, afi_t afi, peer = peer_create (NULL, conf_if, bgp, bgp->as, as, as_type, afi, safi, NULL); - if (peer && v6only) + if (!peer) + return CMD_WARNING; + + if (v6only) SET_FLAG(peer->flags, PEER_FLAG_IFPEER_V6ONLY); /* Request zebra to initiate IPv6 RAs on this interface. We do this @@ -2891,10 +2894,7 @@ peer_conf_interface_get (struct vty *vty, const char *conf_if, afi_t afi, * gets deleted later etc.) */ if (peer->ifp) - { - bgp_zebra_initiate_radv (bgp, peer); - } - peer_flag_set (peer, PEER_FLAG_CAPABILITY_ENHE); + bgp_zebra_initiate_radv (bgp, peer); } else if ((v6only && !CHECK_FLAG(peer->flags, PEER_FLAG_IFPEER_V6ONLY)) || (!v6only && CHECK_FLAG(peer->flags, PEER_FLAG_IFPEER_V6ONLY))) @@ -2915,8 +2915,8 @@ peer_conf_interface_get (struct vty *vty, const char *conf_if, afi_t afi, bgp_session_reset(peer); } - if (!peer) - return CMD_WARNING; + if (!CHECK_FLAG (peer->flags, PEER_FLAG_CAPABILITY_ENHE)) + peer_flag_set (peer, PEER_FLAG_CAPABILITY_ENHE); if (peer_group_name) { -- 2.39.5