[pve-devel] [PATCH] add vlan aware ifupdown script v3

Wolfgang Bumiller w.bumiller at proxmox.com
Wed Jul 29 07:53:01 CEST 2015


On Wed, Jul 29, 2015 at 07:36:35AM +0200, Dietmar Maurer wrote:
> Maybe we can simply skip ports with dots?
> 
> diff --git a/bridgevlan b/bridgevlan
> index 2e7612c..bf9cf82 100755
> --- a/bridgevlan
> +++ b/bridgevlan
> @@ -38,16 +38,20 @@ do
>    for port in $i
>    do
>      if [ "$MODE" = "start" ] && [ -d /sys/class/net/$IFACE/brif/$port ]; then
> -      #we allow vlan to pass through attached interface
> -      if [[ $port =~ ^(eth|bond|wlan)[0-9]{1,2}$ ]]
> -      then
> -        if [ -n "$IF_BRIDGE_VIDS" ]
> -       then
> -             bridge vlan add dev $port vid $IF_BRIDGE_VIDS
> -       else
> -             bridge vlan add dev $port vid 2-4094
> -        fi
> -      fi
> +      case "$port" in
> +       *.[0-9]*)
> +           # do nothing ?
> +       ;;
> +       *)
> +          # we allow vlan to pass through attached interface
> +          if [ -n "$IF_BRIDGE_VIDS" ]
> +         then
> +            bridge vlan add dev $port vid $IF_BRIDGE_VIDS
> +         else
> +            bridge vlan add dev $port vid 2-4094
> +          fi
> +       ;;
> +      esac
>      fi
>    done
>  done

Looks mostly fine to me. For =~ you need bash (and no quotes around the
regex). Of course you can always echo+grep ;-) (It would be more correct
than the case above as the * at the end matches non-digits, too, but
only people with weird setups would run into that problem... and other
debian scripts probably choke on it even more.)

(I do see why the cumulus devs would prefer python over Dash... Hell
even bash would be a better fit with respect to quoting, matching, and
the fact that it even does arrays... Of course, we'd all prefer perl
now, wouldn't we ;-) )




More information about the pve-devel mailing list