app: Start wpa_supplicant only when Ethernet has no DHCP lease

Probe the configured Ethernet interface (default eth0, overridable via
-ethernet-interface) at startup. If no DHCP-assigned IPv4 is present,
start the wpa_supplicant service so the WiFi backend has something to
talk to; otherwise leave it alone and rely on the wired uplink.
This commit is contained in:
nemunaire 2026-05-01 22:35:07 +08:00
commit d57c08a6c4
4 changed files with 82 additions and 20 deletions

View file

@ -57,6 +57,11 @@ func (a *App) Initialize(cfg *config.Config) error {
// Store config reference
a.Config = cfg
// If Ethernet uplink is not already providing connectivity (no DHCP lease
// on the configured interface), bring up wpa_supplicant so the WiFi
// backend has something to talk to.
ensureUplink(cfg.EthernetInterface)
// Initialize WiFi backend
if err := wifi.Initialize(cfg.WifiInterface, cfg.WifiBackend); err != nil {
return err