Package: bridge-utils
Version: 1.5-13+deb9u1

/etc/network/if-pre-up.d/bridge can fail to properly create vlan bridge
ports

/lib/bridge-utils/bridge-utils.sh has a create_vlan_port function that
tests if the vlan interface already exists
If it does not, it creates it, if it does exist it does nothing.

The problem is that it check to see if the interface exists with:
grep -q "$port:" /proc/net/dev

port is the interface name like "eth0.99"
but the period in a VLAN name is actually treated as a regex so if you have
a
br-eth0-99 interface or eth0199 then it thinks eth0.99 is already up and
fails to create it because those names match the "eth0.99" regex

And improvement would just be
grep -q -F "$port"

That could still fail for br-eth0.99

or even something that looks for the beginning of the line (and whitespace)
grep -q -F "^\s*$port"

I haven't tried, there may be a simpler more reliable solution like:
if ip address show dev $port >/dev/null 2>&1 ...

Reply via email to