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
39 struct sk_buff *skb);39 struct sk_buff *skb);
40 40
41extern int datagram_send_ctl(struct net *net,41extern int datagram_send_ctl(struct net *net,
42 struct sock *sk,
42 struct msghdr *msg,43 struct msghdr *msg,
43 struct flowi6 *fl6,44 struct flowi6 *fl6,
44 struct ipv6_txoptions *opt,45 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
599 return 0;599 return 0;
600}600}
601 601
602int datagram_send_ctl(struct net *net,602int datagram_send_ctl(struct net *net, struct sock *sk,
603 struct msghdr *msg, struct flowi6 *fl6,603 struct msghdr *msg, struct flowi6 *fl6,
604 struct ipv6_txoptions *opt,604 struct ipv6_txoptions *opt,
605 int *hlimit, int *tclass, int *dontfrag)605 int *hlimit, int *tclass, int *dontfrag)
@@ -658,7 +658,8 @@ int datagram_send_ctl(struct net *net, · 52 unmodified lines
658 658
659 if (addr_type != IPV6_ADDR_ANY) {659 if (addr_type != IPV6_ADDR_ANY) {
660 int strict = __ipv6_addr_src_scope(addr_type) <= IPV6_ADDR_SCOPE_LINKLOCAL;660 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,
662 strict ? dev : NULL, 0))663 strict ? dev : NULL, 0))
663 err = -EINVAL;664 err = -EINVAL;
664 else665 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
322}322}
323 323
324static struct ip6_flowlabel *324static struct ip6_flowlabel *
325fl_create(struct net *net, struct in6_flowlabel_req *freq, char __user *optval,325fl_create(struct net *net, struct sock *sk, struct in6_flowlabel_req *freq,
326 int optlen, int *err_p)326 char __user *optval, int optlen, int *err_p)
327{327{
328 struct ip6_flowlabel *fl = NULL;328 struct ip6_flowlabel *fl = NULL;
329 int olen;329 int olen;
@@ -360,7 +360,7 @@ fl_create(struct net *net, struct in6_flowlabel_req *freq, char __user *optval, · 30 unmodified lines
360 msg.msg_control = (void*)(fl->opt+1);360 msg.msg_control = (void*)(fl->opt+1);
361 memset(&flowi6, 0, sizeof(flowi6));361 memset(&flowi6, 0, sizeof(flowi6));
362 362
363 err = datagram_send_ctl(net, &msg, &flowi6, fl->opt, &junk,363 err = datagram_send_ctl(net, sk, &msg, &flowi6, fl->opt, &junk,
364 &junk, &junk);364 &junk, &junk);
365 if (err)365 if (err)
366 goto done;366 goto done;
@@ -528,7 +528,7 @@ int ipv6_flowlabel_opt(struct sock *sk, char __user *optval, int optlen) · 161 unmodified lines
528 if (freq.flr_label & ~IPV6_FLOWLABEL_MASK)528 if (freq.flr_label & ~IPV6_FLOWLABEL_MASK)
529 return -EINVAL;529 return -EINVAL;
530 530
531 fl = fl_create(net, &freq, optval, optlen, &err);531 fl = fl_create(net, sk, &freq, optval, optlen, &err);
532 if (fl == NULL)532 if (fl == NULL)
533 return err;533 return err;
534 sfl1 = kmalloc(sizeof(*sfl1), GFP_KERNEL);534 sfl1 = kmalloc(sizeof(*sfl1), GFP_KERNEL);
net/ipv6/ipv6_sockglue.c+1−1
@@ -475,7 +475,7 @@ sticky_done: · 474 unmodified lines
475 msg.msg_controllen = optlen;475 msg.msg_controllen = optlen;
476 msg.msg_control = (void*)(opt+1);476 msg.msg_control = (void*)(opt+1);
477 477
478 retv = datagram_send_ctl(net, &msg, &fl6, opt, &junk, &junk,478 retv = datagram_send_ctl(net, sk, &msg, &fl6, opt, &junk, &junk,
479 &junk);479 &junk);
480 if (retv)480 if (retv)
481 goto done;481 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
817 memset(opt, 0, sizeof(struct ipv6_txoptions));817 memset(opt, 0, sizeof(struct ipv6_txoptions));
818 opt->tot_len = sizeof(struct ipv6_txoptions);818 opt->tot_len = sizeof(struct ipv6_txoptions);
819 819
820 err = datagram_send_ctl(sock_net(sk), msg, &fl6, opt, &hlimit,820 err = datagram_send_ctl(sock_net(sk), sk, msg, &fl6, opt,
821 &tclass, &dontfrag);821 &hlimit, &tclass, &dontfrag);
822 if (err < 0) {822 if (err < 0) {
823 fl6_sock_release(flowlabel);823 fl6_sock_release(flowlabel);
824 return err;824 return err;
net/ipv6/udp.c+2−2
@@ -1090,8 +1090,8 @@ do_udp_sendmsg: · 1089 unmodified lines
1090 memset(opt, 0, sizeof(struct ipv6_txoptions));1090 memset(opt, 0, sizeof(struct ipv6_txoptions));
1091 opt->tot_len = sizeof(*opt);1091 opt->tot_len = sizeof(*opt);
1092 1092
1093 err = datagram_send_ctl(sock_net(sk), msg, &fl6, opt, &hlimit,1093 err = datagram_send_ctl(sock_net(sk), sk, msg, &fl6, opt,
1094 &tclass, &dontfrag);1094 &hlimit, &tclass, &dontfrag);
1095 if (err < 0) {1095 if (err < 0) {
1096 fl6_sock_release(flowlabel);1096 fl6_sock_release(flowlabel);
1097 return err;1097 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