diff options
author | Renato Westphal <renato@opensourcerouting.org> | 2016-12-12 21:26:04 +0100 |
---|---|---|
committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2016-12-14 19:21:08 +0100 |
commit | e885fc278c72d3bd094de40d705ba284a4a41c46 (patch) | |
tree | 9de559bf5f25100653b3fb6b07972706fb1a2212 /ldpd | |
parent | ldpd: add missing check on disc_find_iface() (diff) | |
download | frr-e885fc278c72d3bd094de40d705ba284a4a41c46.tar.xz frr-e885fc278c72d3bd094de40d705ba284a4a41c46.zip |
ldpd: remove security check to allow operation on unnumbered interfaces
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
(cherry picked from commit f25ccbd060a2086678f8608cafc5c5a2a2cf964a)
Diffstat (limited to 'ldpd')
-rw-r--r-- | ldpd/packet.c | 41 |
1 files changed, 6 insertions, 35 deletions
diff --git a/ldpd/packet.c b/ldpd/packet.c index ad7818131..be5ed8072 100644 --- a/ldpd/packet.c +++ b/ldpd/packet.c @@ -285,8 +285,6 @@ disc_find_iface(unsigned int ifindex, int af, union ldpd_addr *src, { struct iface *iface; struct iface_af *ia; - struct if_addr *if_addr; - in_addr_t mask; iface = if_lookup(leconf, ifindex); if (iface == NULL) @@ -297,41 +295,14 @@ disc_find_iface(unsigned int ifindex, int af, union ldpd_addr *src, return (NULL); /* - * For unicast packets, we just need to make sure that the interface - * is enabled for the given address-family. + * RFC 7552 - Section 5.1: + * "Link-local IPv6 address MUST be used as the source IP address in + * IPv6 LDP Link Hellos". */ - if (!multicast) - return (iface); - - switch (af) { - case AF_INET: - LIST_FOREACH(if_addr, &iface->addr_list, entry) { - if (if_addr->af != AF_INET) - continue; - - switch (iface->type) { - case IF_TYPE_POINTOPOINT: - if (if_addr->dstbrd.v4.s_addr == src->v4.s_addr) - return (iface); - break; - default: - mask = prefixlen2mask(if_addr->prefixlen); - if ((if_addr->addr.v4.s_addr & mask) == - (src->v4.s_addr & mask)) - return (iface); - break; - } - } - break; - case AF_INET6: - if (IN6_IS_ADDR_LINKLOCAL(&src->v6)) - return (iface); - break; - default: - fatalx("disc_find_iface: unknown af"); - } + if (multicast && af == AF_INET6 && !IN6_IS_ADDR_LINKLOCAL(&src->v6)) + return (NULL); - return (NULL); + return (iface); } int |