bisdn / basebox

A tiny OpenFlow controller for OF-DPA switches.
Mozilla Public License 2.0
45 stars 9 forks source link

Removing a neighbor from an SVI entry does not remove its L3 group table entry #281

Closed rr-santos closed 1 year ago

rr-santos commented 3 years ago

Expected Behavior

The L3 group entry should be removed after deleting the neighbor entry.

Actual Behavior

The group entry remains listed when running client_grouptable_dump. I suspect this is related to how l3_interface_id mapping keys are manipulated when deleting L3 egress entries, similar to https://github.com/bisdn/basebox/issues/275

Steps to Reproduce the Problem

To configure a switch bridge with a SVI and a neighbor entry:

BRIDGE_NAME=swbridge                                                                                                                                                                                                                                                                                                         

BNG_DP_PORT=port50                                                                                                                                                                                                                                                                                                           
BNG_VID=100                                                                                                                                                                                                                                                                                                                  

BNG_PORT_SVI_NAME="$BRIDGE_NAME.$BNG_VID"                                                                                                                                                                                                                                                                                    
BNG_PORT_SVI_MAC=aa:bb:cc:dd:ee:1a                                                                                                                                                                                                                                                                                           
BNG_PORT_SVI_IP="10.1.1.1/24"                                                                                                                                                                                                                                                                                                
BNG_PORT_SVI_NEXTHOP_IP="10.1.1.2"                                                                                                                                                                                                                                                                                           

BNG_IP_POOL_NET="192.51.0.0/16"                                                                                                                                                                                                                                                                                              
BNG_DOWNSTREAM_MAC=00:00:00:01:00:01                                                                                                                                                                                                                                                                                         

## Add bridge                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
ip link add $BRIDGE_NAME type bridge vlan_filtering 1 vlan_default_pvid 0                                                                                                                                                                                                                                                    

## VLANs that are processed by the bridge                                                                                                                                                                                                                                                                                    
bridge vlan add vid $BNG_VID dev $BRIDGE_NAME self                                                                                                                                                                                                                                                                           

## Add ports to bridge                                                                                                                                                                                                                                                                                                       
ip link set $BNG_DP_PORT master $BRIDGE_NAME # BNG data plane                                                                                                                                                                                                                                                                

## Add VLANs to ports                                                                                                                                                                                                                                                                                                        
# Set PVIDs to BNG and UPLINK ports                                                                                                                                                                                                                                                                                          
bridge vlan add vid $BNG_VID dev $BNG_DP_PORT pvid egress untagged                                                                                                                                                                                                                                                           

## Add SVIs                                                                                                                                                                                                                                                                                                                  
# BNG port                                                                                                                                                                                                                                                                                                                   
ip link add link $BRIDGE_NAME name $BNG_PORT_SVI_NAME type vlan id $BNG_VID                                                                                                                                                                                                                                                  

## Set IP addresses                                                                                                                                                                                                                                                                                                          
# BNG port                                                                                                                                                                                                                                                                                                                   
ip a a $BNG_PORT_SVI_IP dev $BNG_PORT_SVI_NAME                                                                                                                                                                                                                                                                               

## Ports up                                                                                                                                                                                                                                                                                                                  
ip link set $BRIDGE_NAME up                                                                                                                                                                                                                                                                                                  
ip link set $BNG_PORT_SVI_NAME up                                                                                                                                                                                                                                                                                            
ip link set $BNG_DP_PORT up                                                                                                                                                                                                                                                                                                  

# Forwarding entry to BNG_DOWNSTREAM_MAC via the BNG port                                                                                                                                                                                                                                                                    
bridge fdb add $BNG_DOWNSTREAM_MAC dev $BNG_DP_PORT master vlan $BNG_VID                                                                                                                                                                                                                                                    

# Add IP neighbor entry                                                                                                                                                                                                                                                                                                      
ip neighbor add $BNG_PORT_SVI_NEXTHOP_IP lladdr $BNG_DOWNSTREAM_MAC dev $BNG_PORT_SVI_NAME

Deleting the entry afterwards:

ip neighbor del $BNG_PORT_SVI_NEXTHOP_IP lladdr $BNG_DOWNSTREAM_MAC dev $BNG_PORT_SVI_NAME

client_grouptable_dump output still shows the group entry:

groupId = 0x20000001 (L3 Unicast, Index = 1): duration: 27, refCount:0
        bucketIndex = 0: referenceGroupId = 0x00640032 vlanId = 0x1064 (VLAN 100) srcMac: 92:E5:8B:46:2A:A5 dstMac: 00:00:00:01:00:01

Specifications

KanjiMonster commented 1 year ago

Testing with baseboxd 2.0.8, BISDN Linux 5.0.1, this now seems to be working as expected:

accton-as5835-54x:~$ client_grouptable_dump 
groupId = 0x00640036 (L2 Interface, VLAN ID = 100, Port ID = 54): duration: 12, refCount:3
    bucketIndex = 0: outputPort = 54 (Physical) popVlanTag = 1 allowVlanTranslation = 0 
groupId = 0x20000001 (L3 Unicast, Index = 1): duration: 12, refCount:1
    bucketIndex = 0: referenceGroupId = 0x00640036 vlanId = 0x1064 (VLAN 100) srcMac: AE:83:84:68:1A:3D dstMac: 00:00:00:01:00:01 
groupId = 0x40640064 (L2 Flood, VLAN ID = 100, Index = 100): duration: 12, refCount:1
    bucketIndex = 0: referenceGroupId = 0x00640036 
accton-as5835-54x:~$ sudo ip neighbor del 10.1.1.2 lladdr 00:00:00:01:00:01 dev swbridge.100
accton-as5835-54x:~$ client_grouptable_dump 
groupId = 0x00640036 (L2 Interface, VLAN ID = 100, Port ID = 54): duration: 103, refCount:2
    bucketIndex = 0: outputPort = 54 (Physical) popVlanTag = 1 allowVlanTranslation = 0 
groupId = 0x40640064 (L2 Flood, VLAN ID = 100, Index = 100): duration: 103, refCount:1
    bucketIndex = 0: referenceGroupId = 0x00640036