netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next v2 0/8] net: Improve netns handling in RTNL and ip_tunnel
@ 2024-11-07 13:29 Xiao Liang
  2024-11-07 13:29 ` [PATCH net-next v2 1/8] rtnetlink: Lookup device in target netns when creating link Xiao Liang
                   ` (7 more replies)
  0 siblings, 8 replies; 26+ messages in thread
From: Xiao Liang @ 2024-11-07 13:29 UTC (permalink / raw)
  To: netdev, linux-kselftest, Kuniyuki Iwashima, Jakub Kicinski
  Cc: David S. Miller, David Ahern, Eric Dumazet, Paolo Abeni,
	Ido Schimmel, Andrew Lunn, Simon Horman, Donald Hunter,
	Shuah Khan, Jiri Pirko, Hangbin Liu

This patch series includes some netns-related improvements and fixes for
RTNL and ip_tunnel, to make link creation more intuitive:

 - Creating link in another net namespace doesn't conflict with link names
   in current one.
 - Add a flag in rtnl_ops, to avoid netns change when link-netns is present
   if possible.
 - When creating ip tunnel (e.g. GRE) in another netns, use current as
   link-netns if not specified explicitly.

So that

  # modprobe ip_gre netns_atomic=1
  # ip link add netns ns1 link-netns ns2 tun0 type gre ...

will create tun0 in ns1, rather than create it in ns2 and move to ns1.
And don't conflict with another interface named "tun0" in current netns.

---

v2:
 - Check NLM_F_EXCL to ensure only link creation is affected.
 - Add self tests for link name/ifindex conflict and notifications
   in different netns.
 - Changes in dummy driver and ynl in order to add the test case.

v1:
 link: https://lore.kernel.org/all/20241023023146.372653-1-shaw.leon@gmail.com/


Xiao Liang (8):
  rtnetlink: Lookup device in target netns when creating link
  rtnetlink: Add netns_atomic flag in rtnl_link_ops
  net: ip_tunnel: Build flow in underlay net namespace
  net: ip_tunnel: Add source netns support for newlink
  net: ip_gre: Add netns_atomic module parameter
  net: dummy: Set netns_atomic in rtnl ops for testing
  tools/net/ynl: Add retry limit for async notification
  selftests: net: Add two test cases for link netns

 drivers/net/dummy.c                         |  1 +
 include/net/ip_tunnels.h                    |  3 ++
 include/net/rtnetlink.h                     |  3 ++
 net/core/rtnetlink.c                        | 17 +++++--
 net/ipv4/ip_gre.c                           | 15 +++++-
 net/ipv4/ip_tunnel.c                        | 27 +++++++----
 tools/net/ynl/lib/ynl.py                    |  7 ++-
 tools/testing/selftests/net/Makefile        |  1 +
 tools/testing/selftests/net/netns-name.sh   | 10 ++++
 tools/testing/selftests/net/netns_atomic.py | 54 +++++++++++++++++++++
 10 files changed, 121 insertions(+), 17 deletions(-)
 create mode 100755 tools/testing/selftests/net/netns_atomic.py

-- 
2.47.0


^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2024-11-12  6:05 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-07 13:29 [PATCH net-next v2 0/8] net: Improve netns handling in RTNL and ip_tunnel Xiao Liang
2024-11-07 13:29 ` [PATCH net-next v2 1/8] rtnetlink: Lookup device in target netns when creating link Xiao Liang
2024-11-07 13:29 ` [PATCH net-next v2 2/8] rtnetlink: Add netns_atomic flag in rtnl_link_ops Xiao Liang
2024-11-07 13:29 ` [PATCH net-next v2 3/8] net: ip_tunnel: Build flow in underlay net namespace Xiao Liang
2024-11-07 13:29 ` [PATCH net-next v2 4/8] net: ip_tunnel: Add source netns support for newlink Xiao Liang
2024-11-07 13:30 ` [PATCH net-next v2 5/8] net: ip_gre: Add netns_atomic module parameter Xiao Liang
2024-11-07 13:37   ` Eric Dumazet
2024-11-07 14:11     ` Xiao Liang
2024-11-07 15:59       ` Jakub Kicinski
2024-11-07 16:53         ` Xiao Liang
2024-11-08  4:04           ` Jakub Kicinski
2024-11-08  6:44             ` Xiao Liang
2024-11-10  0:59               ` Jakub Kicinski
2024-11-11  8:15                 ` Xiao Liang
2024-11-11 23:42                   ` Jakub Kicinski
2024-11-12  6:05                     ` Xiao Liang
2024-11-07 13:30 ` [PATCH net-next v2 6/8] net: dummy: Set netns_atomic in rtnl ops for testing Xiao Liang
2024-11-07 13:30 ` [PATCH net-next v2 7/8] tools/net/ynl: Add retry limit for async notification Xiao Liang
2024-11-07 16:04   ` Jakub Kicinski
2024-11-07 17:16     ` Donald Hunter
2024-11-08  8:45       ` Xiao Liang
2024-11-08 10:04         ` Donald Hunter
2024-11-08 12:00           ` Donald Hunter
2024-11-07 13:30 ` [PATCH net-next v2 8/8] selftests: net: Add two test cases for link netns Xiao Liang
2024-11-10  1:01   ` Jakub Kicinski
2024-11-11  8:16     ` Xiao Liang

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).