Refactor the netns code so less steps are needed to exec commands in a netns. Also remove some code which became dead. bloat-o-meter output:
$ bloat-o-meter ip.old ip add/remove: 0/5 grow/shrink: 3/3 up/down: 159/-358 (-199) Function old new delta netns_add 971 1058 +87 cmd_exec 207 254 +47 on_netns_exec 32 57 +25 netns_restore 69 67 -2 netns_switch 838 822 -16 on_netns_label 45 - -45 do_netns 1226 1180 -46 vrf_reset 55 - -55 do_each_netns 57 - -57 on_netns 60 - -60 netns_save 77 - -77 Total: Before=667505, After=667306, chg -0.03% Matteo Croce (2): netns: switch netns in the child when executing commands netns: make netns_{save,restore} static include/namespace.h | 2 -- include/utils.h | 5 +---- ip/ip.c | 1 - ip/ip_common.h | 1 - ip/ipnetns.c | 49 ++++++++++++++++++++++++++++++++------------- ip/ipvrf.c | 16 +-------------- lib/exec.c | 6 +++++- lib/namespace.c | 31 ---------------------------- lib/utils.c | 27 ------------------------- 9 files changed, 42 insertions(+), 96 deletions(-) -- 2.21.0