提交 34f65dbb 编写于 作者: R Richard Alpe 提交者: David S. Miller

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: NRichard Alpe <richard.alpe@ericsson.com>
Acked-by: NJon Maloy <jon.maloy@ericsson.com>
Reviewed-by: NErik Hugne <erik.hugne@gmail.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 ddb37125
......@@ -310,9 +310,14 @@ static int parse_options(struct nlattr *attrs[], struct udp_bearer *ub,
#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));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册