summaryrefslogtreecommitdiff
path: root/usr.sbin/ldpd
diff options
context:
space:
mode:
authorMichele Marchetto <michele@cvs.openbsd.org>2010-04-13 15:39:30 +0000
committerMichele Marchetto <michele@cvs.openbsd.org>2010-04-13 15:39:30 +0000
commitf6729288f523ca8f5dfe8da060731254d7680adb (patch)
tree0d11a03efce0d393aaf17d804a2688a9b4666ee5 /usr.sbin/ldpd
parentd1f76ec35e1b077eec8b9229a2e9e0ea557721b7 (diff)
When a prefix has a implicit null label associated, force pop operation.
This allow us to correcly do penultimate hop popping. From Thomas Habets. Thanks. ok claudio@
Diffstat (limited to 'usr.sbin/ldpd')
-rw-r--r--usr.sbin/ldpd/kroute.c18
-rw-r--r--usr.sbin/ldpd/lde_lib.c4
2 files changed, 15 insertions, 7 deletions
diff --git a/usr.sbin/ldpd/kroute.c b/usr.sbin/ldpd/kroute.c
index 37cbe5d3003..a9e1bbc031e 100644
--- a/usr.sbin/ldpd/kroute.c
+++ b/usr.sbin/ldpd/kroute.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kroute.c,v 1.9 2010/03/25 12:05:18 claudio Exp $ */
+/* $OpenBSD: kroute.c,v 1.10 2010/04/13 15:39:29 michele Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
@@ -1118,10 +1118,18 @@ send_rtmsg(int fd, int action, struct kroute *kroute, u_int32_t family)
iov[iovcnt].iov_base = &label_out;
iov[iovcnt++].iov_len = sizeof(label_out);
- if (family == AF_MPLS)
- hdr.rtm_mpls = MPLS_OP_SWAP;
- else
- hdr.rtm_mpls = MPLS_OP_PUSH;
+ if (ntohl(kroute->remote_label) >> MPLS_LABEL_OFFSET ==
+ MPLS_LABEL_IMPLNULL) {
+ if (family == AF_MPLS)
+ hdr.rtm_mpls = MPLS_OP_POP;
+ else
+ return (0);
+ } else {
+ if (family == AF_MPLS)
+ hdr.rtm_mpls = MPLS_OP_SWAP;
+ else
+ hdr.rtm_mpls = MPLS_OP_PUSH;
+ }
}
diff --git a/usr.sbin/ldpd/lde_lib.c b/usr.sbin/ldpd/lde_lib.c
index fdbb4c8e6dd..a67b681ce27 100644
--- a/usr.sbin/ldpd/lde_lib.c
+++ b/usr.sbin/ldpd/lde_lib.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lde_lib.c,v 1.14 2010/03/03 10:17:05 claudio Exp $ */
+/* $OpenBSD: lde_lib.c,v 1.15 2010/04/13 15:39:29 michele Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
@@ -118,7 +118,7 @@ rt_dump(pid_t pid)
rtctl.local_label = r->local_label;
rtctl.remote_label = r->remote_label;
- if (!r->present || r->remote_label == NO_LABEL)
+ if (!r->present)
rtctl.in_use = 0;
else
rtctl.in_use = 1;