Skip to content

RFC net namespace support in l2tp_core

Tom Parkin netdev 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest3 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3l2tp: set netnsok flag for netlink messagesnet/l2tp/l2tp_netlink.c+1 -00 replies
2/3l2tp: prevent tunnel creation on netns mismatchnet/l2tp/l2tp_core.c+9 -20 replies
3/3l2tp: fix network namespace use for unmanaged tunnel socketsnet/l2tp/l2tp_core.c+52 -310 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC PATCH 0/3] net namespace support in l2tp_core

This exploratory patchset is an attempt to fix up l2tp_core to behave properly with network namespaces, based on issues raised previously on netdev[1].

The reason I'm posting it as an RFC is that I'm seeing some bugs that I'm having trouble tracking down, and I'd appreciate any suggestions as to what I'm doing wrong.

During stress testing I see kernel oopses after a few hours. My stress test is a script which spawns lots of sub-processes which create and delete multiple namespaces containing multiple l2tp tunnels. I've seen oopses in various locations -- for example, ndist_net_exit, dst_ifdown, netlink_broadcast_filtered, dev_change_net_namespace. I'm assuming my changes are causing some race condition which might bite in multiple places depending on timing.

So far I'm guessing that the method I'm using to clean up l2tp tunnel sockets in the net namespace callback may be to blame. In the case of "unmanaged" sockets (see patch 3 for details) the socket is created using:

sock_create_kern
sk_change_net

to create a socket without a namespace reference. When the namespace exits, I walk the per-namespace list of tunnels, calling sk_release_kernel to release the socket. The l2tp-specific resources are freed in the socket destructor function.

This general pattern of socket creation and destruction (sock_create_kern/sk_change_net/sk_release_kernel) seems to be used elsewhere, for example inet_ctl_sock_create and inet_ctl_sock_destroy. So this seems reasonable. I'm not sure if hanging resource deallocation off sk_destruct in this context is OK, though. Any comments welcome!

Thanks,
Tom

[1].

	http://www.spinics.net/lists/netdev/msg214776.html
	http://www.spinics.net/lists/netdev/msg212234.html

Tom Parkin (3):
l2tp: set netnsok flag for netlink messages
l2tp: prevent tunnel creation on netns mismatch
l2tp: fix network namespace use for unmanaged tunnel sockets

 net/l2tp/l2tp_core.c    |   94 ++++++++++++++++++++++++++++++-----------------
 net/l2tp/l2tp_netlink.c |    1 +
 2 files changed, 62 insertions(+), 33 deletions(-)
Signature · 1 line
1.7.9.5