kernelkit / infix

Linux :yellow_heart: NETCONF = Infix
https://kernelkit.org
GNU General Public License v2.0
52 stars 12 forks source link

Change bridge port membership from untagged to tagged drops bridge port #676

Closed troglobit closed 1 month ago

troglobit commented 1 month ago

Current Behavior

Changing a bridge port's tagged/untagged VLAN membership at runtime can cause the bridge port to be lost altogether ... until reboot.

admin@example:/config/> set interface br1 bridge vlans vlan 1 untagged e1.6
admin@example:/config/> no interface br1 bridge vlans vlan 1 tagged e1.6
admin@example:/config/> leave
admin@example:/> exit
admin@example:~$ bridge vlan
port              vlan-id  
e8                1 Egress Untagged
e9                1 Egress Untagged
veth0b.6          1 PVID Egress Untagged
admin@example:~$ reboot
...
admin@ix-00-00-00:~$ bridge vlan
port              vlan-id  
e8                1 Egress Untagged
e9                1 Egress Untagged
e1.6              1 PVID Egress Untagged
veth0b.6          1 PVID Egress Untagged

Expected Behavior

Obviously for changes to take without having to reboot.

Steps To Reproduce

Starting from a working state, all four ports untagged members of the same VLAN in br1:

admin@ix-00-00-00:/> show interfaces 
INTERFACE       PROTOCOL   STATE       DATA                                     
lo              ethernet   UP          00:00:00:00:00:00                        
                ipv4                   127.0.0.1/8 (static)
                ipv6                   ::1/128 (static)
br0             bridge     DOWN        
                ethernet   DOWN        02:00:00:00:00:00                        
br1             bridge                 
│               ethernet   UP          02:00:00:00:00:00                        
├ e1.6          bridge     FORWARDING  vlan:1u pvid:1                           
├ e8            bridge     FORWARDING  vlan:1u                                  
├ e9            bridge     FORWARDING  vlan:1u                                  
└ veth0b.6      bridge     FORWARDING  vlan:1u pvid:1                           
e1              ethernet   UP          02:00:00:00:00:01                        
                ipv6                   fe80::ff:fe00:1/64 (link-layer)
e1.6            ethernet   UP          02:00:00:00:00:01                        
└ e1            ethernet   UP          02:00:00:00:00:01                        
e2              ethernet   UP          02:00:00:00:00:02                        
                ipv6                   fe80::ff:fe00:2/64 (link-layer)
e3              ethernet   UP          02:00:00:00:00:03                        
                ipv6                   fe80::ff:fe00:3/64 (link-layer)
e4              ethernet   UP          02:00:00:00:00:04                        
                ipv6                   fe80::ff:fe00:4/64 (link-layer)
e5              ethernet   UP          02:00:00:00:00:05                        
                ipv6                   fe80::ff:fe00:5/64 (link-layer)
e6              ethernet   UP          02:00:00:00:00:06                        
                ipv6                   fe80::ff:fe00:6/64 (link-layer)
e7              ethernet   UP          02:00:00:00:00:07                        
                ipv6                   fe80::ff:fe00:7/64 (link-layer)
e10             ethernet   UP          02:00:00:00:00:0a                        
                ipv6                   fe80::ff:fe00:a/64 (link-layer)
veth0a          ethernet   UP          b6:65:f6:cc:4e:81                        
                veth                   peer:veth0b
veth0b          ethernet   UP          0a:7c:64:f0:55:26                        
                veth                   peer:veth0a
veth0b.6        ethernet   UP          0a:7c:64:f0:55:26                        
└ veth0b        ethernet   UP          0a:7c:64:f0:55:26                        
admin@ix-00-00-00:/> 
admin@ix-00-00-00:~$ ip -br l
lo               UP             00:00:00:00:00:00 <LOOPBACK,UP,LOWER_UP> 
e1               UP             02:00:00:00:00:01 <BROADCAST,MULTICAST,UP,LOWER_UP> 
e2               UP             02:00:00:00:00:02 <BROADCAST,MULTICAST,UP,LOWER_UP> 
e3               UP             02:00:00:00:00:03 <BROADCAST,MULTICAST,UP,LOWER_UP> 
e4               UP             02:00:00:00:00:04 <BROADCAST,MULTICAST,UP,LOWER_UP> 
e5               UP             02:00:00:00:00:05 <BROADCAST,MULTICAST,UP,LOWER_UP> 
e6               UP             02:00:00:00:00:06 <BROADCAST,MULTICAST,UP,LOWER_UP> 
e7               UP             02:00:00:00:00:07 <BROADCAST,MULTICAST,UP,LOWER_UP> 
e8               UP             02:00:00:00:00:08 <BROADCAST,MULTICAST,UP,LOWER_UP> 
e9               UP             02:00:00:00:00:09 <BROADCAST,MULTICAST,UP,LOWER_UP> 
e10              UP             02:00:00:00:00:0a <BROADCAST,MULTICAST,UP,LOWER_UP> 
e1.6@e1          UP             02:00:00:00:00:01 <BROADCAST,MULTICAST,UP,LOWER_UP> 
br0              DOWN           02:00:00:00:00:00 <NO-CARRIER,BROADCAST,MULTICAST,UP> 
veth0b@veth0a    UP             0a:7c:64:f0:55:26 <BROADCAST,MULTICAST,UP,LOWER_UP> 
veth0a@veth0b    UP             b6:65:f6:cc:4e:81 <BROADCAST,MULTICAST,UP,LOWER_UP> 
veth0b.6@veth0b  UP             0a:7c:64:f0:55:26 <BROADCAST,MULTICAST,UP,LOWER_UP> 
br1              UP             02:00:00:00:00:00 <BROADCAST,MULTICAST,UP,LOWER_UP> 
admin@ix-00-00-00:~$ bridge link
9: e8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 master br1 state forwarding priority 32 cost 100 
10: e9: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 master br1 state forwarding priority 32 cost 100 
12: e1.6@e1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 master br1 state forwarding priority 32 cost 100 
16: veth0b.6@veth0b: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 master br1 state forwarding priority 32 cost 2 
admin@ix-00-00-00:~$ bridge vlan
port              vlan-id  
e8                1 Egress Untagged
e9                1 Egress Untagged
e1.6              1 PVID Egress Untagged
veth0b.6          1 PVID Egress Untagged
admin@ix-00-00-00:~$ 
admin@ix-00-00-00:~$ 
admin@ix-00-00-00:~$ cli

See the 'help' command for an introduction to the system

admin@ix-00-00-00:/> configure 
admin@ix-00-00-00:/config/> set interface br1 bridge vlans vlan 1 tagged e1.6
admin@ix-00-00-00:/config/> leave
Error: Port is not a member of this bridge or already set as tagged member in the same VLAN. (path "/ietf-interfaces:interfaces/interface[name='br1']/infix-interfaces:bridge/vlans/vlan[vid='1']/untagged[.='e1.6']")
Error: Invalid candidate configuration
admin@ix-00-00-00:/config/> no interface br1 bridge vlans vlan 1 untagged e1.6
admin@ix-00-00-00:/config/> show
lldp {
  enabled true;
}
hardware {
  component USB {
    class usb;
    state {
      admin-state unlocked;
    }
  }
  component USB2 {
    class usb;
    state {
      admin-state unlocked;
    }
  }
}
interfaces {
  interface br0 {
    type bridge;
  }
  interface br1 {
    type bridge;
    bridge {
      vlans {
        vlan 1 {
          untagged e8;
          untagged e9;
          untagged veth0b.6;
          tagged e1.6;
        }
      }
    }
  }
  interface e1 {
    type etherlike;
    ipv6
  }
  interface e1.6 {
admin@ix-00-00-00:/config/> diff
interfaces {
  interface br1 {
    bridge {
      vlans {
        vlan 1 {
-          untagged e1.6;
+          tagged e1.6;
        }
      }
    }
  }
}
admin@ix-00-00-00:/config/> leave
admin@ix-00-00-00:/> 
admin@ix-00-00-00:/> 
admin@ix-00-00-00:/> 
admin@ix-00-00-00:~$ bridge vlan
port              vlan-id  
e8                1 Egress Untagged
e9                1 Egress Untagged
e1.6              1 PVID
veth0b.6          1 PVID Egress Untagged
admin@ix-00-00-00:~$ cli

See the 'help' command for an introduction to the system

admin@ix-00-00-00:/> configure 
admin@ix-00-00-00:/config/> set interface br1 bridge vlans vlan 1 untagged e1.6
admin@ix-00-00-00:/config/> no interface br1 bridge vlans vlan 1 tagged e1.6
admin@ix-00-00-00:/config/> leave
admin@ix-00-00-00:/> show interfaces 
INTERFACE       PROTOCOL   STATE       DATA                                     
lo              ethernet   UP          00:00:00:00:00:00                        
                ipv4                   127.0.0.1/8 (static)
                ipv6                   ::1/128 (static)
br0             bridge     DOWN        
                ethernet   DOWN        02:00:00:00:00:00                        
br1             bridge                 
│               ethernet   UP          02:00:00:00:00:00                        
├ e1.6          bridge     FORWARDING  
├ e8            bridge     FORWARDING  vlan:1u                                  
├ e9            bridge     FORWARDING  vlan:1u                                  
└ veth0b.6      bridge     FORWARDING  vlan:1u pvid:1                           
e1              ethernet   UP          02:00:00:00:00:01                        
                ipv6                   fe80::ff:fe00:1/64 (link-layer)
e1.6            ethernet   UP          02:00:00:00:00:01                        
└ e1            ethernet   UP          02:00:00:00:00:01                        
e2              ethernet   UP          02:00:00:00:00:02                        
                ipv6                   fe80::ff:fe00:2/64 (link-layer)
e3              ethernet   UP          02:00:00:00:00:03                        
                ipv6                   fe80::ff:fe00:3/64 (link-layer)
e4              ethernet   UP          02:00:00:00:00:04                        
                ipv6                   fe80::ff:fe00:4/64 (link-layer)
e5              ethernet   UP          02:00:00:00:00:05                        
                ipv6                   fe80::ff:fe00:5/64 (link-layer)
e6              ethernet   UP          02:00:00:00:00:06                        
                ipv6                   fe80::ff:fe00:6/64 (link-layer)
e7              ethernet   UP          02:00:00:00:00:07                        
                ipv6                   fe80::ff:fe00:7/64 (link-layer)
e10             ethernet   UP          02:00:00:00:00:0a                        
                ipv6                   fe80::ff:fe00:a/64 (link-layer)
veth0a          ethernet   UP          b6:65:f6:cc:4e:81                        
                veth                   peer:veth0b
veth0b          ethernet   UP          0a:7c:64:f0:55:26                        
                veth                   peer:veth0a
veth0b.6        ethernet   UP          0a:7c:64:f0:55:26                        
└ veth0b        ethernet   UP          0a:7c:64:f0:55:26                        
admin@ix-00-00-00:/> 
admin@ix-00-00-00:~$ 
admin@ix-00-00-00:~$ 
admin@ix-00-00-00:~$ bridge vlan
port              vlan-id  
e8                1 Egress Untagged
e9                1 Egress Untagged
veth0b.6          1 PVID Egress Untagged

Additional information

The additional bridge, Ethernet, and VETH interfaces, may or may not have anything to do with this bug. Included in "Steps to Reproduce" only for completeness.