]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: Fix occassional turn off of extended-nexthop for an if
authorDonald Sharp <sharpd@cumulusnetworks.com>
Tue, 15 Nov 2016 14:39:35 +0000 (09:39 -0500)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Wed, 17 May 2017 12:48:46 +0000 (08:48 -0400)
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>
bgpd/bgp_vty.c

index 9d954e5007ef8c84a3cf0ed620dea9c135463d8d..0c6648d562929d703151033335457c272f7102c8 100644 (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)
     {