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 <sharpd@cumulusnetworks.com>
This commit is contained in:
Donald Sharp 2016-11-15 09:39:35 -05:00
parent 77566facad
commit 1f0a6ed1f1

View File

@ -2714,7 +2714,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
@ -2723,10 +2726,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)))
@ -2747,8 +2747,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)
{