Robust interface detection — retry fallback chain for headless boot (#206)

Fixes interface auto-detection failures on Pi Zero 2W where wlan0 doesn't exist
at boot. Implementation:

- Added detect_interface_with_retry() function with 3x retry fallback chain
- Config-supplied interface preferred, then /proc/net/route, then UP interface
- Exponential backoff: 5s, 10s, 20s delays between retries
- Filters excluded prefixes: lo, tailscale*, wg*, tun*, docker*, veth*, br-*
- Used in Engine.__init__(), PacketCapture.start(), MacManager.start()
- Full test coverage: 10 tests for detection, backoff, filtering

Addresses issue where network stack initializes after boot and interfaces
become available after 5-10 second delay.
This commit is contained in:
Cobra
2026-04-08 20:58:43 -04:00
parent 6f421511de
commit 245731e73b
6 changed files with 235 additions and 8 deletions
+1
View File
@@ -3,6 +3,7 @@ from utils.networking import (
get_primary_interface, get_bridge_candidates, get_wifi_interfaces,
get_mac, set_mac, get_ip, compile_bpf, send_gratuitous_arp,
interface_up, interface_down, create_vlan_interface,
detect_interface_with_retry,
)
from utils.logging import BBLogger
from utils.stealth import (