• Nicolas Dichtel's avatar
    netns: don't clear nsid too early on removal · 4217291e
    Nicolas Dichtel authored
    With the current code, ids are removed too early.
    Suppose you have an ipip interface that stands in the netns foo and its link
    part in the netns bar (so the netns bar has an nsid into the netns foo).
    Now, you remove the netns bar:
     - the bar nsid into the netns foo is removed
     - the netns exit method of ipip is called, thus our ipip iface is removed:
       => a netlink message is sent in the netns foo to advertise this deletion
       => this netlink message requests an nsid for bar, thus a new nsid is
          allocated for bar and never removed.
    
    We must remove nsids when we are sure that nobody will refer to netns currently
    cleaned.
    
    Fixes: 0c7aecd4 ("netns: add rtnl cmd to add and get peer netns ids")
    Signed-off-by: default avatarNicolas Dichtel <nicolas.dichtel@6wind.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    4217291e
net_namespace.c 20.1 KB