| 1 |
#!/bin/sh |
| 2 |
# |
| 3 |
# Configures the interfaces needed for communication between namespaces. |
| 4 |
# This handles the bridge-end of the veth pair. |
| 5 |
interface=$1 |
| 6 |
|
| 7 |
# the main bridge interface is called 'selftest0' (although in future we may |
| 8 |
# want to segregate the different domains by using different bridges) |
| 9 |
bridge=$2 |
| 10 |
|
| 11 |
# we need to wait for the child namespace to start up and add the new |
| 12 |
# interface back to our new namespace |
| 13 |
while ! ip link show $interface >/dev/null 2>&1; do |
| 14 |
sleep 0.1 |
| 15 |
echo "Waiting for $interface to be created..." |
| 16 |
done |
| 17 |
|
| 18 |
# bring the bridge-end of the link up and add it to the bridge |
| 19 |
ip link set dev $interface up |
| 20 |
ip link set $interface master $bridge |