Fix for the case for kernels without CONFIG_BRIDGE_VLAN_FILTERING

If the Linux kernel is not built with the parameter
CONFIG_BRIDGE_VLAN_FILTERING, passing vlanFiltering in
the Bridge struct returns an error creating the bridge interface.
This happens even when no parameter is set on Vlan in the CNI config.

This change fixes the case where no Vlan parameter is configured on
CNI config file so the flag doesn't need to be included in the struct.

Signed-off-by: Carlos de Paula <me@carlosedp.com>
This commit is contained in:
Carlos de Paula 2020-01-09 19:21:41 -03:00
parent 62b36d2fbc
commit cc6154603e

View File

@ -224,7 +224,9 @@ func ensureBridge(brName string, mtu int, promiscMode, vlanFiltering bool) (*net
// default packet limit // default packet limit
TxQLen: -1, TxQLen: -1,
}, },
VlanFiltering: &vlanFiltering, }
if vlanFiltering {
br.VlanFiltering = &vlanFiltering
} }
err := netlink.LinkAdd(br) err := netlink.LinkAdd(br)