]> git.puffer.fish Git - mirror/frr.git/commitdiff
zebra, ldpd: fix display of pseudowire status
authorRenato Westphal <renato@opensourcerouting.org>
Wed, 29 Nov 2017 18:22:08 +0000 (16:22 -0200)
committerRenato Westphal <renato@opensourcerouting.org>
Wed, 29 Nov 2017 22:39:19 +0000 (20:39 -0200)
In some circumstances zebra and ldpd would display a pseudowire as UP
when in reality it's not (example: MTU mismatch between the two ends). Fix
this to avoid confusion.

Reported-by: ßingen <bingen@voltanet.io>
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
ldpd/l2vpn.c
ldpd/lde.c
ldpd/ldpd.h
zebra/zebra_pw.c

index 3335be08a890ae0e331cc86cdc7c219380bfb527..5bf9bd4575cdcc2b54285865c7c4daaab9145449 100644 (file)
@@ -550,7 +550,8 @@ l2vpn_pw_ctl(pid_t pid)
                            sizeof(pwctl.ifname));
                        pwctl.pwid = pw->pwid;
                        pwctl.lsr_id = pw->lsr_id;
-                       if (pw->local_status == PW_FORWARDING &&
+                       if (pw->enabled &&
+                           pw->local_status == PW_FORWARDING &&
                            pw->remote_status == PW_FORWARDING)
                                pwctl.status = 1;
 
index b597d967d7341c7ff71f5a9f8ae1aae60a7201c7..63e1e399463688a544cf16a4b9d97cdd9d9f10b2 100644 (file)
@@ -767,11 +767,12 @@ lde_send_change_klabel(struct fec_node *fn, struct fec_nh *fnh)
                    sizeof(kr));
                break;
        case FEC_TYPE_PWID:
-               if (fn->local_label == NO_LABEL ||
+               pw = (struct l2vpn_pw *) fn->data;
+               if (!pw || fn->local_label == NO_LABEL ||
                    fnh->remote_label == NO_LABEL)
                        return;
 
-               pw = (struct l2vpn_pw *) fn->data;
+               pw->enabled = true;
                pw2zpw(pw, &zpw);
                zpw.local_label = fn->local_label;
                zpw.remote_label = fnh->remote_label;
@@ -818,6 +819,10 @@ lde_send_delete_klabel(struct fec_node *fn, struct fec_nh *fnh)
                break;
        case FEC_TYPE_PWID:
                pw = (struct l2vpn_pw *) fn->data;
+               if (!pw)
+                       return;
+
+               pw->enabled = false;
                pw2zpw(pw, &zpw);
                zpw.local_label = fn->local_label;
                zpw.remote_label = fnh->remote_label;
index 5580ea5d676db10a160a7b0cf9dd60c735718ee7..4824f1720b3bf2b572e0b3530f3eb5641a453ab5 100644 (file)
@@ -409,6 +409,7 @@ struct l2vpn_pw {
        uint32_t                 pwid;
        char                     ifname[IF_NAMESIZE];
        unsigned int             ifindex;
+       bool                     enabled;
        uint32_t                 remote_group;
        uint16_t                 remote_mtu;
        uint32_t                 local_status;
index d3492fb41c1a11c689f21cd7ecd40bfb7b4ced8d..bbd01a759e9e71358fb78ccd842b76a496894b6e 100644 (file)
@@ -73,7 +73,7 @@ struct zebra_pw *zebra_pw_add(struct zebra_vrf *zvrf, const char *ifname,
        pw->protocol = protocol;
        pw->vrf_id = zvrf_id(zvrf);
        pw->client = client;
-       pw->status = PW_STATUS_UP;
+       pw->status = PW_STATUS_DOWN;
        pw->local_label = MPLS_NO_LABEL;
        pw->remote_label = MPLS_NO_LABEL;
        pw->flags = F_PSEUDOWIRE_CWORD;