netns 276 B

12345678910111213
  1. #!/bin/sh
  2. set -e
  3. if [ -n "${IF_NETNS}" ]; then
  4. unshare -m /bin/sh <<-EOF
  5. mount --make-rprivate /
  6. mount --bind /run/network.${IF_NETNS} /run/network
  7. if (ip netns exec ${IF_NETNS} ifquery --list | grep -qx ${IFACE}); then
  8. ip netns exec ${IF_NETNS} ifup ${IFACE}
  9. fi
  10. EOF
  11. fi