ifupdown-netns/if-up.d/netns
2018-04-07 21:40:38 +02:00

13 lines
276 B
Bash
Executable file

#!/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} ifup ${IFACE}
fi
EOF
fi