* [PATCH v2 0/3] l2tp: fix ancillary data handling in ipv6 recv @ 2013-01-30 14:21 Tom Parkin 2013-01-30 14:21 ` [PATCH v2 1/3] ipv6: rename datagram_send_ctl and datagram_recv_ctl Tom Parkin ` (3 more replies) 0 siblings, 4 replies; 5+ messages in thread From: Tom Parkin @ 2013-01-30 14:21 UTC (permalink / raw) To: netdev; +Cc: jchapman, celston, Tom Parkin Resubmitting patchset to fix l2tp's handling of ancillary data for ipv6. This patchset: * Renames the ipv6-specific datagram_send_ctl and datagram_recv_ctl functions as ip6_datagram_*. Since datagram_send_ctl is publicly exported it should be named such that it's clearly IPv6-specific. * Export ip6_datagram_recv_ctl, so that modules may use it in their receive paths. * Change l2tp_ip6 from using the IPv4-specific ip_cmsg_recv to use the IPv6 version ip6_datagram_recv_ctl. Patch 0001 includes some minor whitespace change in order to comply with checkpatch.pl's style recommendations. Tom Parkin (3): ipv6: rename datagram_send_ctl and datagram_recv_ctl ipv6: export ip6_datagram_recv_ctl l2tp: correctly handle ancillary data in the ip6 recv path include/net/transp_v6.h | 4 ++-- net/ipv6/datagram.c | 10 ++++++---- net/ipv6/ip6_flowlabel.c | 4 ++-- net/ipv6/ipv6_sockglue.c | 6 +++--- net/ipv6/raw.c | 4 ++-- net/ipv6/udp.c | 4 ++-- net/l2tp/l2tp_ip6.c | 8 ++++---- net/sunrpc/svcsock.c | 2 +- 8 files changed, 22 insertions(+), 20 deletions(-) -- 1.7.9.5 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2 1/3] ipv6: rename datagram_send_ctl and datagram_recv_ctl 2013-01-30 14:21 [PATCH v2 0/3] l2tp: fix ancillary data handling in ipv6 recv Tom Parkin @ 2013-01-30 14:21 ` Tom Parkin 2013-01-30 14:21 ` [PATCH v2 2/3] ipv6: export ip6_datagram_recv_ctl Tom Parkin ` (2 subsequent siblings) 3 siblings, 0 replies; 5+ messages in thread From: Tom Parkin @ 2013-01-30 14:21 UTC (permalink / raw) To: netdev; +Cc: jchapman, celston, Tom Parkin The datagram_*_ctl functions in net/ipv6/datagram.c are IPv6-specific. Since datagram_send_ctl is publicly exported it should be appropriately named to reflect the fact that it's for IPv6 only. Signed-off-by: Tom Parkin <tparkin@katalix.com> Signed-off-by: James Chapman <jchapman@katalix.com> --- include/net/transp_v6.h | 4 ++-- net/ipv6/datagram.c | 9 +++++---- net/ipv6/ip6_flowlabel.c | 4 ++-- net/ipv6/ipv6_sockglue.c | 6 +++--- net/ipv6/raw.c | 4 ++-- net/ipv6/udp.c | 4 ++-- net/l2tp/l2tp_ip6.c | 2 +- net/sunrpc/svcsock.c | 2 +- 8 files changed, 18 insertions(+), 17 deletions(-) diff --git a/include/net/transp_v6.h b/include/net/transp_v6.h index 498433d..fb334c6 100644 --- a/include/net/transp_v6.h +++ b/include/net/transp_v6.h @@ -34,11 +34,11 @@ extern int udpv6_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len); -extern int datagram_recv_ctl(struct sock *sk, +extern int ip6_datagram_recv_ctl(struct sock *sk, struct msghdr *msg, struct sk_buff *skb); -extern int datagram_send_ctl(struct net *net, +extern int ip6_datagram_send_ctl(struct net *net, struct sock *sk, struct msghdr *msg, struct flowi6 *fl6, diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c index 33be363..ecdea449 100644 --- a/net/ipv6/datagram.c +++ b/net/ipv6/datagram.c @@ -380,7 +380,7 @@ int ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len) if (skb->protocol == htons(ETH_P_IPV6)) { sin->sin6_addr = ipv6_hdr(skb)->saddr; if (np->rxopt.all) - datagram_recv_ctl(sk, msg, skb); + ip6_datagram_recv_ctl(sk, msg, skb); if (ipv6_addr_type(&sin->sin6_addr) & IPV6_ADDR_LINKLOCAL) sin->sin6_scope_id = IP6CB(skb)->iif; } else { @@ -468,7 +468,8 @@ out: } -int datagram_recv_ctl(struct sock *sk, struct msghdr *msg, struct sk_buff *skb) +int ip6_datagram_recv_ctl(struct sock *sk, struct msghdr *msg, + struct sk_buff *skb) { struct ipv6_pinfo *np = inet6_sk(sk); struct inet6_skb_parm *opt = IP6CB(skb); @@ -599,7 +600,7 @@ int datagram_recv_ctl(struct sock *sk, struct msghdr *msg, struct sk_buff *skb) return 0; } -int datagram_send_ctl(struct net *net, struct sock *sk, +int ip6_datagram_send_ctl(struct net *net, struct sock *sk, struct msghdr *msg, struct flowi6 *fl6, struct ipv6_txoptions *opt, int *hlimit, int *tclass, int *dontfrag) @@ -872,4 +873,4 @@ int datagram_send_ctl(struct net *net, struct sock *sk, exit_f: return err; } -EXPORT_SYMBOL_GPL(datagram_send_ctl); +EXPORT_SYMBOL_GPL(ip6_datagram_send_ctl); diff --git a/net/ipv6/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c index 29124b7..0b593df 100644 --- a/net/ipv6/ip6_flowlabel.c +++ b/net/ipv6/ip6_flowlabel.c @@ -365,8 +365,8 @@ fl_create(struct net *net, struct sock *sk, struct in6_flowlabel_req *freq, msg.msg_control = (void*)(fl->opt+1); memset(&flowi6, 0, sizeof(flowi6)); - err = datagram_send_ctl(net, sk, &msg, &flowi6, fl->opt, &junk, - &junk, &junk); + err = ip6_datagram_send_ctl(net, sk, &msg, &flowi6, fl->opt, + &junk, &junk, &junk); if (err) goto done; err = -EINVAL; diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c index ee94d31..c16030a 100644 --- a/net/ipv6/ipv6_sockglue.c +++ b/net/ipv6/ipv6_sockglue.c @@ -476,8 +476,8 @@ sticky_done: msg.msg_controllen = optlen; msg.msg_control = (void*)(opt+1); - retv = datagram_send_ctl(net, sk, &msg, &fl6, opt, &junk, &junk, - &junk); + retv = ip6_datagram_send_ctl(net, sk, &msg, &fl6, opt, &junk, + &junk, &junk); if (retv) goto done; update: @@ -1002,7 +1002,7 @@ static int do_ipv6_getsockopt(struct sock *sk, int level, int optname, release_sock(sk); if (skb) { - int err = datagram_recv_ctl(sk, &msg, skb); + int err = ip6_datagram_recv_ctl(sk, &msg, skb); kfree_skb(skb); if (err) return err; diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c index 6cd29b1..d11e835 100644 --- a/net/ipv6/raw.c +++ b/net/ipv6/raw.c @@ -507,7 +507,7 @@ static int rawv6_recvmsg(struct kiocb *iocb, struct sock *sk, sock_recv_ts_and_drops(msg, sk, skb); if (np->rxopt.all) - datagram_recv_ctl(sk, msg, skb); + ip6_datagram_recv_ctl(sk, msg, skb); err = copied; if (flags & MSG_TRUNC) @@ -822,7 +822,7 @@ static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk, memset(opt, 0, sizeof(struct ipv6_txoptions)); opt->tot_len = sizeof(struct ipv6_txoptions); - err = datagram_send_ctl(sock_net(sk), sk, msg, &fl6, opt, + err = ip6_datagram_send_ctl(sock_net(sk), sk, msg, &fl6, opt, &hlimit, &tclass, &dontfrag); if (err < 0) { fl6_sock_release(flowlabel); diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index cb5bf49..e3b47fe 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c @@ -467,7 +467,7 @@ try_again: ip_cmsg_recv(msg, skb); } else { if (np->rxopt.all) - datagram_recv_ctl(sk, msg, skb); + ip6_datagram_recv_ctl(sk, msg, skb); } err = copied; @@ -1143,7 +1143,7 @@ do_udp_sendmsg: memset(opt, 0, sizeof(struct ipv6_txoptions)); opt->tot_len = sizeof(*opt); - err = datagram_send_ctl(sock_net(sk), sk, msg, &fl6, opt, + err = ip6_datagram_send_ctl(sock_net(sk), sk, msg, &fl6, opt, &hlimit, &tclass, &dontfrag); if (err < 0) { fl6_sock_release(flowlabel); diff --git a/net/l2tp/l2tp_ip6.c b/net/l2tp/l2tp_ip6.c index 9275471..5f82011 100644 --- a/net/l2tp/l2tp_ip6.c +++ b/net/l2tp/l2tp_ip6.c @@ -554,7 +554,7 @@ static int l2tp_ip6_sendmsg(struct kiocb *iocb, struct sock *sk, memset(opt, 0, sizeof(struct ipv6_txoptions)); opt->tot_len = sizeof(struct ipv6_txoptions); - err = datagram_send_ctl(sock_net(sk), sk, msg, &fl6, opt, + err = ip6_datagram_send_ctl(sock_net(sk), sk, msg, &fl6, opt, &hlimit, &tclass, &dontfrag); if (err < 0) { fl6_sock_release(flowlabel); diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c index 0a148c9..0f679df 100644 --- a/net/sunrpc/svcsock.c +++ b/net/sunrpc/svcsock.c @@ -465,7 +465,7 @@ static int svc_udp_get_dest_address4(struct svc_rqst *rqstp, } /* - * See net/ipv6/datagram.c : datagram_recv_ctl + * See net/ipv6/datagram.c : ip6_datagram_recv_ctl */ static int svc_udp_get_dest_address6(struct svc_rqst *rqstp, struct cmsghdr *cmh) -- 1.7.9.5 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v2 2/3] ipv6: export ip6_datagram_recv_ctl 2013-01-30 14:21 [PATCH v2 0/3] l2tp: fix ancillary data handling in ipv6 recv Tom Parkin 2013-01-30 14:21 ` [PATCH v2 1/3] ipv6: rename datagram_send_ctl and datagram_recv_ctl Tom Parkin @ 2013-01-30 14:21 ` Tom Parkin 2013-01-30 14:21 ` [PATCH v2 3/3] l2tp: correctly handle ancillary data in the ip6 recv path Tom Parkin 2013-01-31 1:32 ` [PATCH v2 0/3] l2tp: fix ancillary data handling in ipv6 recv David Miller 3 siblings, 0 replies; 5+ messages in thread From: Tom Parkin @ 2013-01-30 14:21 UTC (permalink / raw) To: netdev; +Cc: jchapman, celston, Tom Parkin ip6_datagram_recv_ctl and ip6_datagram_send_ctl are used for handling IPv6 ancillary data. Since ip6_datagram_send_ctl is already publicly exported for use in modules, ip6_datagram_recv_ctl should also be available to support ancillary data in the receive path. Signed-off-by: Tom Parkin <tparkin@katalix.com> Signed-off-by: James Chapman <jchapman@katalix.com> --- net/ipv6/datagram.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c index ecdea449..8f6cc15a 100644 --- a/net/ipv6/datagram.c +++ b/net/ipv6/datagram.c @@ -599,6 +599,7 @@ int ip6_datagram_recv_ctl(struct sock *sk, struct msghdr *msg, } return 0; } +EXPORT_SYMBOL_GPL(ip6_datagram_recv_ctl); int ip6_datagram_send_ctl(struct net *net, struct sock *sk, struct msghdr *msg, struct flowi6 *fl6, -- 1.7.9.5 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v2 3/3] l2tp: correctly handle ancillary data in the ip6 recv path 2013-01-30 14:21 [PATCH v2 0/3] l2tp: fix ancillary data handling in ipv6 recv Tom Parkin 2013-01-30 14:21 ` [PATCH v2 1/3] ipv6: rename datagram_send_ctl and datagram_recv_ctl Tom Parkin 2013-01-30 14:21 ` [PATCH v2 2/3] ipv6: export ip6_datagram_recv_ctl Tom Parkin @ 2013-01-30 14:21 ` Tom Parkin 2013-01-31 1:32 ` [PATCH v2 0/3] l2tp: fix ancillary data handling in ipv6 recv David Miller 3 siblings, 0 replies; 5+ messages in thread From: Tom Parkin @ 2013-01-30 14:21 UTC (permalink / raw) To: netdev; +Cc: jchapman, celston, Tom Parkin l2tp_ip6 is incorrectly using the IPv4-specific ip_cmsg_recv to handle ancillary data. This means that socket options such as IPV6_RECVPKTINFO are not honoured in userspace. Convert l2tp_ip6 to use the IPv6-specific handler. Ref: net/ipv6/udp.c Signed-off-by: Tom Parkin <tparkin@katalix.com> Signed-off-by: James Chapman <jchapman@katalix.com> Signed-off-by: Chris Elston <celston@katalix.com> --- net/l2tp/l2tp_ip6.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/net/l2tp/l2tp_ip6.c b/net/l2tp/l2tp_ip6.c index 5f82011..0820251 100644 --- a/net/l2tp/l2tp_ip6.c +++ b/net/l2tp/l2tp_ip6.c @@ -646,7 +646,7 @@ static int l2tp_ip6_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, size_t len, int noblock, int flags, int *addr_len) { - struct inet_sock *inet = inet_sk(sk); + struct ipv6_pinfo *np = inet6_sk(sk); struct sockaddr_l2tpip6 *lsa = (struct sockaddr_l2tpip6 *)msg->msg_name; size_t copied = 0; int err = -EOPNOTSUPP; @@ -688,8 +688,8 @@ static int l2tp_ip6_recvmsg(struct kiocb *iocb, struct sock *sk, lsa->l2tp_scope_id = IP6CB(skb)->iif; } - if (inet->cmsg_flags) - ip_cmsg_recv(msg, skb); + if (np->rxopt.all) + ip6_datagram_recv_ctl(sk, msg, skb); if (flags & MSG_TRUNC) copied = skb->len; -- 1.7.9.5 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2 0/3] l2tp: fix ancillary data handling in ipv6 recv 2013-01-30 14:21 [PATCH v2 0/3] l2tp: fix ancillary data handling in ipv6 recv Tom Parkin ` (2 preceding siblings ...) 2013-01-30 14:21 ` [PATCH v2 3/3] l2tp: correctly handle ancillary data in the ip6 recv path Tom Parkin @ 2013-01-31 1:32 ` David Miller 3 siblings, 0 replies; 5+ messages in thread From: David Miller @ 2013-01-31 1:32 UTC (permalink / raw) To: tparkin; +Cc: netdev, jchapman, celston From: Tom Parkin <tparkin@katalix.com> Date: Wed, 30 Jan 2013 14:21:23 +0000 > Patch 0001 includes some minor whitespace change in order to comply with > checkpatch.pl's style recommendations. Those whitspace recommendations do not match what we use in the networking. A function call shall be indented like so: ret = func(arg1, arg2, arg3, arg4, arg5, arg6); That is, the arguments on the second and subsequent lines shall be indented to the first column after the openning parenthesis of the first line. You must use whatever combination of TAB and space characters are necessary to achieve it. If you are indenting only using TAB characters, it is guarenteed that you are doing it wrong. You also need to reindent the arguments in function declarations in the header files that you modified. The function name is longer on the first line, therefore the openning parenthesis appears deeper in the line, and therefore the second and further lines of the declaration have to be indent adjusted. Thanks. ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-01-31 1:32 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-01-30 14:21 [PATCH v2 0/3] l2tp: fix ancillary data handling in ipv6 recv Tom Parkin 2013-01-30 14:21 ` [PATCH v2 1/3] ipv6: rename datagram_send_ctl and datagram_recv_ctl Tom Parkin 2013-01-30 14:21 ` [PATCH v2 2/3] ipv6: export ip6_datagram_recv_ctl Tom Parkin 2013-01-30 14:21 ` [PATCH v2 3/3] l2tp: correctly handle ancillary data in the ip6 recv path Tom Parkin 2013-01-31 1:32 ` [PATCH v2 0/3] l2tp: fix ancillary data handling in ipv6 recv David Miller
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).