History

net: relax PKTINFO non local ipv6 udp xmit check

Allow transparent sockets to be less restrictive about the source ip of ipv6 udp packets being sent.

Maciej Żenczykowski committed 15 years ago

Commit ec0506d1 parent 0f43dd56 files · +13 −11Browse files

Unified · Split

6 files
  1. include/net/transp_v6.h +1 −0
  2. net/ipv6/datagram.c +3 −2
  3. net/ipv6/ip6_flowlabel.c +4 −4
  4. net/ipv6/ipv6_sockglue.c +1 −1
  5. net/ipv6/raw.c +2 −2
  6. net/ipv6/udp.c +2 −2
include/net/transp_v6.h+1−0
@@ -39,6 +39,7 @@ extern int datagram_recv_ctl(struct sock *sk, · 38 unmodified lines
3939 struct sk_buff *skb);
4040
4141 extern int datagram_send_ctl(struct net *net,
42+ struct sock *sk,
4243 struct msghdr *msg,
4344 struct flowi6 *fl6,
4445 struct ipv6_txoptions *opt,
net/ipv6/datagram.c+3−2
@@ -599,7 +599,7 @@ int datagram_recv_ctl(struct sock *sk, struct msghdr *msg, struct sk_buff *skb) · 598 unmodified lines
599599 return 0;
600600 }
601601
602−int datagram_send_ctl(struct net *net,
602+int datagram_send_ctl(struct net *net, struct sock *sk,
603603 struct msghdr *msg, struct flowi6 *fl6,
604604 struct ipv6_txoptions *opt,
605605 int *hlimit, int *tclass, int *dontfrag)
@@ -658,7 +658,8 @@ int datagram_send_ctl(struct net *net, · 52 unmodified lines
658658
659659 if (addr_type != IPV6_ADDR_ANY) {
660660 int strict = __ipv6_addr_src_scope(addr_type) <= IPV6_ADDR_SCOPE_LINKLOCAL;
661− if (!ipv6_chk_addr(net, &src_info->ipi6_addr,
661+ if (!inet_sk(sk)->transparent &&
662+ !ipv6_chk_addr(net, &src_info->ipi6_addr,
662663 strict ? dev : NULL, 0))
663664 err = -EINVAL;
664665 else
net/ipv6/ip6_flowlabel.c+4−4
@@ -322,8 +322,8 @@ static int fl6_renew(struct ip6_flowlabel *fl, unsigned long linger, unsigned lo · 321 unmodified lines
322322 }
323323
324324 static struct ip6_flowlabel *
325−fl_create(struct net *net, struct in6_flowlabel_req *freq, char __user *optval,
326− int optlen, int *err_p)
325+fl_create(struct net *net, struct sock *sk, struct in6_flowlabel_req *freq,
326+ char __user *optval, int optlen, int *err_p)
327327 {
328328 struct ip6_flowlabel *fl = NULL;
329329 int olen;
@@ -360,7 +360,7 @@ fl_create(struct net *net, struct in6_flowlabel_req *freq, char __user *optval, · 30 unmodified lines
360360 msg.msg_control = (void*)(fl->opt+1);
361361 memset(&flowi6, 0, sizeof(flowi6));
362362
363− err = datagram_send_ctl(net, &msg, &flowi6, fl->opt, &junk,
363+ err = datagram_send_ctl(net, sk, &msg, &flowi6, fl->opt, &junk,
364364 &junk, &junk);
365365 if (err)
366366 goto done;
@@ -528,7 +528,7 @@ int ipv6_flowlabel_opt(struct sock *sk, char __user *optval, int optlen) · 161 unmodified lines
528528 if (freq.flr_label & ~IPV6_FLOWLABEL_MASK)
529529 return -EINVAL;
530530
531− fl = fl_create(net, &freq, optval, optlen, &err);
531+ fl = fl_create(net, sk, &freq, optval, optlen, &err);
532532 if (fl == NULL)
533533 return err;
534534 sfl1 = kmalloc(sizeof(*sfl1), GFP_KERNEL);
net/ipv6/ipv6_sockglue.c+1−1
@@ -475,7 +475,7 @@ sticky_done: · 474 unmodified lines
475475 msg.msg_controllen = optlen;
476476 msg.msg_control = (void*)(opt+1);
477477
478− retv = datagram_send_ctl(net, &msg, &fl6, opt, &junk, &junk,
478+ retv = datagram_send_ctl(net, sk, &msg, &fl6, opt, &junk, &junk,
479479 &junk);
480480 if (retv)
481481 goto done;
net/ipv6/raw.c+2−2
@@ -817,8 +817,8 @@ static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk, · 816 unmodified lines
817817 memset(opt, 0, sizeof(struct ipv6_txoptions));
818818 opt->tot_len = sizeof(struct ipv6_txoptions);
819819
820− err = datagram_send_ctl(sock_net(sk), msg, &fl6, opt, &hlimit,
821− &tclass, &dontfrag);
820+ err = datagram_send_ctl(sock_net(sk), sk, msg, &fl6, opt,
821+ &hlimit, &tclass, &dontfrag);
822822 if (err < 0) {
823823 fl6_sock_release(flowlabel);
824824 return err;
net/ipv6/udp.c+2−2
@@ -1090,8 +1090,8 @@ do_udp_sendmsg: · 1089 unmodified lines
10901090 memset(opt, 0, sizeof(struct ipv6_txoptions));
10911091 opt->tot_len = sizeof(*opt);
10921092
1093− err = datagram_send_ctl(sock_net(sk), msg, &fl6, opt, &hlimit,
1094− &tclass, &dontfrag);
1093+ err = datagram_send_ctl(sock_net(sk), sk, msg, &fl6, opt,
1094+ &hlimit, &tclass, &dontfrag);
10951095 if (err < 0) {
10961096 fl6_sock_release(flowlabel);
10971097 return err;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t