Commit graph

409 commits

Author SHA1 Message Date
Javier Arteaga 54df43ed52 core: introduce NMDeviceWireGuard
For now, the device only exposes partial link status (not including
peers). It cannot create new links.
2018-08-06 08:34:27 +02:00
Thomas Haller 4eeb4b1bdd all: avoid byte ordering issue for IP4Config's Nameservers/WinsServers on D-Bus
Some properties in NetworkManager's D-Bus API are IPv4 addresses
in network byte order (big endian). That is problematic.

It is no problem, when the NetworkManager client runs on the same
host. That is the case with libnm, which does not support to be used
remotely for the time being.

It is a problem for an application that wants to access the D-Bus
interface of NetworkManager remotely. Possibly, such an application
would be implemented in two layers:

 - one layer merely remotes D-Bus, without specific knowledge of
   NetworkManager's API.

 - a higher layer which accesses the remote D-Bus interface of NetworkManager.
   Preferably it does so in an agnostic way, regardless of whether it runs
   locally or remotely.

When using a D-Bus library, all accesses to 32 bit integers are in
native endianness (regardless of how the integer is actually encoded
on the lower layers). Likewise, D-Bus does not support annotating integer
types in non-native endianness. There is no way to annotate an integer
type "u" to be anything but native order.
That means, when remoting D-Bus at some point the endianness must be
corrected.
But by looking at the D-Bus introspection alone, it is not possible
to know which property need correction and which don't. One would need
to understand the meaning of the properties.

That makes it problematic, because the higher layer of the application,
which knows that the "Nameservers" property is supposed to be in network
order, might not easily know, whether it must correct for endianness.

Deprecate IP4Config properties that are only accessible with a particular
endianness, and add new properties that expose the same data in an
agnostic way.

Note that I added "WinsServerData" to be a plain "as", while
"NameserverData" is of type "aa{sv}". There is no particularly strong
reason for these choices, except that I could imagine that it could be
useful to expose additional information in the future about nameservers
(e.g. are they received via DHCP or manual configuration?). On the other
hand, WINS information likely won't get extended in the future.

Also note, libnm was not modified to use the new D-Bus fields. The
endianness issue is no problem for libnm, so there is little reason to
change it (at this point).

https://bugzilla.redhat.com/show_bug.cgi?id=1153559
https://bugzilla.redhat.com/show_bug.cgi?id=1584584
2018-08-01 14:27:20 +02:00
Lubomir Rintel 8d65f636e1 devices/ovs: expose slaves on D-Bus for OVS bridges and ports 2018-07-10 13:12:02 +02:00
Lubomir Rintel 889961f8b6 all/trivial: grammar fix 2018-07-10 13:12:02 +02:00
Lubomir Rintel 56a6c53de0 introspection: add o.fd.NM.Device.Lowpan interface
It's for 6LoWPAN devices. "o.fd.NM.Device.6Lowpan" wouldn't be a valid
interface name -- just skip the leading numeral, that's what kernel also
does on similiar occassions.
2018-06-26 16:21:55 +02:00
Lubomir Rintel 9a92468ac2 introspection: add o.fd.NM.Device.Wpan interface 2018-06-26 16:21:54 +02:00
Lubomir Rintel 07fd0502f6 wifi: expose LastScan as milliseconds not seconds
This doesn't wrap around in 68 years of uptime and is consistent with
o.fd.NM.Checkpoint.Created.
2018-06-15 16:23:30 +02:00
Lubomir Rintel c00e17578f wifi: expose the LastScan property
This is the time when the last Wi-Fi scan finished. It will help clients
decide whether the AP list is fresh enough.
2018-06-13 14:44:06 +02:00
Lubomir Rintel 87f5ff6927 settings-connection: expose Filename property on D-Bus
This allows implementing some convenience features in nmcli -- listing
the backing store for the connection in "nmcli c show", and using the
filename for specifying connection in "nmcli c up/down".

Eventually, paired with ReloadConnections(), this could be used to
implement something similar to what "systemctl edit" does for units
(though we'd need to pick another command name as we aready use
"nmcli c edit" for something different).
2018-06-11 15:06:49 +02:00
Beniamino Galvani aca671fff0 all: replace "it's" with "its" where needed 2018-04-18 14:14:07 +02:00
Thomas Haller acc8244ca2 all: add D-Bus property "Flags" for Settings.Connection interface
The D-Bus interface already has a boolean property "Unsaved".

While that is nicer too look at (in the API), adding a new flag
is very cumbersome, and also has more overhead. For example,
it requires extending the D-Bus API, all the way down to libnm.

Add a flags argument, that will allow to add future boolean
flags easier.
2018-04-16 15:30:07 +02:00
Thomas Haller f67303221b checkpoint: allow resetting the rollback timeout via D-Bus
This allows to adjust the timeout of an existing checkpoint.

The main usecase of checkpoints, is to have a fail-safe when
configuring the network remotely. By allowing to reset the timeout,
the user can perform a series of actions, and keep bumping the
timeout. That way, the entire series is still guarded by the same
checkpoint, but the user can start with short timeout, and
re-adjust the timeout as he goes along.

The libnm API only implements the async form (at least for now).
Sync methods are fundamentally wrong with D-Bus, and it's probably
not needed. Also, follow glib convenction, where the async form
doesn't have the _async name suffix. Also, accept a D-Bus path
as argument, not a NMCheckpoint instance. The libnm API should
not be more restricted than the underlying D-Bus API. It would
be cumbersome to require the user to lookup the NMCheckpoint
instance first, especially since libnm doesn't provide an efficient
or convenient lookup-by-path method. On the other hand, retrieving
the path from a NMCheckpoint instance is always possible.
2018-04-04 14:02:13 +02:00
Thomas Haller 997cce7c90 build: fix glib dependency to require at least 2.40
Fixes: 8a46b25cfa
2018-02-16 13:26:07 +01:00
Beniamino Galvani dd98ada33f ppp: introduce SetIfindex pppd plugin D-Bus method
If IPV6CP terminates before IPCP, pppd enters the RUNNING phase and we
start IP configuration without having an IP interface set, which
triggers assertions.

Instead, add a SetIfindex() D-Bus method that gets called by the
plugin when pppd becomes RUNNING. The method sets the IP ifindex of
the device and starts IP configuration.

https://bugzilla.redhat.com/show_bug.cgi?id=1515829
2018-01-10 15:36:29 +01:00
Iñigo Martínez 5e16bcf268 meson: Improve dependency system
Some targets are missing dependencies on some generated sources in
the meson port. These makes the build to fail due to missing source
files on a highly parallelized build.

These dependencies have been resolved by taking advantage of meson's
internal dependencies which can be used to pass source files,
include directories, libraries and compiler flags.

One of such internal dependencies called `core_dep` was already in
use. However, in order to avoid any confusion with another new
internal dependency called `nm_core_dep`, which is used to include
directories and source files from the `libnm-core` directory, the
`core_dep` dependency has been renamed to `nm_dep`.

These changes have allowed minimizing the build details which are
inherited by using those dependencies. The parallelized build has
also been improved.
2018-01-10 12:20:17 +01:00
Beniamino Galvani da4c9e51a0 ip-tunnel: add support for tunnel flags
Implement support for IP tunnel flags. Currently only some IPv6 tunnel
flags are supported. Example:

 # nmcli connection add type ip-tunnel mode ip6ip6 \
   ip-tunnel.flags ip6-ign-encap-limit,ip6-use-orig-tclass \
   ifname abc ip-tunnel.parent ens8 ipv4.method disabled \
   ipv6.method manual ipv6.address ::8888 remote ::42

 # ip -d l
  61: abc@ens8: <NOARP,UP,LOWER_UP> mtu 1460 qdisc noqueue ...
    link/tunnel6 :: brd ::42 promiscuity 0
    ip6tnl ip6ip6 remote ::42 local :: dev ens8 encaplimit none
    hoplimit 0 tclass inherit ...

https://bugzilla.gnome.org/show_bug.cgi?id=791846
2018-01-05 18:25:08 +01:00
Iñigo Martínez 03637ad8b5 build: add initial support for meson build system
meson is a build system focused on speed an ease of use, which
helps speeding up the software development. This patch adds meson
support along autotools.

[thaller@redhat.com: rebased patch and adjusted for iwd support]

https://mail.gnome.org/archives/networkmanager-list/2017-December/msg00022.html
2017-12-13 15:48:50 +01:00
Thomas Haller 35dc6421de settings: support setting a connection as volatile via Update2()
Extend the Update2 flags to allow marking a connection as volatile.
Making a connection as volatile means that the connection stays alive
as long as an active connection references it.

It is correct that Update2() returns before the connection is actually
deleted. It might take an arbitrary long time until the volatile
mechanism cleans up the connection.

Also add two more IN_MEMORY flags: "detached" and "only".

The existing NM_SETTINGS_UPDATE2_FLAG_IN_MEMORY would not detach nor
delete the possible file on disk. That is, the mode only changes what NM
thinks is the current content of the connection profile. It would not delete
the file on disk nor would it detach the profile in-memory from the file.
As such, later persisting the connection again to disk would overwrite
the file, and deleting the profile, would delete the file.

Now add two new IN_MEMORY modes.

NM_SETTINGS_UPDATE2_FLAG_IN_MEMORY_DETACH is like making the connection
in-memory only, but forgetting that there might be any profile on disk.
That means, a later Delete() would not delete the file. Similarly, a
later Update2() that persists the connection again, would not overwrite
the existing file on disk, instead it would choose a new file name.

On the other hand, NM_SETTINGS_UPDATE2_FLAG_IN_MEMORY_ONLY would delete
a potential file from disk right away.

It's clear that "volatile" only makes sense with either "in-memory-detached"
or "in-memory-only". That is, the file on disk should be deleted right away
(before the in-memory part is garbage collected) or the file on disk should
be forgotten.
2017-12-05 20:18:10 +01:00
Thomas Haller 8bb95a8365 settings: add NM_SETTINGS_UPDATE2_FLAG_BLOCK_AUTOCONNECT flag 2017-12-05 19:57:24 +01:00
Thomas Haller 98ee18d888 all: add new D-Bus API org.freedesktop.NetworkManager.Settings.Connection.Update2()
We already have Update(), UpdateUnsaved() and Save(), which serve
similar purposes. We will need a form of update with another argument.

Most notably, to block autoconnect while doing the update.

Other use cases could be to prevent reapplying connection.zone and
connection.metered, to to reapply all changes.

Instead of adding a specific update function that only serves that
new use-case, add a extensible Update2() function. It can be extended
to cope with future variants of update.
2017-12-05 11:50:52 +01:00
Beniamino Galvani dece9f9dda core: export checkpoint list over D-Bus 2017-11-09 10:12:15 +01:00
Lubomir Rintel b5925d693c introspection: add o.fd.NM.Device.OvsBridge interface 2017-10-30 17:40:08 +01:00
Lubomir Rintel 6748c44cb6 introspection: add o.fd.NM.Device.OvsPort interface 2017-10-30 17:40:08 +01:00
Lubomir Rintel b0f3dc0add introspection: add o.fd.NM.Device.OvsInterface interface 2017-10-30 17:40:08 +01:00
Thomas Haller 817a45bfe6 libnm: add NMActivationStateFlags
No flags yet implemented.

https://bugzilla.redhat.com/show_bug.cgi?id=1454883
2017-10-05 11:50:31 +02:00
James Henstridge 4dd30b784c manager: add connectivity-check-{available,enabled} properties.
https://bugzilla.gnome.org/show_bug.cgi?id=785117
2017-08-17 22:31:47 +02:00
Beniamino Galvani df72cad107 device: add NMDevicePPP
The new device type represents a PPP interface, and will implement the
activation of new-style PPPoE connections, i.e. the ones that don't
claim the parent device.
2017-08-05 08:03:15 +02:00
Beniamino Galvani 26928eced4 libnm: add 'hw-address' property to NMDeviceDummy
Dummy devices have a MAC address; expose it in the D-Bus interface.
2017-06-30 22:04:03 +02:00
Beniamino Galvani 2b405c98fb introspection: slightly improve checkpoint documentation
Fix CheckpointCreate() arguments formatting, add link to create flags
and capitalize sentences.
2017-06-26 09:59:35 +02:00
Thomas Haller 0870906540 device: sanitze UTF-8 values for D-Bus
ip link add name $'d\xccf\\c' type dummy

Use nm_utils_str_utf8safe_escape() to sanitize non UTF-8 sequences
before exposing them on D-Bus. The operation can be reverted client
side via nm_utils_str_utf8safe_unescape() or simply g_strcompress().

Note that this preserves all valid UTF-8 sequences as-is, with exception
of the backslash escape character and ASCII control characters. Thus, this
is a change in behavior for strings that contain such characters.

Note that nmcli is not changed to somehow unescape the string before
printing. As the string is not valid UTF-8 (or contains ASCII characters
that need escaping), they are not printable as-is, so unescaping before
printing makes little sense.
2017-05-19 09:46:08 +02:00
Lubomir Rintel d190ca487f vpn-connection: use NMActiveConnectionStateReason 2017-03-17 10:21:19 +01:00
Lubomir Rintel 8b649a8c84 active-connection: emit a StateChanged signal on state changes
It includes a reason code that makes it possible for the clients to be
more reasonable about error messages.

The reason code is essentially copied from the VPN, plus three more
reasons that were useful for non-VPN connections.
2017-03-17 10:21:19 +01:00
Lubomir Rintel f6e9b1d328 introspection: include short description everywhere 2017-03-17 10:15:11 +01:00
Beniamino Galvani b42f780e04 core: add support for dummy devices
Add support for creating dummy devices. This commit adds a D-Bus
interface 'org.freedesktop.NetworkManager.Device.Dummy' which is used
primarily for determining the device type but does not carry any
properties.
2017-02-22 21:05:04 +01:00
Lubomir Rintel 568c4f3e49 dbus: improve the connectivity check and manager state documentation
This hopefully clears up the confusion between Connectivity and State
properties.
2017-02-16 15:44:28 +01:00
Beniamino Galvani 67adbda83e core,libnm: introduce NMDeviceMacsec
At the moment the device only exposes the current link status, but
cannot create new links.
2017-01-16 17:37:14 +01:00
Beniamino Galvani e3c67177ac dns: export current configuration through D-Bus
It is useful to let clients retrieve the current DNS configuration,
which can be displayed to users or used (together with dns=none) to
implement custom DNS configuration logic through external tools.
2016-12-12 22:06:23 +01:00
Beniamino Galvani 14105ece56 dns: export DNS manager D-Bus object
Extend the D-Bus API and introduce a new NMDnsManager interface that
contains all the information related to DNS configuration.

At the moment the new DnsManager object only contains basic properties
describing the current DNS mode and resolv.conf manager.
2016-12-12 21:49:15 +01:00
Lubomir Rintel 972e0d2803 all: rename the introspection data to use the interface paths in names
This makes it easier to install the files with proper names.
Also, it makes the makefile rules slightly simpler.

Lastly, the documentation is now generated into docs/api, which makes it
possible to get rid of the awkward relative file names in docbook.
2016-11-23 15:43:42 +01:00
Thomas Haller 3c2a49df2f build: merge "introspection/Makefile.am" into toplevel Makefile.am 2016-10-19 15:26:30 +02:00
Beniamino Galvani 8b9ea0b7c6 checkpoint: consider all devices when an empty list is passed
First, consider all devices and not only realized and managed ones
when an empty list is passed. Also, move the list evaluation to the
checkpoint manager, since the check for device conflicts is done
there.

Fixes: 3e09aed2a0
2016-09-26 15:10:39 +02:00
Thomas Haller 93a753e311 capabilities: add comment about capability range 2016-09-23 16:09:06 +02:00
Thomas Haller 4a6c07d4e5 capabilities: fix data type to "u" / uint32
The property NM_MANAGER_CAPABILITIES was already "au".
The types must be used consistently.
2016-09-23 15:49:52 +02:00
Marius Vollmer 1bb00ae66a manager: Add "Capabilities" property 2016-09-23 15:49:52 +02:00
Thomas Haller 6fb917178a dbus: deprecated NM specific PropertiesChanged signals
Nowadays, users should use the standard "PropertiesChanged" signal
on "org.freedesktop.DBus.Properties" interface.
2016-09-02 20:13:36 +02:00
Thomas Haller e54b6c2bd5 doc: fix mistake in documenting Reload D-Bus call 2016-09-01 16:53:54 +02:00
Thomas Haller fbbebc2123 device: always expose device statistics information
Instead of updating the device-statistic counters only periodically as
we refresh the link, update them on every link-changed event from
platform.

That means, also for devices that have RefreshRateMs at zero, the values
will be updated at random times when the link information changes.
The difference is, that previously the counters would be zero unless
RefreshRateMs was set. Now, they have some (probably stale) values
which however are not guaranteed to be kept up-to-date.

Also, now we refresh more often then promised by RefreshRateMs. But the API
technically doesn't specify that, so if we find there is a problem with
this, we may revert it later.
2016-08-17 16:08:21 +02:00
Alfonso Sanchez-Beato 24b193ab64 device: add statistics interface
Add statistics interface to all device instances. When active, the
properties of this interface are refreshed whenever there is network
activity for the device.

Activation is performed by changing RefreshRateMs property. If set to
zero, the interface is deactivated. If set to other value, the rest of
the interface properties are refreshed whenever the related network
metric changes, being RefreshRateMs the minimum time between property
changes, in milliseconds.
2016-08-17 15:50:20 +02:00
Beniamino Galvani 3e09aed2a0 checkpoint: add create, rollback and destroy D-Bus API
Co-authored-by: Thomas Haller <thaller@redhat.com>
2016-08-17 14:55:34 +02:00
Thomas Haller 0acee97220 config,dns: support Reload flags to specify that only parts should be reloaded
Support 3 new flags for Reload:

  - 0x01 (CONF): reload the configuration from disk
  - 0x02 (DNS_RC): write DNS configuration to resolv.conf
  - 0x04 (DNS_FULL): restart DNS plugin

Omitting all flags is the same as reloading everything, thus SIGHUP.
2016-06-01 19:06:34 +02:00