Bug 2081277

Summary: Linux bridge cannot be removed if they routes are marked as absent
Product: Red Hat Enterprise Linux 9 Reporter: Quique Llorente <ellorent>
Component: nmstateAssignee: Gris Ge <fge>
Status: CLOSED ERRATA QA Contact: Mingyu Shi <mshi>
Severity: high Docs Contact:
Priority: unspecified    
Version: 9.1CC: ferferna, jiji, jishi, network-qe, till
Target Milestone: rcKeywords: Triaged
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-11-15 10:00:44 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Quique Llorente 2022-05-03 09:04:45 UTC
Description of problem:
When removing an static ipv4 bridge with its routes it fails to delete it.


Version-Release number of selected component (if applicable): 


How reproducible: Always


Steps to Reproduce:
1. Apply following script
cat <<'EOF' | nmstatectl apply
interfaces: 
  - name: eth1                                                                    
    type: ethernet                                                              
    state: up                                                                   
    ipv4:                                                                       
      address:                                                                  
      - ip: 192.0.2.251                                                                
        prefix-length: 24                                                     
      dhcp: false                                                               
      enabled: true                                                             
routes:                                                                         
    config:                                                                     
    - destination: 198.51.100.0/24                                                         
      metric: 150                                                               
      next-hop-address: 192.0.2.1                                                     
      next-hop-interface: eth1                                                    
      table-id: 254                       
EOF

cat <<'EOF' | nmstatectl apply
interfaces:                                        
  - name: brext                                                                 
    type: linux-bridge                                                          
    state: up                                                                   
    ipv4:                    
      address:                                                                  
      - ip: 192.0.2.251                                                                
        prefix-length: 24                                                     
      dhcp: false                                                               
      enabled: true                                                             
    bridge:                                                                     
      options:                                                                  
        stp:                                                                    
          enabled: false                                                        
      port:                                                                     
      - name: eth1                 
routes:                                                                         
  config:
    - destination: 198.51.100.0/24                                                         
      metric: 150                                                               
      next-hop-address: 192.0.2.1                                                     
      next-hop-interface: brext
      table-id: 254
EOF
cat <<'EOF' | nmstatectl apply
interfaces:
    - ipv4:
        enabled: false
      name: eth1
      state: up
      type: ethernet
    - name: brext
      state: absent
      type: linux-bridge
routes:
      config:
      - next-hop-interface: brext
        state: absent                      
EOF



Actual results:
NmstateError: VerificationError: Absent/Down interface brext/linux-bridge still found as LinuxBridge(LinuxBridgeInterface { base: BaseInterface { name: "brext", description: Some(""), prop_list: ["name", "state", "iface_type", "ipv4", "ipv6", "mac_address", "controller", "mtu", "accept_all_mac_addresses", "ethtool", "ieee8021x", "description", "lldp"], iface_type: LinuxBridge, state: Up, mac_address: Some("F6:7A:5E:DB:DD:46"), permanent_mac_address: None, mtu: Some(1500), ipv4: Some(InterfaceIpv4 { enabled: true, prop_list: ["enabled", "addresses", "dhcp", "dns", "auto_dns", "auto_routes", "auto_gateway", "auto_table_id"], dhcp: Some(false), addresses: Some([InterfaceIpAddr { ip: 192.0.2.251, prefix_length: 24 }]), dns: Some(DnsClientState { server: None, search: Some([]), priority: None }), auto_dns: None, auto_gateway: None, auto_routes: None, auto_table_id: None }), ipv6: Some(InterfaceIpv6 { enabled: false, prop_list: ["enabled", "dhcp", "autoconf", "dns", "auto_dns", "auto_routes", "auto_gateway", "auto_table_id"], dhcp: None, autoconf: None, addresses: None, dns: Some(DnsClientState { server: None, search: Some([]), priority: None }), auto_dns: None, auto_gateway: None, auto_routes: None, auto_table_id: None }), controller: None, accept_all_mac_addresses: Some(false), copy_mac_from: None, ovsdb: None, ieee8021x: None, lldp: Some(LldpConfig { enabled: false, neighbors: [] }), ethtool: Some(EthtoolConfig { pause: None, feature: Some({"tx-tcp6-segmentation": true, "tx-nocache-copy": false, "tx-gre-segmentation": true, "tx-udp_tnl-segmentation": true, "tx-tcp-ecn-segmentation": true, "highdma": true, "tx-vlan-stag-hw-insert": true, "rx-gro-list": false, "tx-tcp-segmentation": true, "tx-vlan-hw-insert": true, "tx-ipxip4-segmentation": true, "tx-ipxip6-segmentation": true, "tx-gso-list": true, "tx-udp-segmentation": true, "tx-sctp-segmentation": true, "rx-udp-gro-forwarding": false, "tx-checksum-ip-generic": true, "tx-tcp-mangleid-segmentation": true, "tx-generic-segmentation": true, "tx-scatter-gather-fraglist": true, "tx-fcoe-segmentation": true, "tx-udp_tnl-csum-segmentation": true, "tx-gso-partial": true, "tx-tunnel-remcsum-segmentation": true, "tx-gre-csum-segmentation": true, "rx-gro": true, "tx-esp-segmentation": true, "tx-gso-robust": true}), coalesce: None, ring: None }), controller_type: None, up_priority: 0, routes: None, rules: None, _other: {} }, bridge: Some(LinuxBridgeConfig { options: Some(LinuxBridgeOptions { gc_timer: Some(29592), group_addr: Some("01:80:C2:00:00:00"), group_forward_mask: Some(0), group_fwd_mask: Some(0), hash_max: Some(4096), hello_timer: Some(177), mac_ageing_time: Some(300), multicast_last_member_count: Some(2), multicast_last_member_interval: Some(100), multicast_membership_interval: Some(26000), multicast_querier: Some(false), multicast_querier_interval: Some(25500), multicast_query_interval: Some(12500), multicast_query_response_interval: Some(1000), multicast_query_use_ifaddr: Some(false), multicast_router: Some(Auto), multicast_snooping: Some(true), multicast_startup_query_count: Some(2), multicast_startup_query_interval: Some(3125), stp: Some(LinuxBridgeStpOptions { enabled: Some(true), forward_delay: Some(15), hello_time: Some(2), max_age: Some(20), priority: Some(32768) }) }), port: Some([]) }) })

Expected results:
brext get deleted

Additional info:
If "absent" routes is removed from last state the "brext" get removed correctly.

Comment 1 Gris Ge 2022-05-30 05:53:44 UTC
Patch posted https://github.com/nmstate/nmstate/pull/1913

Also fixed deleting route rule on absent interface.

Comment 7 errata-xmlrpc 2022-11-15 10:00:44 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (nmstate bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2022:7991