Skip to content

Conversation

@obilodeau
Copy link
Contributor

No description provided.

@obilodeau
Copy link
Contributor Author

completed review

obilodeau added a commit that referenced this pull request Mar 20, 2012
AlliedTelesis support in 802.1X / MAC-Auth
@obilodeau obilodeau merged commit 3e40158 into stable Mar 20, 2012
@obilodeau obilodeau mentioned this pull request Mar 21, 2012
satkunas added a commit that referenced this pull request Nov 22, 2022
satkunas added a commit that referenced this pull request Jan 13, 2023
satkunas added a commit that referenced this pull request Mar 28, 2023
satkunas added a commit that referenced this pull request Jun 6, 2023
satkunas added a commit that referenced this pull request Jun 9, 2023
@fdurand fdurand mentioned this pull request Oct 18, 2025
4 tasks
fdurand pushed a commit that referenced this pull request Nov 5, 2025
Root cause: Async deletion created race condition with recreation events

Flow before (BROKEN):
1. Delete vswitchbr → spawn async goroutine for deletion
2. Recreate vswitchbr → RTM_NEWLINK events arrive IMMEDIATELY
3. Events check intNametoInterface → interface STILL there (deletion goroutine hasn't run)
4. Events skip or race
5. Deletion goroutine finally runs → clears maps
6. More recreation events arrive → multiple process the interface → DUPLICATES

Flow after (FIXED):
1. Delete vswitchbr → handleDeletedInterfaceSync (SYNCHRONOUS)
   - Immediately clears intNametoInterface
   - Immediately clears DHCPConfig.intsNet
   - Immediately clears VIP maps
   - Immediately clears processingInterfaces (debounce reset)
2. Recreate vswitchbr → Multiple RTM_NEWLINK events arrive
3. Event #1: Not in map, take lock, not in debounce, set debounce, process
4. Event #2: Not in map, try lock, WAIT (event #1 holds lock)
5. Event #2: Get lock, check debounce, HIT (event #1 set it), SKIP
6. Event #3+: Same as #2

Key changes:
1. Deletion is now SYNCHRONOUS (handleDeletedInterfaceSync)
   - Called directly from event loop, not via goroutine
   - Ensures deletion completes before any recreation events are processed

2. Clean state after deletion
   - All maps cleared immediately
   - Debounce cleared to allow immediate recreation
   - But synchronous processing ensures only ONE recreation event processes

3. Proper sequencing
   - Delete completes fully → then recreation events are processed
   - No race between deletion and recreation
   - Synchronous processing serializes multiple recreation events

Expected behavior:
- Delete and recreate vswitchbr multiple times
- netstat should show exactly 1 unicast + 1 broadcast listener
- No accumulation of duplicate listeners
- DHCP should work immediately after recreation

Testing:
for i in {1..5}; do
  ip link del vswitchbr 2>/dev/null || true
  ip link add vswitchbr type bridge
  ip addr add 10.255.255.1/24 dev vswitchbr
  ip link set vswitchbr up
  sleep 2
  netstat -nlp | grep "10.255.255.1:67" | wc -l  # Should always be 1
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants