Re: ip configuration over dbus



On Thu, 2016-03-17 at 17:02 +0200, matti kaasinen wrote:
Hi!

I try to configure IP settings over dbus. It seems that this is not
possible over org.freedesktop.NetworkManager.IP4Config. I noticed
that IP4
configuration functions are found from libnm-util/nm-setting-ip4-
config.c.
From there it seems that these are private settings. I did not find
"private"  interface from MM-dbus. However, I tried following example
I
found (
https://github.com/lcp/NetworkManager/blob/master/examples/python/upd
ate-secrets.py)
in order to get more choices for configuration, but only thing I got
was
src/settings/nm-settings-connection.c.831 - Internal error; secrets
cache
invalid. So this does not look like correct approach. So private was
no
same as secret.

Before NM 1.2, the way to change IP settings on a device is to first
update the stored configuration with your new details, and then ask NM
to reconfigure the interface with your updated stored connection.  In
more detail:

1) read the connection object
2) read the connection's secrets and merge them into the connection
object (or if you have them already, just merge them)
3) change the IP settings to whatever you want
4) send the full package back to NetworkManager with
Settings.Connection.Update()
5) request re-activation of the connection with
Manager.ActivateConnection()

this is what you see in the Python examples gi/update-ip4-method.py and
dbus/update-ip4-method.py.

With NM 1.2 and later, you can change some details (like IP settings)
on-the-fly without a full reactivation using the Device.Reapply()
method, and this does not require updating the stored configuration.
 However, since it doesn't require updating the stored connection,
these changes will be lost when the device is deactivated, so to
preserve these changes you must update the stored connection too.

Dan

No I would appreciate good advices if anyone knew if it is possible
at all
to browse/change ipv4 settings (
https://developer.gnome.org/NetworkManager/unstable/ref-settings.html
),
like ipv4 method (manual/auto) by using dbus interface?
If so, could anyone provide pointer to example code if such exists?

Thanks,
Matti
_______________________________________________
networkmanager-list mailing list
networkmanager-list gnome org
https://mail.gnome.org/mailman/listinfo/networkmanager-list


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