Skip to content

Commit 296014a

Browse files
authored
Merge pull request #1579 from bingen/ldpd-fixes-3.0
ldpd: small improvements
2 parents d496127 + 09da818 commit 296014a

File tree

4 files changed

+23
-7
lines changed

4 files changed

+23
-7
lines changed

ldpd/l2vpn.c

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -294,17 +294,26 @@ int
294294
l2vpn_pw_ok(struct l2vpn_pw *pw, struct fec_nh *fnh)
295295
{
296296
/* check for a remote label */
297-
if (fnh->remote_label == NO_LABEL)
297+
if (fnh->remote_label == NO_LABEL) {
298+
log_warnx("%s: pseudowire %s: no remote label", __func__,
299+
pw->ifname);
298300
return (0);
301+
}
299302

300303
/* MTUs must match */
301-
if (pw->l2vpn->mtu != pw->remote_mtu)
304+
if (pw->l2vpn->mtu != pw->remote_mtu) {
305+
log_warnx("%s: pseudowire %s: MTU mismatch detected", __func__,
306+
pw->ifname);
302307
return (0);
308+
}
303309

304310
/* check pw status if applicable */
305311
if ((pw->flags & F_PW_STATUSTLV) &&
306-
pw->remote_status != PW_FORWARDING)
312+
pw->remote_status != PW_FORWARDING) {
313+
log_warnx("%s: pseudowire %s: remote end is down", __func__,
314+
pw->ifname);
307315
return (0);
316+
}
308317

309318
return (1);
310319
}
@@ -549,7 +558,8 @@ l2vpn_pw_ctl(pid_t pid)
549558
sizeof(pwctl.ifname));
550559
pwctl.pwid = pw->pwid;
551560
pwctl.lsr_id = pw->lsr_id;
552-
if (pw->local_status == PW_FORWARDING &&
561+
if (pw->enabled &&
562+
pw->local_status == PW_FORWARDING &&
553563
pw->remote_status == PW_FORWARDING)
554564
pwctl.status = 1;
555565

ldpd/lde.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -773,11 +773,12 @@ lde_send_change_klabel(struct fec_node *fn, struct fec_nh *fnh)
773773
sizeof(kr));
774774
break;
775775
case FEC_TYPE_PWID:
776-
if (fn->local_label == NO_LABEL ||
776+
pw = (struct l2vpn_pw *) fn->data;
777+
if (!pw || fn->local_label == NO_LABEL ||
777778
fnh->remote_label == NO_LABEL)
778779
return;
779780

780-
pw = (struct l2vpn_pw *) fn->data;
781+
pw->enabled = true;
781782
pw2zpw(pw, &zpw);
782783
zpw.local_label = fn->local_label;
783784
zpw.remote_label = fnh->remote_label;
@@ -824,6 +825,10 @@ lde_send_delete_klabel(struct fec_node *fn, struct fec_nh *fnh)
824825
break;
825826
case FEC_TYPE_PWID:
826827
pw = (struct l2vpn_pw *) fn->data;
828+
if (!pw)
829+
return;
830+
831+
pw->enabled = false;
827832
pw2zpw(pw, &zpw);
828833
zpw.local_label = fn->local_label;
829834
zpw.remote_label = fnh->remote_label;

ldpd/ldpd.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,7 @@ struct l2vpn_pw {
410410
uint32_t pwid;
411411
char ifname[IF_NAMESIZE];
412412
unsigned int ifindex;
413+
bool enabled;
413414
uint32_t remote_group;
414415
uint16_t remote_mtu;
415416
uint32_t local_status;

zebra/zebra_pw.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ struct zebra_pw *zebra_pw_add(struct zebra_vrf *zvrf, const char *ifname,
7171
pw->protocol = protocol;
7272
pw->vrf_id = zvrf_id(zvrf);
7373
pw->client = client;
74-
pw->status = PW_STATUS_UP;
74+
pw->status = PW_STATUS_DOWN;
7575
pw->local_label = MPLS_NO_LABEL;
7676
pw->remote_label = MPLS_NO_LABEL;
7777
pw->flags = F_PSEUDOWIRE_CWORD;

0 commit comments

Comments
 (0)