summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ldpd
diff options
context:
space:
mode:
authoryasuoka <yasuoka@openbsd.org>2019-12-12 00:10:29 +0000
committeryasuoka <yasuoka@openbsd.org>2019-12-12 00:10:29 +0000
commitddc8fec13db25891d49e4fa3a85e9844014a17eb (patch)
tree70e8959c7987bea2a40b59ad32fbc818c8df50d7 /usr.sbin/ldpd
parentadd a note about the 'extensions' field in the signed object (diff)
downloadwireguard-openbsd-ddc8fec13db25891d49e4fa3a85e9844014a17eb.tar.xz
wireguard-openbsd-ddc8fec13db25891d49e4fa3a85e9844014a17eb.zip
Make ldpd lookup the adjacency not only by source IP address but also
by LSR Id, since remote peer may change its LSR Id. diff from and test by Vitaliy Guschin. ok claudio
Diffstat (limited to 'usr.sbin/ldpd')
-rw-r--r--usr.sbin/ldpd/adjacency.c5
-rw-r--r--usr.sbin/ldpd/hello.c3
-rw-r--r--usr.sbin/ldpd/ldpe.h3
3 files changed, 8 insertions, 3 deletions
diff --git a/usr.sbin/ldpd/adjacency.c b/usr.sbin/ldpd/adjacency.c
index a40027225ea..8e54b880f3f 100644
--- a/usr.sbin/ldpd/adjacency.c
+++ b/usr.sbin/ldpd/adjacency.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: adjacency.c,v 1.26 2016/06/18 17:31:32 renato Exp $ */
+/* $OpenBSD: adjacency.c,v 1.27 2019/12/12 00:10:29 yasuoka Exp $ */
/*
* Copyright (c) 2013, 2015 Renato Westphal <renato@openbsd.org>
@@ -121,6 +121,9 @@ adj_find(struct hello_source *source)
if (adj->source.type != source->type)
continue;
+ if (adj->lsr_id.s_addr != source->lsr_id.s_addr)
+ continue;
+
switch (source->type) {
case HELLO_LINK:
if (ldp_addrcmp(source->link.ia->af,
diff --git a/usr.sbin/ldpd/hello.c b/usr.sbin/ldpd/hello.c
index f6d6245b3bd..0b6e1eaddc6 100644
--- a/usr.sbin/ldpd/hello.c
+++ b/usr.sbin/ldpd/hello.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hello.c,v 1.57 2016/07/16 19:20:16 renato Exp $ */
+/* $OpenBSD: hello.c,v 1.58 2019/12/12 00:10:29 yasuoka Exp $ */
/*
* Copyright (c) 2013, 2016 Renato Westphal <renato@openbsd.org>
@@ -229,6 +229,7 @@ recv_hello(struct in_addr lsr_id, struct ldp_msg *msg, int af,
}
memset(&source, 0, sizeof(source));
+ source.lsr_id = lsr_id;
if (flags & F_HELLO_TARGETED) {
/*
* RFC 7552 - Section 5.2:
diff --git a/usr.sbin/ldpd/ldpe.h b/usr.sbin/ldpd/ldpe.h
index a4ad7de0440..216c8c7bca6 100644
--- a/usr.sbin/ldpd/ldpe.h
+++ b/usr.sbin/ldpd/ldpe.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ldpe.h,v 1.76 2019/01/23 02:02:04 dlg Exp $ */
+/* $OpenBSD: ldpe.h,v 1.77 2019/12/12 00:10:29 yasuoka Exp $ */
/*
* Copyright (c) 2013, 2016 Renato Westphal <renato@openbsd.org>
@@ -33,6 +33,7 @@
struct hello_source {
enum hello_type type;
+ struct in_addr lsr_id;
struct {
struct iface_af *ia;
union ldpd_addr src_addr;