summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQuentin Young <qlyoung@cumulusnetworks.com>2019-02-28 23:13:20 +0000
committerQuentin Young <qlyoung@cumulusnetworks.com>2019-05-17 00:27:08 +0000
commitd37281cb045a89cd2c80a9d71cfa5640b0b77079 (patch)
tree7a084ebe9b039812bcd3dfd2113d7879cad6a57c
parentc7e65c4f805d2378c710836877eb8db5f8211ef6 (diff)
vrrpd: fix autoconfig of protodown'd interfaces
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>
-rw-r--r--vrrpd/vrrp.c62
1 files changed, 47 insertions, 15 deletions
diff --git a/vrrpd/vrrp.c b/vrrpd/vrrp.c
index 55ae7ce7a4..4d4a66b6d1 100644
--- a/vrrpd/vrrp.c
+++ b/vrrpd/vrrp.c
@@ -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;