Files
Guillaume Nault ebd8a443f1 net: Use link/peer netns in newlink() of rtnl_link_ops
JIRA: https://redhat.atlassian.net/browse/RHEL-144808
Upstream Status: linux.git
Conflicts:
  * (context) Missing upstream commit a885a6b2d37e ("net: convert to
    nla_get_*_default()"):
    In gtp_newlink(), Centos Stream 10 still uses nla_get_u8() to set
    ->restart_count, while upstream switched to nla_get_u8_default().

  * Missing upstream commit eb28fd76c0a0 ("gtp: Destroy device along
    with udp socket's netns dismantle."):
    In gtp_newlink(), Centos Stream 10 still used dev_net(dev) instead
    of the src_net variable when setting "gn".

  * (context) Missing upstream commit 46841c7053e6 ("gtp: Use
    for_each_netdev_rcu() in gtp_genl_dump_pdp()."):
    In gtp_newlink(), Centos Stream 10 still uses list_add_rcu() when
    adding the gtp device to the netns list as ->gtp_dev_list is still
    used under RCU protection (in gtp_genl_dump_pdp()).

  * (context) Missing upstream commit 83134ef46093 ("netkit: Add option
    for scrubbing skb meta data"):
    Centos Stream 10 doesn't have the IFLA_NETKIT_SCRUB and
    IFLA_NETKIT_PEER_SCRUB attributes and therefore netkit_new_link()
    doesn't have the scrub_{prim,peer} and policy_{prim,peer} variables
    and still uses default_{prim,peer} instead.

  * Missing upstream commit ffc90e9ca61b ("pfcp: Destroy device along
    with udp socket's netns dismantle."):
    In pfcp_newlink(), Centos Stream 10 still adds the the pfcp device
    to dev_net(dev) instead of net. It also uses list_add_rcu() when
    adding the pfcp device to the netns list, while upstream switched
    to plain list_add().

  * Already backported upstream commit c0178eec8884 ("net: hsr: prevent
    creation of HSR device with slaves from another netns") (RHEL
    commit 71ba9c253e):
    Centos Stream 10 already has the link and interlink variable in
    hsr_newlink() and we can now use the link_net variable when testing
    for device namespace correctness, as it is done uspstream (this
    reverts the RHEL specific merge conflict that RHEL commit
    71ba9c253e had to introduce).

commit cf517ac16ad96f3953d65ea198c0b310a1ffa14f
Author: Xiao Liang <shaw.leon@gmail.com>
Date:   Wed Feb 19 20:50:29 2025 +0800

    net: Use link/peer netns in newlink() of rtnl_link_ops

    Add two helper functions - rtnl_newlink_link_net() and
    rtnl_newlink_peer_net() for netns fallback logic. Peer netns falls back
    to link netns, and link netns falls back to source netns.

    Convert the use of params->net in netdevice drivers to one of the helper
    functions for clarity.

    Signed-off-by: Xiao Liang <shaw.leon@gmail.com>
    Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
    Link: https://patch.msgid.link/20250219125039.18024-4-shaw.leon@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Signed-off-by: Guillaume Nault <gnault@redhat.com>
2026-05-13 14:43:10 +02:00
..