summaryrefslogtreecommitdiffstats
path: root/net/tipc
diff options
context:
space:
mode:
authorRichard Alpe <richard.alpe@ericsson.com>2016-03-03 14:20:43 +0100
committerDavid S. Miller <davem@davemloft.net>2016-03-06 22:54:57 -0500
commit34f65dbb6c7572b826d836d62b99de32ecf2af48 (patch)
tree17f1ea1c6ecf7fac1d6bbc43a1ece9fc59ccb3b1 /net/tipc
parentddb3712552c8807c75576fb4fbdbb16f0d48b161 (diff)
downloadlinux-34f65dbb6c7572b826d836d62b99de32ecf2af48.tar.gz
linux-34f65dbb6c7572b826d836d62b99de32ecf2af48.tar.bz2
linux-34f65dbb6c7572b826d836d62b99de32ecf2af48.zip
tipc: make sure required IPv6 addresses are scoped
Make sure the user has provided a scope for multicast and link local addresses used locally by a UDP bearer. Signed-off-by: Richard Alpe <richard.alpe@ericsson.com> Acked-by: Jon Maloy <jon.maloy@ericsson.com> Reviewed-by: Erik Hugne <erik.hugne@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc')
-rw-r--r--net/tipc/udp_media.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/net/tipc/udp_media.c b/net/tipc/udp_media.c
index 6fe8740a226f..fb2f7ec68eef 100644
--- a/net/tipc/udp_media.c
+++ b/net/tipc/udp_media.c
@@ -310,9 +310,14 @@ err:
#if IS_ENABLED(CONFIG_IPV6)
} else if ((sa_local.ss_family & sa_remote.ss_family) == AF_INET6) {
+ int atype;
struct sockaddr_in6 *ip6;
ip6 = (struct sockaddr_in6 *)&sa_local;
+ atype = ipv6_addr_type(&ip6->sin6_addr);
+ if (__ipv6_addr_needs_scope_id(atype) && !ip6->sin6_scope_id)
+ return -EINVAL;
+
local->proto = htons(ETH_P_IPV6);
local->udp_port = ip6->sin6_port;
memcpy(&local->ipv6, &ip6->sin6_addr, sizeof(struct in6_addr));