Skip to content

Type handling issue when using gonetworkmanager #400

@rdecarreau

Description

@rdecarreau

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    breaking changePR that introduces a breaking change in the library's public API, or a bug requiring such a change

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions