wpasupplicant: Disable D-Bus auto-activation on all calls

Every method call and property access to fi.w1.wpa_supplicant1 used flag
0, leaving D-Bus service activation enabled. Any stray request — a startup
race before `service wpa_supplicant start` takes effect, or a leaked call
while the Ethernet uplink is the chosen path — would make the bus daemon
spawn `wpa_supplicant -u` from its .service file, bypassing repeater's own
launch of the daemon.

Route every interaction through callNoAutoStart/getPropNoAutoStart/
setPropNoAutoStart, which set dbus.FlagNoAutoStart. A leaked call now fails
cleanly with ServiceUnknown instead of resurrecting the daemon, leaving
repeater as the sole launcher.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
nemunaire 2026-07-02 11:44:59 +08:00
commit 11ae69de56
5 changed files with 85 additions and 25 deletions

View file

@ -38,49 +38,49 @@ func (b *BSS) GetProperties() (*BSSProperties, error) {
props := &BSSProperties{}
// Get SSID
if ssidProp, err := b.obj.GetProperty(BSSInterface + ".SSID"); err == nil {
if ssidProp, err := getPropNoAutoStart(b.obj, BSSInterface+".SSID"); err == nil {
if ssid, ok := ssidProp.Value().([]byte); ok {
props.SSID = ssid
}
}
// Get BSSID
if bssidProp, err := b.obj.GetProperty(BSSInterface + ".BSSID"); err == nil {
if bssidProp, err := getPropNoAutoStart(b.obj, BSSInterface+".BSSID"); err == nil {
if bssid, ok := bssidProp.Value().([]byte); ok {
props.BSSID = bssid
}
}
// Get Signal
if signalProp, err := b.obj.GetProperty(BSSInterface + ".Signal"); err == nil {
if signalProp, err := getPropNoAutoStart(b.obj, BSSInterface+".Signal"); err == nil {
if signal, ok := signalProp.Value().(int16); ok {
props.Signal = signal
}
}
// Get Frequency
if freqProp, err := b.obj.GetProperty(BSSInterface + ".Frequency"); err == nil {
if freqProp, err := getPropNoAutoStart(b.obj, BSSInterface+".Frequency"); err == nil {
if freq, ok := freqProp.Value().(uint16); ok {
props.Frequency = uint32(freq)
}
}
// Get Privacy
if privacyProp, err := b.obj.GetProperty(BSSInterface + ".Privacy"); err == nil {
if privacyProp, err := getPropNoAutoStart(b.obj, BSSInterface+".Privacy"); err == nil {
if privacy, ok := privacyProp.Value().(bool); ok {
props.Privacy = privacy
}
}
// Get RSN (WPA2) information
if rsnProp, err := b.obj.GetProperty(BSSInterface + ".RSN"); err == nil {
if rsnProp, err := getPropNoAutoStart(b.obj, BSSInterface+".RSN"); err == nil {
if rsn, ok := rsnProp.Value().(map[string]dbus.Variant); ok {
props.RSN = rsn
}
}
// Get WPA information
if wpaProp, err := b.obj.GetProperty(BSSInterface + ".WPA"); err == nil {
if wpaProp, err := getPropNoAutoStart(b.obj, BSSInterface+".WPA"); err == nil {
if wpa, ok := wpaProp.Value().(map[string]dbus.Variant); ok {
props.WPA = wpa
}
@ -91,7 +91,7 @@ func (b *BSS) GetProperties() (*BSSProperties, error) {
// GetSSIDString returns the SSID as a string
func (b *BSS) GetSSIDString() (string, error) {
prop, err := b.obj.GetProperty(BSSInterface + ".SSID")
prop, err := getPropNoAutoStart(b.obj, BSSInterface+".SSID")
if err != nil {
return "", fmt.Errorf("failed to get SSID property: %v", err)
}
@ -106,7 +106,7 @@ func (b *BSS) GetSSIDString() (string, error) {
// GetBSSIDString returns the BSSID as a formatted MAC address string
func (b *BSS) GetBSSIDString() (string, error) {
prop, err := b.obj.GetProperty(BSSInterface + ".BSSID")
prop, err := getPropNoAutoStart(b.obj, BSSInterface+".BSSID")
if err != nil {
return "", fmt.Errorf("failed to get BSSID property: %v", err)
}
@ -122,7 +122,7 @@ func (b *BSS) GetBSSIDString() (string, error) {
// GetSignal returns the signal strength in dBm
func (b *BSS) GetSignal() (int16, error) {
prop, err := b.obj.GetProperty(BSSInterface + ".Signal")
prop, err := getPropNoAutoStart(b.obj, BSSInterface+".Signal")
if err != nil {
return 0, fmt.Errorf("failed to get Signal property: %v", err)
}