[pve-devel] [PATCH] add vlan aware bridge ifupdown script v2

Dietmar Maurer dietmar at proxmox.com
Tue Jul 28 09:18:05 CEST 2015


Seems we have the same code in 

/etc/network/if-pre-up.d/vlan
/etc/network/if-pre-up.d/vmbrvlan

So what code gets executed? both?

> diff --git a/vmbrvlan b/vmbrvlan
> new file mode 100755
> index 0000000..ee570f0
> --- /dev/null
> +++ b/vmbrvlan
> @@ -0,0 +1,38 @@
> +#!/bin/sh
> +
> +# Most of this stuff is to enable vlans
> +
> +case "$IFACE" in
> +  # Ignore any alias (#272891) which uses <interface>:<alabel>
> +  *:*)
> +    exit 0
> +  ;;
> +  vmbr*.*)
> +    vconfig set_name_type DEV_PLUS_VID_NO_PAD
> +    VLANID=`echo $IFACE|sed "s/vmbr[0-9][0-9]*\.0*//g"`
> +    IF_VLAN_RAW_DEVICE=`echo $IFACE|sed "s/\(vmbr[0-9][0-9]*\)\..*/\1/"`
> +    bridge vlan add dev $IF_VLAN_RAW_DEVICE vid $VLANID self
> +  ;;
> +  *)
> +    exit 0
> +  ;;
> +esac
> +
> +if [ -n "$IF_VLAN_RAW_DEVICE" ]; then
> +    if [ ! -x /sbin/vconfig ]; then
> +        exit 0
> +    fi
> +    if ! ip link show dev "$IF_VLAN_RAW_DEVICE" > /dev/null; then
> +        echo "$IF_VLAN_RAW_DEVICE does not exist, unable to create $IFACE"
> +        exit 1
> +    fi
> +    if [ ! -e "/sys/class/net/$IFACE" ]; then
> +        ip link set up dev $IF_VLAN_RAW_DEVICE
> +        vconfig add $IF_VLAN_RAW_DEVICE $VLANID
> +    fi
> +fi
> +
> +# This is not vlan specific, and should actually go somewhere else.
> +if [ -n "$IF_HW_MAC_ADDRESS" ]; then
> +    ip link set $IFACE address $IF_HW_MAC_ADDRESS
> +fi
> -- 
> 2.1.4
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel at pve.proxmox.com
> http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
> 




More information about the pve-devel mailing list