CumulusNetworks / ifupdown2

GNU General Public License v2.0
161 stars 75 forks source link

Feature Request: `bridge-ports` should be allowed to be empty (or even non-existent maybe?) if `bridge-always-up` is on #297

Open greyltc opened 6 months ago

greyltc commented 6 months ago

for example, it would be neat if a config like this worked:

auto vmbr0
iface vmbr0 inet static
        address 192.168.1.2/24
        gateway 192.168.1.1
        bridge-ports
        bridge-always-up on
        bridge-stp off
        bridge-fd 0

the bridge-always-up on directive should create a dummy interface and add it to the bridge (even when there are no other ports bridged)

julienfortin commented 6 months ago

@greyltc bridge-ports none should work in your case

greyltc commented 6 months ago

thanks @julienfortin! I think I tried a similar thing with bridge-ports null

anyway, do you think

2024-04-17 19:25:20,713: MainThread: ifupdown.bridge: bridge.py:2784:up_bridge(): warning: vmbr0: apply bridge ports settings: 'NoneType' object has no attribute 'append'

in the below debug log is anything to worry about?

2024-04-17 19:25:20,700: MainThread: ifupdown2.NetlinkListenerWithCache: nlcache.py:2882:link_add_bridge(): info: vmbr0: netlink: ip link add dev vmbr0 type bridge
2024-04-17 19:25:20,703: MainThread: ifupdown.bridge: bridge.py:1555:up_apply_bridge_settings(): info: vmbr0: applying bridge settings
2024-04-17 19:25:20,703: MainThread: ifupdown.bridge: bridge.py:1547:fill_ifla_info_data_with_ifla_br_attribute(): info: vmbr0: set bridge-fd 0
2024-04-17 19:25:20,703: MainThread: ifupdown.bridge: bridge.py:1547:fill_ifla_info_data_with_ifla_br_attribute(): info: vmbr0: set bridge-mcsnoop yes
2024-04-17 19:25:20,703: MainThread: ifupdown.bridge: modulebase.py:317:read_file_oneline(): info: reading '/sys/class/net/vmbr0/bridge/stp_state'
2024-04-17 19:25:20,703: MainThread: ifupdown2.NetlinkListenerWithCache: nlcache.py:2906:link_set_bridge_info_data(): info: vmbr0: netlink: ip link set dev vmbr0 type bridge (with attributes)
2024-04-17 19:25:20,703: MainThread: ifupdown2.NetlinkListenerWithCache: nlcache.py:2910:link_set_bridge_info_data(): debug: attributes: {1: 0, 23: True}
2024-04-17 19:25:20,704: MainThread: ifupdown.bridge: bridge.py:1342:bridge_always_up(): info: vmbr0: bridge-always-up yes: enslaving dummy port: brport-if2
2024-04-17 19:25:20,704: MainThread: ifupdown2.NetlinkListenerWithCache: nlcache.py:2546:link_add_with_attributes(): info: brport-if2: netlink: ip link add dev brport-if2 type dummy
2024-04-17 19:25:20,713: MainThread: ifupdown2.NetlinkListenerWithCache: nlcache.py:2610:link_up_force(): info: brport-if2: netlink: ip link set dev brport-if2 up
2024-04-17 19:25:20,713: MainThread: ifupdown.bridge: bridge.py:2784:up_bridge(): warning: vmbr0: apply bridge ports settings: 'NoneType' object has no attribute 'append'
2024-04-17 19:25:20,714: MainThread: ifupdown: scheduler.py:105:run_iface_op(): debug: vmbr0: pre-up : running module bridgevlan
2024-04-17 19:25:20,714: MainThread: ifupdown: scheduler.py:105:run_iface_op(): debug: vmbr0: pre-up : running module tunnel
2024-04-17 19:25:20,715: MainThread: ifupdown: scheduler.py:105:run_iface_op(): debug: vmbr0: pre-up : running module vrf
2024-04-17 19:25:20,715: MainThread: ifupdown: scheduler.py:105:run_iface_op(): debug: vmbr0: pre-up : running module ethtool
2024-04-17 19:25:20,715: MainThread: ifupdown: scheduler.py:105:run_iface_op(): debug: vmbr0: pre-up : running module auto
2024-04-17 19:25:20,715: MainThread: ifupdown: scheduler.py:105:run_iface_op(): debug: vmbr0: pre-up : running module address

brport-if2 gets created but doesn't make it into the bridge

$ ip -d link show brport-if2
4: brport-if2: <BROADCAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/ether ba:dc:0f:fe:e0:dd brd ff:ff:ff:ff:ff:ff promiscuity 0  allmulti 0 minmtu 0 maxmtu 0 
    dummy addrgenmode eui64 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535 tso_max_size 65536 tso_max_segs 65535 gro_max_size 65536
$ brctl show | grep 'brport-if2'
# crickets chirping
julienfortin commented 6 months ago

Maybe bridge-ports none doesn't work anymore Have you tried adding a dummy interface a bridge ports instead?

greyltc commented 6 months ago

Have you tried adding a dummy interface a bridge ports instead?

Yes. Isn't that what the bridge-always-up on directive is meant to do?

greyltc commented 6 months ago

I've made an untested pull request in #298 which I hope will solve the 'NoneType' object has no attribute 'append' we've seen here