]>
Commit | Line | Data |
---|---|---|
1010159a AD |
1 | #!/bin/sh |
2 | ||
3 | # Most of this stuff is to enable vlans, it's really only needed by bridge_utils | |
4 | case "$IFACE" in | |
5 | # Ignore any alias (#272891) which uses <interface>:<alabel> | |
6 | *:*) | |
7 | exit 0 | |
8 | ;; | |
9 | vlan[0-9]*) | |
10 | VLANID=`echo $IFACE|sed "s/vlan*//"` | |
11 | ;; | |
12 | *.[0-9]*) | |
13 | # Silently ignore interfaces which ifupdown handles on its own | |
14 | # If IF_BRIDGE_PORTS is set, probably we're called by bridge-utils | |
15 | [ -z "$IF_VLAN_RAW_DEVICE" -a -z "$IF_BRIDGE_PORTS" ] && exit 0 | |
16 | VLANID=`echo $IFACE|sed "s/[a-zA-Z0-9]*\.//g"` | |
17 | IF_VLAN_RAW_DEVICE=`echo $IFACE|sed "s/\([a-zA-Z0-9]*\)\..*/\1/"` | |
18 | ;; | |
19 | ||
20 | *) | |
21 | exit 0 | |
22 | ;; | |
23 | esac | |
24 | ||
25 | if [ -n "$IF_VLAN_RAW_DEVICE" ]; then | |
26 | if ! ip link show dev "$IF_VLAN_RAW_DEVICE" > /dev/null; then | |
27 | echo "$IF_VLAN_RAW_DEVICE does not exist, unable to create $IFACE" | |
28 | exit 1 | |
29 | fi | |
30 | if [ ! -e "/sys/class/net/$IFACE" ]; then | |
31 | ip link set up dev $IF_VLAN_RAW_DEVICE | |
32 | ip link add link $IF_VLAN_RAW_DEVICE name $IFACE type vlan id $VLANID | |
33 | fi | |
34 | ||
35 | fi | |
36 | ||
37 | # This is not vlan specific, and should actually go somewhere else. | |
38 | if [ -n "$IF_HW_MAC_ADDRESS" ]; then | |
39 | ip link set $IFACE address $IF_HW_MAC_ADDRESS | |
40 | fi |