]> git.puffer.fish Git - mirror/frr.git/commitdiff
vrrpd: fix autoconfig of protodown'd interfaces
authorQuentin Young <qlyoung@cumulusnetworks.com>
Thu, 28 Feb 2019 23:13:20 +0000 (23:13 +0000)
committerQuentin Young <qlyoung@cumulusnetworks.com>
Fri, 17 May 2019 00:27:08 +0000 (00:27 +0000)
When autoconfiguring VRRP, interfaces that are protodown'd should be
automatically brought up. Otherwise Zebra won't send us their interface
addresses and we'll sit in Initialize forever.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
vrrpd/vrrp.c

index 55ae7ce7a47480c81187c5e472d4aa731756b5db..4d4a66b6d1962325e91b16a98dc2664b01e49954 100644 (file)
@@ -1599,11 +1599,22 @@ vrrp_autoconfig_autocreate(struct interface *mvl_ifp)
                return NULL;
        }
 
+       vr->autoconf = true;
+
+       /*
+        * If these interfaces are protodown on, we need to un-protodown them
+        * in order to get Zebra to send us their addresses so we can
+        * autoconfigure them.
+        */
+       if (vr->v4->mvl_ifp)
+               vrrp_zclient_send_interface_protodown(vr->v4->mvl_ifp, false);
+       if (vr->v6->mvl_ifp)
+               vrrp_zclient_send_interface_protodown(vr->v6->mvl_ifp, false);
+
+        /* If they're not, we can go ahead and add the addresses we have */
        vrrp_autoconfig_autoaddrupdate(vr->v4);
        vrrp_autoconfig_autoaddrupdate(vr->v6);
 
-       vr->autoconf = true;
-
        return vr;
 }
 
@@ -1636,22 +1647,43 @@ static int vrrp_autoconfig_if_add(struct interface *ifp)
 
        if (!vr) {
                vr = vrrp_autoconfig_autocreate(ifp);
-               if (vr) {
-                       created = true;
-                       vrrp_zclient_send_interface_protodown(ifp, false);
-               }
+               created = true;
        }
 
-       if (!vr)
-               return -1;
-
-       if (vr->autoconf == false)
+       if (!vr || vr->autoconf == false)
                return 0;
-       else if (!created) {
-               if (vr->v4->mvl_ifp == ifp)
-                       vrrp_autoconfig_autoaddrupdate(vr->v4);
-               else if (vr->v6->mvl_ifp == ifp)
-                       vrrp_autoconfig_autoaddrupdate(vr->v6);
+
+       if (!created) {
+               /*
+                * We didn't create it, but it has already been autoconfigured.
+                * Try to attach this interface to the existing instance.
+                */
+               if (!vr->v4->mvl_ifp) {
+                       vrrp_attach_interface(vr->v4);
+                       /* If we just attached it, make sure it's turned on */
+                       if (vr->v4->mvl_ifp) {
+                               vrrp_zclient_send_interface_protodown(
+                                       vr->v4->mvl_ifp, false);
+                               /*
+                                * If it's already up, we can go ahead and add
+                                * the addresses we have
+                                */
+                               vrrp_autoconfig_autoaddrupdate(vr->v4);
+                       }
+               }
+               if (!vr->v6->mvl_ifp) {
+                       vrrp_attach_interface(vr->v6);
+                       /* If we just attached it, make sure it's turned on */
+                       if (vr->v6->mvl_ifp) {
+                               vrrp_zclient_send_interface_protodown(
+                                       vr->v6->mvl_ifp, false);
+                               /*
+                                * If it's already up, we can go ahead and add
+                                * the addresses we have
+                                */
+                               vrrp_autoconfig_autoaddrupdate(vr->v6);
+                       }
+               }
        }
 
        return 0;