On 6/17/19 4:20 PM, Matteo Croce wrote: > > I looked for every occourrence of netns_switch(): > > bridge/bridge.c: if (netns_switch(argv[1])) > include/namespace.h:int netns_switch(char *netns); > ip/ip.c: if (netns_switch(argv[1])) > ip/ipnetns.c: if (netns_switch(argv[0])) > lib/namespace.c:int netns_switch(char *name) > lib/utils.c: if (netns_switch(nsname)) > misc/ss.c: if (netns_switch(optarg)) > tc/tc.c: if (netns_switch(argv[1])) > > the ones in {ss,tc,bridge,ip}.c are obviously handling the '-n netns' > command line option. > my question here is: should the VRF association be reset in all these cases? > If we need to reset, we should really call vrf_reset() from netns_switch(). > If don't, I can add the missing vrf_reset() in ipnetns.c but I'm > curious to know what can happen to change netns and keep VRF > associations belonging to another netns. >
The VRF reset is needed on a netns exec - ie., running a command in a network namespace. Any netns_switch that only involves sending a netlink command in a different namespace does not need the reset.