RE: Change IP address with libnm



Hi Thomas.

Thank you for your help. I am new using this library so, your help is much appreciated.
That's really what I was looking for because, right now, I am simply calling system("nmcli con mod Wired\ 
connection\ 1 ...") in my test application to modify settings and I wanted to replace that part.
I will keep you informed.

Thanks again,
António Pontinha Mendes
________________________________________
From: Thomas Haller <thaller redhat com>
Sent: 25 February 2020 17:34
To: António Mendes; networkmanager-list gnome org
Subject: Re: Change IP address with libnm

On Tue, 2020-02-25 at 17:02 +0000, António Mendes wrote:
Hi.
I tried to use the example add-connection-libnm-glib.c and adapt to
my case but without success...
I wanted to change an IP address from a connection already created
and add some 802.1X configurations.

Hi,

add-connection adds a new profile.
Basically, what `nmcli connection add ...` does.

The example you refer to is about usage of libnm. So, the corresponding
API is nm_remote_connection_update2() ([1]). This maps to the D-Bus
call Update2 ([2]). This is what `nmcli connection modify ...` does.

[1] https://developer.gnome.org/libnm/1.22/NMRemoteConnection.html#nm-remote-connection-update2
[2] 
https://developer.gnome.org/NetworkManager/1.22/gdbus-org.freedesktop.NetworkManager.Settings.Connection.html#gdbus-method-org-freedesktop-NetworkManager-Settings-Connection.Update2


As always, connection profiles in NetworkManager are really just a bunch of nested
dictionaries, that is the plain settings. There is no further logic involved, just
create a suitable profile. If you use libnm, you probably create the profile using the
NMConnection and NMSetting types. These represent the nested dictionaries.

After you modify a profile, you usually need to activate it so that your actual networking
configuration (`nmcli device`, `ip link`) changes.



best,
Thomas
www.eid.pt

EID, S.A.
Capital Social €1.100.000
N° de matricula unico 501 400 699

DISCLAIMER



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]