Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type handling issue when using gonetworkmanager #400

Open
rdecarreau opened this issue Dec 13, 2024 · 0 comments
Open

Type handling issue when using gonetworkmanager #400

rdecarreau opened this issue Dec 13, 2024 · 0 comments

Comments

@rdecarreau
Copy link

I am using NetworkManager 1.46 on BalenaOS.
I am using the gonetworkmanager library which in-turn uses godbus to communicate to NetworkManager from my application.

I attempt this to manually set priority (hopefully to force NetworkManager to change to a network interface of my choosing).

	// Get the connection
	connection, err := activeConnection.GetPropertyConnection()
	if err != nil {
		return errors.Join(
			fmt.Errorf("error getting connection for interface %s", interfaceName),
			err,
		)
	}

	existingSettings, err := connection.GetSettings()
	if err != nil {
		return errors.Join(
			fmt.Errorf("error getting existing settings for interface %s", interfaceName),
			err,
		)
	}

	existingSettings["connection"] = map[string]interface{}{
		"autoconnect-priority": priority,
	}

	// Try UpdateUnsaved first for better error handling
	err = connection.UpdateUnsaved(existingSettings)
	if err != nil {
		return errors.Join(
			fmt.Errorf("error updating priority for interface %s", interfaceName),
			err,
		)
	}

Upon saving the connection I get an error:

"Failed to update network priorities","error":"failed to set WiFi priority: error updating priority for interface wlan0\nipv6.addresses: can't set property of type 'a(ayuay)' from value of type 'aav'"}

No amount of formatting of values and types seems to make it happy enough to accept my settings, even though I just read them from GetSettings.

See issue Wifx/gonetworkmanager#13 for similar other problems, I could not find a follow-up here.

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

No branches or pull requests

1 participant