summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrenato <renato@openbsd.org>2016-05-23 16:37:42 +0000
committerrenato <renato@openbsd.org>2016-05-23 16:37:42 +0000
commitceebd37b91c4c8476d54f6412334ea8683cd4e92 (patch)
treea672a1bc72b6985fcabec22c8307cfbcccb64feb
parentDo not accept incomplete pseudowires in the configuration. (diff)
downloadwireguard-openbsd-ceebd37b91c4c8476d54f6412334ea8683cd4e92.tar.xz
wireguard-openbsd-ceebd37b91c4c8476d54f6412334ea8683cd4e92.zip
Check for local label before trying to install pseudowire.
While here, add a comment about ECMP and pseudowires.
-rw-r--r--usr.sbin/ldpd/l2vpn.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/usr.sbin/ldpd/l2vpn.c b/usr.sbin/ldpd/l2vpn.c
index 6af68e29f9c..555e7f61e56 100644
--- a/usr.sbin/ldpd/l2vpn.c
+++ b/usr.sbin/ldpd/l2vpn.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: l2vpn.c,v 1.6 2016/05/23 16:35:37 renato Exp $ */
+/* $OpenBSD: l2vpn.c,v 1.7 2016/05/23 16:37:42 renato Exp $ */
/*
* Copyright (c) 2015 Renato Westphal <renato@openbsd.org>
@@ -220,8 +220,12 @@ l2vpn_pw_ok(struct l2vpn_pw *pw, struct fec_nh *fnh)
fec.u.ipv4.prefix.s_addr = pw->addr.s_addr;
fec.u.ipv4.prefixlen = 32;
fn = (struct fec_node *)fec_find(&ft, &fec);
- if (fn == NULL)
+ if (fn == NULL || fn->local_label == NO_LABEL)
return (0);
+ /*
+ * Need to ensure that there's a label binding for all nexthops.
+ * Otherwise, ECMP for this route could render the pseudowire unusable.
+ */
LIST_FOREACH(fnh, &fn->nexthops, entry)
if (fnh->remote_label == NO_LABEL)
return (0);