zebra, ldpd: fix display of pseudowire status

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>
This commit is contained in:
Renato Westphal 2017-11-29 16:22:08 -02:00
parent 69df82f3b5
commit 3c5b5220f7
4 changed files with 11 additions and 4 deletions

View 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;

View 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;

View 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;

View 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;