ifupdown-netns/if-down.d/netns

16 lines
336 B
Text
Raw Normal View History

2018-04-07 19:40:38 +00:00
#!/bin/sh
set -e
if [ -n "${IF_NETNS}" ]
then
unshare -m /bin/sh <<-EOF
mount --make-rprivate /
mount --bind /run/network.${IF_NETNS} /run/network
if (ip netns exec ${IF_NETNS} ifquery --list | grep -qx ${IFACE}); then
ip netns exec ${IF_NETNS} ifdown ${IFACE}
fi
ip netns exec ${IF_NETNS} ip link set netns 1 dev ${IFACE}
EOF
fi