Commit 91e1908f authored by YOSHIFUJI Hideaki's avatar YOSHIFUJI Hideaki

[IPV6] NETNS: Handle ancillary data in appropriate namespace.

Signed-off-by: default avatarYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
parent 187e3838
...@@ -40,7 +40,8 @@ extern int datagram_recv_ctl(struct sock *sk, ...@@ -40,7 +40,8 @@ extern int datagram_recv_ctl(struct sock *sk,
struct msghdr *msg, struct msghdr *msg,
struct sk_buff *skb); struct sk_buff *skb);
extern int datagram_send_ctl(struct msghdr *msg, extern int datagram_send_ctl(struct net *net,
struct msghdr *msg,
struct flowi *fl, struct flowi *fl,
struct ipv6_txoptions *opt, struct ipv6_txoptions *opt,
int *hlimit, int *tclass); int *hlimit, int *tclass);
......
...@@ -496,7 +496,8 @@ int datagram_recv_ctl(struct sock *sk, struct msghdr *msg, struct sk_buff *skb) ...@@ -496,7 +496,8 @@ int datagram_recv_ctl(struct sock *sk, struct msghdr *msg, struct sk_buff *skb)
return 0; return 0;
} }
int datagram_send_ctl(struct msghdr *msg, struct flowi *fl, int datagram_send_ctl(struct net *net,
struct msghdr *msg, struct flowi *fl,
struct ipv6_txoptions *opt, struct ipv6_txoptions *opt,
int *hlimit, int *tclass) int *hlimit, int *tclass)
{ {
...@@ -540,7 +541,7 @@ int datagram_send_ctl(struct msghdr *msg, struct flowi *fl, ...@@ -540,7 +541,7 @@ int datagram_send_ctl(struct msghdr *msg, struct flowi *fl,
addr_type = __ipv6_addr_type(&src_info->ipi6_addr); addr_type = __ipv6_addr_type(&src_info->ipi6_addr);
if (fl->oif) { if (fl->oif) {
dev = dev_get_by_index(&init_net, fl->oif); dev = dev_get_by_index(net, fl->oif);
if (!dev) if (!dev)
return -ENODEV; return -ENODEV;
} else if (addr_type & IPV6_ADDR_LINKLOCAL) } else if (addr_type & IPV6_ADDR_LINKLOCAL)
...@@ -548,7 +549,7 @@ int datagram_send_ctl(struct msghdr *msg, struct flowi *fl, ...@@ -548,7 +549,7 @@ int datagram_send_ctl(struct msghdr *msg, struct flowi *fl,
if (addr_type != IPV6_ADDR_ANY) { if (addr_type != IPV6_ADDR_ANY) {
int strict = __ipv6_addr_src_scope(addr_type) <= IPV6_ADDR_SCOPE_LINKLOCAL; int strict = __ipv6_addr_src_scope(addr_type) <= IPV6_ADDR_SCOPE_LINKLOCAL;
if (!ipv6_chk_addr(&init_net, &src_info->ipi6_addr, if (!ipv6_chk_addr(net, &src_info->ipi6_addr,
strict ? dev : NULL, 0)) strict ? dev : NULL, 0))
err = -EINVAL; err = -EINVAL;
else else
......
...@@ -354,7 +354,7 @@ fl_create(struct net *net, struct in6_flowlabel_req *freq, char __user *optval, ...@@ -354,7 +354,7 @@ fl_create(struct net *net, struct in6_flowlabel_req *freq, char __user *optval,
msg.msg_control = (void*)(fl->opt+1); msg.msg_control = (void*)(fl->opt+1);
flowi.oif = 0; flowi.oif = 0;
err = datagram_send_ctl(&msg, &flowi, fl->opt, &junk, &junk); err = datagram_send_ctl(net, &msg, &flowi, fl->opt, &junk, &junk);
if (err) if (err)
goto done; goto done;
err = -EINVAL; err = -EINVAL;
......
...@@ -416,7 +416,7 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname, ...@@ -416,7 +416,7 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname,
msg.msg_controllen = optlen; msg.msg_controllen = optlen;
msg.msg_control = (void*)(opt+1); msg.msg_control = (void*)(opt+1);
retv = datagram_send_ctl(&msg, &fl, opt, &junk, &junk); retv = datagram_send_ctl(net, &msg, &fl, opt, &junk, &junk);
if (retv) if (retv)
goto done; goto done;
update: update:
......
...@@ -813,7 +813,7 @@ static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk, ...@@ -813,7 +813,7 @@ static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk,
memset(opt, 0, sizeof(struct ipv6_txoptions)); memset(opt, 0, sizeof(struct ipv6_txoptions));
opt->tot_len = sizeof(struct ipv6_txoptions); opt->tot_len = sizeof(struct ipv6_txoptions);
err = datagram_send_ctl(msg, &fl, opt, &hlimit, &tclass); err = datagram_send_ctl(sock_net(sk), msg, &fl, opt, &hlimit, &tclass);
if (err < 0) { if (err < 0) {
fl6_sock_release(flowlabel); fl6_sock_release(flowlabel);
return err; return err;
......
...@@ -731,7 +731,7 @@ int udpv6_sendmsg(struct kiocb *iocb, struct sock *sk, ...@@ -731,7 +731,7 @@ int udpv6_sendmsg(struct kiocb *iocb, struct sock *sk,
memset(opt, 0, sizeof(struct ipv6_txoptions)); memset(opt, 0, sizeof(struct ipv6_txoptions));
opt->tot_len = sizeof(*opt); opt->tot_len = sizeof(*opt);
err = datagram_send_ctl(msg, &fl, opt, &hlimit, &tclass); err = datagram_send_ctl(sock_net(sk), msg, &fl, opt, &hlimit, &tclass);
if (err < 0) { if (err < 0) {
fl6_sock_release(flowlabel); fl6_sock_release(flowlabel);
return err; return err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment