* [PATCH 1/2] ipv6: export symbol datagram_recv_ctl in datagram.c
2013-01-28 10:48 [PATCH 0/2] l2tp: fix ancilliary data handling in ip6 recv Tom Parkin
@ 2013-01-28 10:48 ` Tom Parkin
2013-01-28 10:48 ` [PATCH 2/2] l2tp: correctly handle ancilliary data for ip6 recv Tom Parkin
2013-01-29 19:12 ` [PATCH 0/2] l2tp: fix ancilliary data handling in " David Miller
2 siblings, 0 replies; 5+ messages in thread
From: Tom Parkin @ 2013-01-28 10:48 UTC (permalink / raw)
To: netdev; +Cc: jchapman, celston, Tom Parkin
Modules using datagram_send_ctl for ancilliary data in the send path should be
using datagram_recv_ctl for ancilliary data in the recv path. Export
datagram_recv_ctl accordingly.
Signed-off-by: Tom Parkin <tparkin@katalix.com>
Signed-off-by: Chris Elston <celston@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 33be363..f8a7b51 100644
--- a/net/ipv6/datagram.c
+++ b/net/ipv6/datagram.c
@@ -598,6 +598,7 @@ int datagram_recv_ctl(struct sock *sk, struct msghdr *msg, struct sk_buff *skb)
}
return 0;
}
+EXPORT_SYMBOL_GPL(datagram_recv_ctl);
int 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 2/2] l2tp: correctly handle ancilliary data for ip6 recv
2013-01-28 10:48 [PATCH 0/2] l2tp: fix ancilliary data handling in ip6 recv Tom Parkin
2013-01-28 10:48 ` [PATCH 1/2] ipv6: export symbol datagram_recv_ctl in datagram.c Tom Parkin
@ 2013-01-28 10:48 ` Tom Parkin
2013-01-29 19:12 ` [PATCH 0/2] l2tp: fix ancilliary data handling in " David Miller
2 siblings, 0 replies; 5+ messages in thread
From: Tom Parkin @ 2013-01-28 10:48 UTC (permalink / raw)
To: netdev; +Cc: jchapman, celston, Tom Parkin
l2tp_ip6 was using the IPv4 recv handler function for ancilliary data. This
patch changes it over to use the IPv6 handler, which allows l2tp_ip6 sockets to
correctly pass ancilliary data to userspace via. recvmsg().
Ref: net/ipv6/udp.c, udpv6_recvmsg
Signed-off-by: Tom Parkin <tparkin@katalix.com>
Signed-off-by: Chris Elston <celston@katalix.com>
Signed-off-by: James Chapman <jchapman@katalix.com>
---
net/l2tp/l2tp_ip6.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/net/l2tp/l2tp_ip6.c b/net/l2tp/l2tp_ip6.c
index 9275471..6824223 100644
--- a/net/l2tp/l2tp_ip6.c
+++ b/net/l2tp/l2tp_ip6.c
@@ -647,6 +647,7 @@ static int l2tp_ip6_recvmsg(struct kiocb *iocb, struct sock *sk,
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 +689,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)
+ 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 0/2] l2tp: fix ancilliary data handling in ip6 recv
2013-01-28 10:48 [PATCH 0/2] l2tp: fix ancilliary data handling in ip6 recv Tom Parkin
2013-01-28 10:48 ` [PATCH 1/2] ipv6: export symbol datagram_recv_ctl in datagram.c Tom Parkin
2013-01-28 10:48 ` [PATCH 2/2] l2tp: correctly handle ancilliary data for ip6 recv Tom Parkin
@ 2013-01-29 19:12 ` David Miller
2013-01-30 9:50 ` Tom Parkin
2 siblings, 1 reply; 5+ messages in thread
From: David Miller @ 2013-01-29 19:12 UTC (permalink / raw)
To: tparkin; +Cc: netdev, jchapman, celston
From: Tom Parkin <tparkin@katalix.com>
Date: Mon, 28 Jan 2013 10:48:52 +0000
> l2tp_ip6 was using the IPv4 handler functions for ancilliary data, which meant
> that socket options such as e.g. IPV6_RECVPKTINFO are not correctly passed to
> userspace.
>
> This patchset:
>
> * exports the IPv6 recv handler function datagram_recv_ctl so that
> modules may access it
> * updates l2tp_ip6 to use datagram_recv_ctl rather than ip_cmsg_recv
What a mess.
Well, no surprise that usage of these routines is often wrong given
the non-descript names the functions have.
Please rewrite this patch set, starting with a rename of both
datagram_recv_ctl() and datagram_send_ctl() such that you can
tell, by name, that they are ipv6 specific functions.
Please make sure to grep the entire tree and fix up all references,
they are references to the names in comments too.
They currently look like generic routines that might be found in
net/core/datagram.c and might be usable for all protocols, but that's
definitely not the case.
They are ipv6 specific, and if they are exported globally they must
have something expressing their ipv6'ness in their names.
Thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 0/2] l2tp: fix ancilliary data handling in ip6 recv
2013-01-29 19:12 ` [PATCH 0/2] l2tp: fix ancilliary data handling in " David Miller
@ 2013-01-30 9:50 ` Tom Parkin
0 siblings, 0 replies; 5+ messages in thread
From: Tom Parkin @ 2013-01-30 9:50 UTC (permalink / raw)
To: David Miller; +Cc: netdev, jchapman, celston
[-- Attachment #1: Type: text/plain, Size: 537 bytes --]
On Tue, Jan 29, 2013 at 02:12:39PM -0500, David Miller wrote:
> Please rewrite this patch set, starting with a rename of both
> datagram_recv_ctl() and datagram_send_ctl() such that you can
> tell, by name, that they are ipv6 specific functions.
>
> Please make sure to grep the entire tree and fix up all references,
> they are references to the names in comments too.
Sure, will do. Thanks, David.
Tom
--
Tom Parkin
Katalix Systems Ltd
http://www.katalix.com
Catalysts for your Embedded Linux software development
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 490 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread