Commit graph

15310 commits

Author SHA1 Message Date
Thomas Haller
dcc8de16b2 core: add utils for file handling
Copied and adjusted from systemd code.
2016-06-30 08:29:54 +02:00
Thomas Haller
dab657043c ifcfg-rh: explicitly clear HWADDR setting and others in write_wired_for_virtual()
When modifying an existing ifcfg-rh file, we always want to enforce
the absense of a certain setting. That is done, by calling svSetValue()
with a value of NULL.

Same for writing MTU value.
2016-06-30 08:29:54 +02:00
Thomas Haller
c7b7305b59 core/utils: convert MAC address in nm_match_spec_hwaddr() from string once 2016-06-30 08:29:54 +02:00
Thomas Haller
fc527a237c libnm: add internal util function _nm_utils_hwaddr_length() 2016-06-30 08:29:54 +02:00
Thomas Haller
05ecb28436 core: make global variable _nm_utils_testing static 2016-06-30 08:29:54 +02:00
Thomas Haller
807f846610 libnm: fix comparing NMSettingIPConfig for address and route properties
When comparing settings, nm_setting_compare() performs a complicated
logic, which basically serializes each GObject property to a GVariant
for the D-Bus representation.
That is wrong for example for ipv4.addresses, which don't contain
address labels. That is, the GObject property is called "addresses",
but the D-Bus field "addresses" cannot encode every information
and thus comparison fails. Instead, it would have to look into
"address-data".

Traditionally, we have virtual functions like compare_property() per
NMSetting to do the comparison. That comparison is based on the GObject
properties. I think that is wrong, because we should have a generic
concept of what a property is, independent from GObject properties.
With libnm, we added NMSettingProperty, which indeed is such an
GObject independent representation to define properties.
However, it is not used thoroughly, instead compare_property() is a hack
of special cases, overloads from NMSettingProperty, overloads of
compare_property(), and default behavior based on GParamSpec.
This should be cleaned up.

For now, just hack it by handle the properties with the problems
explicitly.
2016-06-30 08:29:54 +02:00
Thomas Haller
c9ab22f41d wifi: move static lookup-array for is_manf_default_ssid() 2016-06-30 08:29:54 +02:00
Thomas Haller
0a5af391e0 core: prefer connection.stable-id to generate IPv6 stable privacy addresses
The Network_ID for generating RFC 7217 stable privacy IPv6 addresses
is by default the UUID of the connection.

Alternatively, prefer "connection.stable-id" as Network_ID to generate
the stable addresses. This allows to configure a set of connections that
all use the same Network_ID for generating stable addresses.

Note that the stable-id and the UUID do no overlap, that is two
connections
    [connection]
    uuid=uuid1
    stable-id=
and
    [connection]
    uuid=uuid2
    stable-id=uuid1
generate distinct addresses.
2016-06-30 08:29:54 +02:00
Thomas Haller
0df5e9b736 rdisc/trivial: rename @uuid field to @network_id
Next we will optionally use a stable-id instead of the UUID. Rename it.
Also, RFC 7217 calls this argument Network_ID.
2016-06-30 08:29:54 +02:00
Thomas Haller
3f3ea1df21 libnm: add NMSettingConnection:stable-id property
This new property be used as token to generate stable-ids instead
of the connection's UUID.

Later, this will be used by ipv6.addr-gen-mode=stable-privacy,
ethernet.cloned-mac-address=stable, and wifi.cloned-mac-address=stable
setting. Those generate stable addresses based on the connection's
UUID, but allow to use the stable-id instead.

This allows multiple connections to generate the same addresses
-- on the same machine, because in the above cases a machine
dependant key is also hashed.
2016-06-30 08:29:54 +02:00
Thomas Haller
c7cee12189 config: make "ignore-carrier" a per-device configuration option
NetworkManager.conf already contains several per-device settings,
that is, settings that have a device-spec as argument.

   main.ignore-carrier
   main.no-auto-default
   main.assume-ipv6ll-only
   keyfile.unmanged-devices

Optimally, these settings should be moved to the new [device*]
section.

For now, only move main.ignore-carrier there. For the others
it may not make sense to do so:

- main.no-auto-default: is already merged with internal state
  from /var/lib/NetworkManager/no-auto-default.state. While
  NMConfig's write API would be fine to also persist and merge
  the no-auto-default setting, we'd still have to read the old
  file too. Thus, deprecating this setting gets quite cumbersome
  to still handle the old state file.
  Also, it seems a less useful setting to configure in the
  global configuration aside setting main.no-auto-default=*.

- main.assume-ipv6ll-only: one day, I hope that we no longer
  assume connections at all, and this setting becomes entirely
  obsolete.

- keyfile.unmanged-devices: this sets NM_UNMANAGED_USER_SETTINGS,
  which cannot be overruled via D-Bus. For a future device.managed
  setting we want it it to be overwritable via D-Bus by an explicit
  user action. Thus, a device.managed property should have a different
  semantic, this should be more like a device.unmanaged-force setting,
  which could be done.
2016-06-30 08:27:17 +02:00
Thomas Haller
3cda2df12b config: add support for per-device configuration to NetworkManager.conf
Add a new [device*] section to NetworkManager.conf. This works similar
like the default connection settings in [connection*].

This will allow us to express per-device configuration in NetworkManager.conf
in our familar style.

Later, via NMConfig's write API it will be possible to make settings
accessible via D-Bus and persist them in NetworkManager-intern.conf.
This way, the user can both edit configuration snippets and modify
them via D-Bus, and also support installing default configuration
from the package.

In a way, a [device*] setting is similar to networkd's link files.
The match options is all encoded in the match-device specs.
One difference is, that the resulting setting can be merged together
by multiple section by partially overwriting them. This makes it
more flexible and allows for example to drop a configuration snippet
that only sets one property, while the rest can be merged from different
snippets.
2016-06-30 08:07:35 +02:00
Lubomir Rintel
6a71f13717 merge: branch 'lr/completion'
https://bugzilla.gnome.org/show_bug.cgi?id=768089
2016-06-29 20:50:21 +02:00
Lubomir Rintel
9dafcc8b26 cli/device: allow completion of the "wifi" command name
That's the "wifi" string itself. The subcommands need some work.
2016-06-29 20:49:34 +02:00
Lubomir Rintel
b8bc57c9d3 cli/device: add "lldp list" subcommand completion 2016-06-29 20:49:34 +02:00
Lubomir Rintel
08969b1789 cli: make subcommand dispatch do autocompletion 2016-06-29 20:49:34 +02:00
Lubomir Rintel
1e582f0172 cli: add boolean value completion helper 2016-06-29 20:49:34 +02:00
Lubomir Rintel
e2fe0eeb18 cli: add arbitrary string list completion helper 2016-06-29 20:49:34 +02:00
Lubomir Rintel
39f6d5a5ba cli/device: make "lldp list" subcommand use get_device() 2016-06-29 20:44:05 +02:00
Lubomir Rintel
95a13ef100 cli/device: make "set" subcommand use get_devices() 2016-06-29 20:39:09 +02:00
Lubomir Rintel
78c4038d8c cli/device: convert lldp subcommand to nmc_do_cmd() 2016-06-29 20:32:31 +02:00
Lubomir Rintel
05108ca975 cli/device: convert wifi subcommand to nmc_do_cmd() 2016-06-29 20:32:31 +02:00
Lubomir Rintel
46806d403c merge: branch 'lr/device-modify'
https://bugzilla.gnome.org/show_bug.cgi?id=767999
2016-06-29 20:28:59 +02:00
Lubomir Rintel
8b4494598d cli/device: add modify command
It modifies the applied connection using the Reapply API.
2016-06-29 20:28:42 +02:00
Lubomir Rintel
a0bb8cd6cb cli/connection: export read_connection_properties()
It makes sense to modify the applied connection from the device object.
2016-06-29 20:28:42 +02:00
Lubomir Rintel
c054b871f7 cli/device: add device name completion
Useful with connect, disconnect, delete, monitor, show and reapply.
2016-06-29 20:28:42 +02:00
Lubomir Rintel
59bc820e66 cli/device: split get_device()
Parsing a single device name from the command line is generally
useful. Remove the open coded versions in reapply, connect & status.
2016-06-29 20:28:42 +02:00
Lubomir Rintel
55d349bc34 cli/trivial: rename device_list() to get_device_list()
It will look nicer when we have get_device().
2016-06-29 20:28:42 +02:00
Lubomir Rintel
5182ab3d5d cli/device: use nmc_do_cmd() 2016-06-29 20:28:42 +02:00
Lubomir Rintel
1a88eac02a cli: split out do_cmd() 2016-06-29 20:28:42 +02:00
Lubomir Rintel
a30224f6af cli: use should_wait consistently
It's a semaphore, not a boolean.
2016-06-29 20:28:42 +02:00
Lubomir Rintel
ef8d696252 cli: move the final completion check after the main loop exit
For "nmcli d modify" we'll need to do the completion from async
handlers. This seems to be the most reasonable place to ignore the
errors.
2016-06-29 20:28:42 +02:00
Lubomir Rintel
56804f4a3f cli/trivial: rename some functions for consistency
Some functions that take device lists use plural form in name.
2016-06-29 20:28:42 +02:00
Lubomir Rintel
86ffc08775 cli/connections: only do completion for the last argument
Completing the property when we stop parsing due to error is not the
right thing to do.
2016-06-29 20:28:42 +02:00
Thomas Haller
88c3050000 wwan/ofono: merge branch 'th/review/ofono'
https://mail.gnome.org/archives/networkmanager-list/2016-June/msg00085.html
https://mail.gnome.org/archives/networkmanager-list/2016-June/msg00089.html
2016-06-28 18:22:24 +02:00
Beniamino Galvani
2b958dce91 wwan/ofono: fix indentation 2016-06-28 17:34:42 +02:00
Dan Williams
7d89b862f4 wwan/ofono: remove unused code 2016-06-28 17:34:42 +02:00
Dan Williams
0c9527d9b8 wwan/ofono: fix comment about IP4Config refcounting 2016-06-28 17:34:42 +02:00
Dan Williams
602c3f6ed3 wwan/ofono: clean up and standardize logging 2016-06-28 17:34:42 +02:00
Dan Williams
3ef9b6aa41 build: show ofono enablement status in configure summary 2016-06-28 17:34:42 +02:00
Dan Williams
938b27a8d2 wwan/ofono: simplify capabilities function and add FIXME about LTE 2016-06-28 17:34:42 +02:00
Dan Williams
b898b0882b wwan/ofono: whitespace fixup 2016-06-28 17:34:42 +02:00
Dan Williams
3c054e21ba wwan/ofono: remove some unused types 2016-06-28 17:34:42 +02:00
Dan Williams
87aa671e6b wwan: no need for NM_MODEM_BROADBAND_MODEM to be public 2016-06-28 17:34:42 +02:00
Dan Williams
219904920f wwan/ofono: clean up g_clear_object() usage 2016-06-28 17:34:42 +02:00
Dan Williams
58ab8c9316 wwan/ofono: use g_dbus_proxy_new_for_bus() 2016-06-28 17:34:42 +02:00
Dan Williams
f0af7a0d05 wwan: rework ModemManager/ofono initialization
Avoids the following error when ofono isn't running:

NetworkManager[25133]: <info>  [1466186144.1392] ofono is now available
NetworkManager[25133]: <warn>  [1466186144.1637] failed to enumerate oFono devices: Cannot invoke method; proxy is for a well-known name without an owner and proxy was constructed with the G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START flag

because the code assumes that if the GDBusProxy is created, that
oFono is available.  That's not the case with DO_NOT_AUTO_START
because it creates the proxy anyway, and lets the caller listen
for name-owner-changed signals instead.  The GDBusProxy also
doesn't need to be cleared, since it will follow name-owner
changes and emit g-name-owner changes when oFono starts/stops.

This also fixes the oFono name-owner-changed watch.  It was presumably
using the signal name copied from the ModemManager 'notify::name-owner'
code, but that's a GDBusObjectManagerClient.  The oFono code is using
a GDBusProxy for which the signal is 'notify::g-name-owner'.

Finally, the oFono code shouldn't really be piggy-backing on the
ModemManager autolaunch code, it's just cleaner to keep the two
code paths separate and initialize oFono in parallel.
2016-06-28 17:34:42 +02:00
Dan Williams
019b34af62 wwan/ofono: whitespace fixup 2016-06-28 17:34:42 +02:00
Dan Williams
8a827b1b4f wwan/ofono: fix a few more memory leaks 2016-06-28 17:34:42 +02:00
Dan Williams
425ae4fbd2 wwan: remove some dbus-glib left-overs 2016-06-28 17:34:42 +02:00