]> git.proxmox.com Git - pve-firewall.git/blob - debian/ifupdown.sh
avoid use of --physdev-is-bridged whenever possible
[pve-firewall.git] / debian / ifupdown.sh
1 #!/bin/sh
2
3 # create a VETH device and plug it into bridge ${IF_VETH_BRIDGETO}
4
5 if [ -z "${IF_VETH_BRIDGETO}" ]; then
6 exit 0
7 fi
8
9 if [ ! -x /sbin/brctl ]
10 then
11 exit 0
12 fi
13
14 if [ "${MODE}" = "start" ]; then
15 test -d "/sys/class/net/${IF_VETH_BRIDGETO}" || ifup "${IF_VETH_BRIDGETO}" || exit 1
16 ip link add name "${IFACE}" type veth peer name "${IFACE}peer" || exit 1
17 ip link set "${IFACE}peer" up || exit 1
18 brctl addif "${IF_VETH_BRIDGETO}" "${IFACE}peer" || exit 1
19 elif [ "${MODE}" = "stop" ]; then
20 brctl delif "${IF_VETH_BRIDGETO}" "${IFACE}peer"
21 ip link set "${IFACE}peer" down || exit 1
22 ip link del "${IFACE}" || exit 1
23 fi
24
25 exit 0