netplan bridge STP bug
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
netplan |
Triaged
|
Medium
|
Unassigned |
Bug Description
# cat /etc/lsb-release | grep LTS
DISTRIB_
#
netplan version: 0.104-0ubuntu2~
I have configured netplan bridge and didn't set anything related to STP option. Doc saying STP is enabled by default and source code also saying default enable [1]
My config snippet:
bridges:
br-mgmt:
dhcp4: no
dhcp6: no
interfaces: [ eno49.51 ]
addresses: [ 10.74.1.12/23 ]
gateway4: 10.74.0.1
nameservers:
addresses: [ 10.30.0.8, 10.30.0.10 ]
search: [ foo.com, bar.com ]
When i check STP status using brctl show command its saying STP is off. That means netplan not setting STP on bridges and seems like a bug.
# brctl show br-mgmt
bridge name bridge id STP enabled interfaces
br-mgmt 8000.38eaa7327d40 no eno49.51
[1] https:/
Official doc: https:/
Changed in netplan: | |
status: | New → Triaged |
importance: | Undecided → Medium |
Hi, thanks for your bug report.
I can confirm the issue still exists on netplan.io 0.106.
The problem happens when the bridge "parameters" section is omitted. When this field is not defined, the handler responsible for initializing the related data structures in the netplan parser is never called and the backend configuration is never generated.
To fix this we need to initialize the bridge parameters [0] regardless the existence of the field "parameters" in the YAML file.
Here is a simpler reproducer:
$ cat etc/netplan/ 90-configs. yaml
network:
bridges:
br-mgmt: {}
$ netplan generate --root-dir /tmp/fakeroot/
$ cat run/systemd/ network/ 10-netplan- br-mgmt. netdev
[NetDev]
Name=br-mgmt
Kind=bridge
Defining an empty "parameters" section is enough to make the parser emit the configuration correctly.
$ cat etc/netplan/ 90-configs. yaml
network:
bridges:
br-mgmt:
parameters: {}
$ netplan generate --root-dir /tmp/fakeroot/
$ cat run/systemd/ network/ 10-netplan- br-mgmt. netdev
[NetDev]
Name=br-mgmt
Kind=bridge
[Bridge]
STP=true
[0] - https:/ /github. com/canonical/ netplan/ blob/main/ src/parse. c#L1891