I created a virtual guest with extra interfaces to use for testing, all connected to a single host bridge, which are named ens7-12 in the guest. I added e/n/i configuration to test both for the original problem for this bug (vlan on bond loses gateway) as well as the bug introduced by the first patch (vlan without raw device ifupdown config fails), with this configuration:
Notes:
'ens7.100' does not have any corresponding 'ens7' configuration.
'bond0' requires the 'bond-mode' option to trigger this bug, as it takes down the interface while changing the mode; the other options that take down the interface are 'xmit_hash_policy', 'ad_select', and 'lacp_rate'.
Without the modification from comment 8, I could not reproduce the bug (as expected since it's a race condition), but with that modification I could reproduce the bug with vlan version:
$ dpkg -l | grep vlan
ii vlan 1.9-3.2ubuntu2
The bond0.200 gateway is missing:
$ ip r
default via 192.168.122.1 dev ens3
default via 1.2.3.1 dev ens7.100 metric 1000 onlink
default via 4.5.6.1 dev bond0 metric 2000 onlink
1.2.3.0/24 dev ens7.100 proto kernel scope link src 1.2.3.5
4.5.6.0/24 dev bond0 proto kernel scope link src 4.5.6.8
9.8.7.0/24 dev bond0.200 proto kernel scope link src 9.8.7.7
192.168.122.0/24 dev ens3 proto kernel scope link src 192.168.122.160
After upgrading to vlan version:
$ dpkg -l | grep vlan
ii vlan 1.9-3.2ubuntu4
The bond0.200 gateway is present:
$ ip r
default via 192.168.122.1 dev ens3
default via 1.2.3.1 dev ens7.100 metric 1000 onlink
default via 4.5.6.1 dev bond0 metric 2000 onlink
default via 9.8.7.1 dev bond0.200 metric 3000 onlink
1.2.3.0/24 dev ens7.100 proto kernel scope link src 1.2.3.5
4.5.6.0/24 dev bond0 proto kernel scope link src 4.5.6.8
9.8.7.0/24 dev bond0.200 proto kernel scope link src 9.8.7.7
192.168.122.0/24 dev ens3 proto kernel scope link src 192.168.122.160
Additionally, the ens7.100 vlan is correctly configured, even without any ens7 raw device ifupdown config.
Testing on artful:
I created a virtual guest with extra interfaces to use for testing, all connected to a single host bridge, which are named ens7-12 in the guest. I added e/n/i configuration to test both for the original problem for this bug (vlan on bond loses gateway) as well as the bug introduced by the first patch (vlan without raw device ifupdown config fails), with this configuration:
auto ens7.100
iface ens7.100 inet static
address 1.2.3.5/24
gateway 1.2.3.1
metric 1000
vlan-raw-device ens7
auto ens8
iface ens8 inet manual
bond-master bond0
auto ens9
iface ens9 inet manual
bond-master bond0
auto bond0
iface bond0 inet static
address 4.5.6.8/24
gateway 4.5.6.1
metric 2000
bond-slaves none
bond-mode balance-alb
auto bond0.200
iface bond0.200 inet static
address 9.8.7.7/24
gateway 9.8.7.1
metric 3000
vlan-raw-device bond0
Notes:
'ens7.100' does not have any corresponding 'ens7' configuration.
'bond0' requires the 'bond-mode' option to trigger this bug, as it takes down the interface while changing the mode; the other options that take down the interface are 'xmit_hash_policy', 'ad_select', and 'lacp_rate'.
Without the modification from comment 8, I could not reproduce the bug (as expected since it's a race condition), but with that modification I could reproduce the bug with vlan version:
$ dpkg -l | grep vlan
ii vlan 1.9-3.2ubuntu2
The bond0.200 gateway is missing:
$ ip r
default via 192.168.122.1 dev ens3
default via 1.2.3.1 dev ens7.100 metric 1000 onlink
default via 4.5.6.1 dev bond0 metric 2000 onlink
1.2.3.0/24 dev ens7.100 proto kernel scope link src 1.2.3.5
4.5.6.0/24 dev bond0 proto kernel scope link src 4.5.6.8
9.8.7.0/24 dev bond0.200 proto kernel scope link src 9.8.7.7
192.168.122.0/24 dev ens3 proto kernel scope link src 192.168.122.160
After upgrading to vlan version:
$ dpkg -l | grep vlan
ii vlan 1.9-3.2ubuntu4
The bond0.200 gateway is present:
$ ip r
default via 192.168.122.1 dev ens3
default via 1.2.3.1 dev ens7.100 metric 1000 onlink
default via 4.5.6.1 dev bond0 metric 2000 onlink
default via 9.8.7.1 dev bond0.200 metric 3000 onlink
1.2.3.0/24 dev ens7.100 proto kernel scope link src 1.2.3.5
4.5.6.0/24 dev bond0 proto kernel scope link src 4.5.6.8
9.8.7.0/24 dev bond0.200 proto kernel scope link src 9.8.7.7
192.168.122.0/24 dev ens3 proto kernel scope link src 192.168.122.160
Additionally, the ens7.100 vlan is correctly configured, even without any ens7 raw device ifupdown config.