]> git.puffer.fish Git - matthieu/frr.git/commitdiff
vrrpd: use if_is_operative()
authorQuentin Young <qlyoung@cumulusnetworks.com>
Tue, 19 Feb 2019 22:01:35 +0000 (22:01 +0000)
committerQuentin Young <qlyoung@cumulusnetworks.com>
Fri, 17 May 2019 00:27:08 +0000 (00:27 +0000)
Checks for interface usability instead of admin state, which is what I
wanted anyway. Also removes the operstate check when binding interfaces.
This way we can bind currently inoperative interfaces, won't start until
they're at least admin up, but *will* start if they're carrier down,
because we can fix that (and probably caused it :)

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

index d22c245afea9115ad3fee266ae52f58044ef0049..28ff2fa3c763c99e90ec89e0c049df7c9e90e076 100644 (file)
@@ -250,13 +250,13 @@ void vrrp_check_start(struct vrrp_vrouter *vr)
        /* Must have a parent interface */
        start = start && (vr->ifp != NULL);
        /* Parent interface must be up */
-       start = start && (CHECK_FLAG(vr->ifp->flags, IFF_UP));
+       start = start && if_is_operative(vr->ifp);
        /* Parent interface must have at least one v4 */
        start = start && vr->ifp->connected->count > 1;
        /* Must have a macvlan interface */
        start = start && (r->mvl_ifp != NULL);
-       /* Macvlan interface must be up */
-       start = start && (CHECK_FLAG(r->mvl_ifp->flags, IFF_UP));
+       /* Macvlan interface must be admin up */
+       start = start && CHECK_FLAG(r->mvl_ifp->flags, IFF_UP);
        /* Must have at least one VIP configured */
        start = start && r->addrs->count > 0;
        if (start)
@@ -268,11 +268,11 @@ void vrrp_check_start(struct vrrp_vrouter *vr)
        /* Must have a parent interface */
        start = start && (vr->ifp != NULL);
        /* Parent interface must be up */
-       start = start && (CHECK_FLAG(vr->ifp->flags, IFF_UP));
+       start = start && if_is_operative(vr->ifp);
        /* Must have a macvlan interface */
        start = start && (r->mvl_ifp != NULL);
-       /* Macvlan interface must be up */
-       start = start && (CHECK_FLAG(r->mvl_ifp->flags, IFF_UP));
+       /* Macvlan interface must be admin up */
+       start = start && CHECK_FLAG(r->mvl_ifp->flags, IFF_UP);
        /* Macvlan interface must have at least two v6 */
        start = start && (r->mvl_ifp->connected->count >= 2);
        /* Macvlan interface must have a link local */
@@ -445,8 +445,7 @@ static bool vrrp_attach_interface(struct vrrp_router *r)
        unsigned int candidates = 0;
        struct interface *selection = NULL;
        for (unsigned int i = 0; i < ifps_cnt; i++) {
-               if (ifps[i]->link_ifindex != r->vr->ifp->ifindex
-                   || !CHECK_FLAG(ifps[i]->flags, IFF_UP))
+               if (ifps[i]->link_ifindex != r->vr->ifp->ifindex)
                        ifps[i] = NULL;
                else {
                        selection = selection ? selection : ifps[i];
@@ -1965,8 +1964,8 @@ void vrrp_if_address_del(struct interface *ifp)
         * Zebra is stupid and sends us address deletion notifications
         * when any of the following condition sets are met:
         *
-        * - IFF_UP && address deleted
-        * - IFF_UP -> !IFF_UP
+        * - if_is_operative && address deleted
+        * - if_is_operative -> !if_is_operative
         *
         * Note that the second one is nonsense, because Zebra behaves as
         * though an interface going down means all the addresses on that
@@ -1977,7 +1976,7 @@ void vrrp_if_address_del(struct interface *ifp)
         * we actually end up in Initialize whenever we try to go into Backup.
         *
         * Also, Zebra does NOT send us notifications when:
-        * - !IFF_UP && address deleted
+        * - !if_is_operative && address deleted
         *
         * Which means if we're in backup and an address is deleted out from
         * under us, we won't even know.
@@ -1994,7 +1993,7 @@ void vrrp_if_address_del(struct interface *ifp)
         * in this function should be protected by a check that the interface
         * is up.
         */
-       if (CHECK_FLAG(ifp->flags, IFF_UP)) {
+       if (if_is_operative(ifp)) {
                vrrp_autoconfig_if_address_del(ifp);
        }
 }