* [PATCH v3 0/3] l2tp: fix ancillary data handling in ipv6 recv
@ 2013-01-31 11:02 Tom Parkin
2013-01-31 11:02 ` [PATCH v3 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-31 11:02 UTC (permalink / raw)
To: netdev; +Cc: jchapman, celston, Tom Parkin
Resubmitting to fix up whitespace issues.
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.
* Exports ip6_datagram_recv_ctl, so that modules may use it in their
receive paths.
* Changes l2tp_ip6 from using the IPv4-specific ip_cmsg_recv to use the
IPv6 version ip6_datagram_recv_ctl.
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 | 22 +++++++++++-----------
net/ipv6/datagram.c | 16 +++++++++-------
net/ipv6/ip6_flowlabel.c | 4 ++--
net/ipv6/ipv6_sockglue.c | 6 +++---
net/ipv6/raw.c | 6 +++---
net/ipv6/udp.c | 6 +++---
net/l2tp/l2tp_ip6.c | 10 +++++-----
net/sunrpc/svcsock.c | 2 +-
8 files changed, 37 insertions(+), 35 deletions(-)
--
1.7.9.5
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v3 1/3] ipv6: rename datagram_send_ctl and datagram_recv_ctl
2013-01-31 11:02 [PATCH v3 0/3] l2tp: fix ancillary data handling in ipv6 recv Tom Parkin
@ 2013-01-31 11:02 ` Tom Parkin
2013-01-31 11:02 ` [PATCH v3 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-31 11:02 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 | 22 +++++++++++-----------
net/ipv6/datagram.c | 15 ++++++++-------
net/ipv6/ip6_flowlabel.c | 4 ++--
net/ipv6/ipv6_sockglue.c | 6 +++---
net/ipv6/raw.c | 6 +++---
net/ipv6/udp.c | 6 +++---
net/l2tp/l2tp_ip6.c | 4 ++--
net/sunrpc/svcsock.c | 2 +-
8 files changed, 33 insertions(+), 32 deletions(-)
diff --git a/include/net/transp_v6.h b/include/net/transp_v6.h
index 498433d..938b7fd 100644
--- a/include/net/transp_v6.h
+++ b/include/net/transp_v6.h
@@ -34,17 +34,17 @@ extern int udpv6_connect(struct sock *sk,
struct sockaddr *uaddr,
int addr_len);
-extern int datagram_recv_ctl(struct sock *sk,
- struct msghdr *msg,
- struct sk_buff *skb);
-
-extern int 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);
+extern int ip6_datagram_recv_ctl(struct sock *sk,
+ struct msghdr *msg,
+ struct sk_buff *skb);
+
+extern 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);
#define LOOPBACK4_IPV6 cpu_to_be32(0x7f000006)
diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c
index 33be363..be6f49e 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,10 +600,10 @@ 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,
- struct msghdr *msg, struct flowi6 *fl6,
- struct ipv6_txoptions *opt,
- int *hlimit, int *tclass, int *dontfrag)
+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)
{
struct in6_pktinfo *src_info;
struct cmsghdr *cmsg;
@@ -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..d6de4b4 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..d1e2e8e 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..70fa814 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,8 +822,8 @@ 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,
- &hlimit, &tclass, &dontfrag);
+ err = ip6_datagram_send_ctl(sock_net(sk), sk, msg, &fl6, opt,
+ &hlimit, &tclass, &dontfrag);
if (err < 0) {
fl6_sock_release(flowlabel);
return err;
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index cb5bf49..599e1ba6 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,8 +1143,8 @@ 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,
- &hlimit, &tclass, &dontfrag);
+ err = ip6_datagram_send_ctl(sock_net(sk), sk, msg, &fl6, opt,
+ &hlimit, &tclass, &dontfrag);
if (err < 0) {
fl6_sock_release(flowlabel);
return err;
diff --git a/net/l2tp/l2tp_ip6.c b/net/l2tp/l2tp_ip6.c
index 9275471..2316947 100644
--- a/net/l2tp/l2tp_ip6.c
+++ b/net/l2tp/l2tp_ip6.c
@@ -554,8 +554,8 @@ 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,
- &hlimit, &tclass, &dontfrag);
+ err = ip6_datagram_send_ctl(sock_net(sk), sk, msg, &fl6, opt,
+ &hlimit, &tclass, &dontfrag);
if (err < 0) {
fl6_sock_release(flowlabel);
return err;
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 v3 2/3] ipv6: export ip6_datagram_recv_ctl
2013-01-31 11:02 [PATCH v3 0/3] l2tp: fix ancillary data handling in ipv6 recv Tom Parkin
2013-01-31 11:02 ` [PATCH v3 1/3] ipv6: rename datagram_send_ctl and datagram_recv_ctl Tom Parkin
@ 2013-01-31 11:02 ` Tom Parkin
2013-01-31 11:02 ` [PATCH v3 3/3] l2tp: correctly handle ancillary data in the ip6 recv path Tom Parkin
2013-01-31 18:53 ` [PATCH v3 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-31 11:02 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 be6f49e..f5a5478 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 v3 3/3] l2tp: correctly handle ancillary data in the ip6 recv path
2013-01-31 11:02 [PATCH v3 0/3] l2tp: fix ancillary data handling in ipv6 recv Tom Parkin
2013-01-31 11:02 ` [PATCH v3 1/3] ipv6: rename datagram_send_ctl and datagram_recv_ctl Tom Parkin
2013-01-31 11:02 ` [PATCH v3 2/3] ipv6: export ip6_datagram_recv_ctl Tom Parkin
@ 2013-01-31 11:02 ` Tom Parkin
2013-01-31 18:53 ` [PATCH v3 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-31 11:02 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 2316947..8ee4a86 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 v3 0/3] l2tp: fix ancillary data handling in ipv6 recv
2013-01-31 11:02 [PATCH v3 0/3] l2tp: fix ancillary data handling in ipv6 recv Tom Parkin
` (2 preceding siblings ...)
2013-01-31 11:02 ` [PATCH v3 3/3] l2tp: correctly handle ancillary data in the ip6 recv path Tom Parkin
@ 2013-01-31 18:53 ` David Miller
3 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2013-01-31 18:53 UTC (permalink / raw)
To: tparkin; +Cc: netdev, jchapman, celston
From: Tom Parkin <tparkin@katalix.com>
Date: Thu, 31 Jan 2013 11:02:23 +0000
> Resubmitting to fix up whitespace issues.
>
> 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.
>
> * Exports ip6_datagram_recv_ctl, so that modules may use it in their
> receive paths.
>
> * Changes l2tp_ip6 from using the IPv4-specific ip_cmsg_recv to use the
> IPv6 version ip6_datagram_recv_ctl.
Series applied, thanks a lot Tom.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-01-31 18:53 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-31 11:02 [PATCH v3 0/3] l2tp: fix ancillary data handling in ipv6 recv Tom Parkin
2013-01-31 11:02 ` [PATCH v3 1/3] ipv6: rename datagram_send_ctl and datagram_recv_ctl Tom Parkin
2013-01-31 11:02 ` [PATCH v3 2/3] ipv6: export ip6_datagram_recv_ctl Tom Parkin
2013-01-31 11:02 ` [PATCH v3 3/3] l2tp: correctly handle ancillary data in the ip6 recv path Tom Parkin
2013-01-31 18:53 ` [PATCH v3 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).