]> git.puffer.fish Git - mirror/frr.git/commitdiff
ldpd: respect link-detect configuration 432/head
authorRenato Westphal <renato@opensourcerouting.org>
Sun, 30 Apr 2017 23:16:15 +0000 (20:16 -0300)
committerRenato Westphal <renato@opensourcerouting.org>
Mon, 1 May 2017 14:33:23 +0000 (11:33 -0300)
We shouldn't check the operational status of an interface in ldpd if
it's configured with "no link-detect" in zebra. That's what all the
other routing daemons do.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
ldpd/interface.c
ldpd/l2vpn.c
ldpd/ldp_zebra.c
ldpd/ldpd.h

index b7f473d3960762d05632e66b9cb08a01dfb94f91..7c75f3e084fafdc4eaadbf8098c5840c2294d592 100644 (file)
@@ -31,7 +31,7 @@ static struct if_addr *if_addr_new(struct kaddr *);
 static struct if_addr  *if_addr_lookup(struct if_addr_head *, struct kaddr *);
 static int              if_start(struct iface *, int);
 static int              if_reset(struct iface *, int);
-static void             if_update_af(struct iface_af *, int);
+static void             if_update_af(struct iface_af *);
 static int              if_hello_timer(struct thread *);
 static void             if_start_hello_timer(struct iface_af *);
 static void             if_stop_hello_timer(struct iface_af *);
@@ -139,7 +139,7 @@ if_update_info(struct iface *iface, struct kif *kif)
 
        /* get index and flags */
        iface->ifindex = kif->ifindex;
-       iface->flags = kif->flags;
+       iface->operative = kif->operative;
 }
 
 struct iface_af *
@@ -325,7 +325,7 @@ if_reset(struct iface *iface, int af)
 }
 
 static void
-if_update_af(struct iface_af *ia, int link_ok)
+if_update_af(struct iface_af *ia)
 {
        int                      addr_ok = 0, socket_ok, rtr_id_ok;
        struct if_addr          *if_addr;
@@ -363,14 +363,15 @@ if_update_af(struct iface_af *ia, int link_ok)
                rtr_id_ok = 0;
 
        if (ia->state == IF_STA_DOWN) {
-               if (!ia->enabled || !link_ok || !addr_ok || !socket_ok ||
-                   !rtr_id_ok)
+               if (!ia->enabled || !ia->iface->operative || !addr_ok ||
+                   !socket_ok || !rtr_id_ok)
                        return;
 
                ia->state = IF_STA_ACTIVE;
                if_start(ia->iface, ia->af);
        } else if (ia->state == IF_STA_ACTIVE) {
-               if (ia->enabled && link_ok && addr_ok && socket_ok && rtr_id_ok)
+               if (ia->enabled && ia->iface->operative && addr_ok &&
+                   socket_ok && rtr_id_ok)
                        return;
 
                ia->state = IF_STA_DOWN;
@@ -381,14 +382,10 @@ if_update_af(struct iface_af *ia, int link_ok)
 void
 ldp_if_update(struct iface *iface, int af)
 {
-       int                      link_ok;
-
-       link_ok = (iface->flags & IFF_UP) && (iface->flags & IFF_RUNNING);
-
        if (af == AF_INET || af == AF_UNSPEC)
-               if_update_af(&iface->ipv4, link_ok);
+               if_update_af(&iface->ipv4);
        if (af == AF_INET6 || af == AF_UNSPEC)
-               if_update_af(&iface->ipv6, link_ok);
+               if_update_af(&iface->ipv6);
 }
 
 void
@@ -463,7 +460,6 @@ if_to_ctl(struct iface_af *ia)
        memcpy(ictl.name, ia->iface->name, sizeof(ictl.name));
        ictl.ifindex = ia->iface->ifindex;
        ictl.state = ia->state;
-       ictl.flags = ia->iface->flags;
        ictl.type = ia->iface->type;
        ictl.hello_holdtime = if_get_hello_holdtime(ia);
        ictl.hello_interval = if_get_hello_interval(ia);
index 92d865210a32c5e330c7bc8cb2d90521f3af448e..27948f5a1aa50debfd6659a4396e2d15f666c37c 100644 (file)
@@ -142,7 +142,7 @@ void
 l2vpn_if_update_info(struct l2vpn_if *lif, struct kif *kif)
 {
        lif->ifindex = kif->ifindex;
-       lif->flags = kif->flags;
+       lif->operative = kif->operative;
        memcpy(lif->mac, kif->mac, sizeof(lif->mac));
 }
 
@@ -154,7 +154,7 @@ l2vpn_if_update(struct l2vpn_if *lif)
        struct map       fec;
        struct nbr      *nbr;
 
-       if ((lif->flags & IFF_UP) && (lif->flags & IFF_RUNNING))
+       if (lif->operative)
                return;
 
        RB_FOREACH(pw, l2vpn_pw_head, &l2vpn->pw_tree) {
index 702b5c5eaaf5203a37335b5007a628bb105e4460..f1fefaaead0ef862c0f89efb40c5fe3f08ef0a50 100644 (file)
@@ -64,7 +64,7 @@ ifp2kif(struct interface *ifp, struct kif *kif)
        memset(kif, 0, sizeof(*kif));
        strlcpy(kif->ifname, ifp->name, sizeof(kif->ifname));
        kif->ifindex = ifp->ifindex;
-       kif->flags = ifp->flags;
+       kif->operative = if_is_operative(ifp);
        if (ifp->ll_type == ZEBRA_LLT_ETHER)
                memcpy(kif->mac, ifp->hw_addr, ETHER_ADDR_LEN);
 }
@@ -257,7 +257,6 @@ ldp_interface_status_change(int command, struct zclient *zclient,
        struct connected        *ifc;
        struct kif               kif;
        struct kaddr             ka;
-       int                      link_new;
 
        /*
         * zebra_interface_state_read() updates interface structure in
@@ -272,8 +271,7 @@ ldp_interface_status_change(int command, struct zclient *zclient,
        ifp2kif(ifp, &kif);
        main_imsg_compose_both(IMSG_IFSTATUS, &kif, sizeof(kif));
 
-       link_new = (ifp->flags & IFF_UP) && (ifp->flags & IFF_RUNNING);
-       if (link_new) {
+       if (if_is_operative(ifp)) {
                for (ALL_LIST_ELEMENTS_RO(ifp->connected, node, ifc)) {
                        ifc2kaddr(ifp, ifc, &ka);
                        main_imsg_compose_ldpe(IMSG_NEWADDR, 0, &ka,
index d2fc5aa3afe8be4d12c0dfacfbd00ec843597e0a..47188c6bee39111a3ca3b63fe49b57b6765bf3cc 100644 (file)
@@ -298,7 +298,7 @@ struct iface {
        struct if_addr_head      addr_list;
        struct in6_addr          linklocal;
        enum iface_type          type;
-       uint16_t                 flags;
+       int                      operative;
        struct iface_af          ipv4;
        struct iface_af          ipv6;
        QOBJ_FIELDS
@@ -380,7 +380,7 @@ struct l2vpn_if {
        struct l2vpn            *l2vpn;
        char                     ifname[IF_NAMESIZE];
        unsigned int             ifindex;
-       uint16_t                 flags;
+       int                      operative;
        uint8_t                  mac[ETHER_ADDR_LEN];
        QOBJ_FIELDS
 };
@@ -552,6 +552,7 @@ struct kif {
        char                     ifname[IF_NAMESIZE];
        unsigned short           ifindex;
        int                      flags;
+       int                      operative;
        uint8_t                  mac[ETHER_ADDR_LEN];
        int                      mtu;
 };
@@ -569,7 +570,6 @@ struct ctl_iface {
        char                     name[IF_NAMESIZE];
        unsigned int             ifindex;
        int                      state;
-       uint16_t                 flags;
        enum iface_type          type;
        uint16_t                 hello_holdtime;
        uint16_t                 hello_interval;