Commit Graph

21088 Commits

Author SHA1 Message Date
Thomas Haller
1e3b2cbb77 sleep-monitor: make sleep-monitor not a singleton
The only user of the sleep-monitor singleton was NMManager anyway.
Also, even if we ever get more users that are interested in the SLEEPING
signal, we would hook them onto NMManager -- because NMManager should
collect, coordinate and possibly forward the SLEEPING signal. In no case,
another object should react on the SLEEPING signal and thus bypassing the
NMManager.
2016-04-28 13:45:49 +02:00
Thomas Haller
07db1217a9 sleep-monitor: merge RESUMING signal into NMSleepMonitor's SLEEPING signal
Having two signals is more complicated and everybody who cares about
one signal also cares about the other.
2016-04-28 13:20:09 +02:00
Thomas Haller
2208ca3726 sleep-monitor: unify and cleanup logging 2016-04-28 13:00:12 +02:00
Thomas Haller
a22851dc59 sleep-monitor: create D-Bus proxy asynchronously for upower sleep-monitor 2016-04-28 13:00:12 +02:00
Thomas Haller
2b087b4782 sleep-monitor: cleanup #if usage by using USE_UPOWER in "nm-sleep-monitor.c" 2016-04-28 13:00:12 +02:00
Thomas Haller
400e9fc9fb sleep-monitor: use defines for D-Bus paths for upower's sleep-monitor 2016-04-28 13:00:12 +02:00
Thomas Haller
6864a7036f sleep-monitor: use dispose() method for upower's sleep-monitor 2016-04-28 13:00:12 +02:00
Thomas Haller
c76eb3e8f7 sleep-monitor: merge "nm-sleep-monitor-upower.c" into "nm-sleep-monitor.c"
Both files do very similar things, with "nm-sleep-monitor-upower.c"
being suboptimal, for example by creating the proxy synchronously.

Clean that up in the next steps. Just basic merging for now.
2016-04-28 13:00:12 +02:00
Thomas Haller
b97ae18379 sleep-monitor: rename file "nm-sleep-monitor-systemd.c" to "nm-sleep-monitor.c"
Next, we will merge "nm-sleep-monitor-upower.c" into "nm-sleep-monitor.c".
2016-04-28 13:00:12 +02:00
Thomas Haller
6e45909f79 sleep-monitor/trivial: rename "sd_proxy" instance to "proxy"
It's not only relevant for systemd (sd).
2016-04-28 13:00:11 +02:00
Thomas Haller
bf9a74c69f po: remove file "src/nm-sleep-monitor-systemd.c" from POTFILES.in as it has no translations
Fixes: 753f727af5
2016-04-28 13:00:11 +02:00
Thomas Haller
bfc858ccab platform: merge branch 'th/platform-route-cleanup-bgo765432'
https://bugzilla.gnome.org/show_bug.cgi?id=765432
2016-04-28 12:54:26 +02:00
Thomas Haller
aaa28d4d40 platform: add nm_linux_platform_lookup()
Give a direct access to the cache to lookup values there. This is only
useful for testing.
2016-04-28 12:53:21 +02:00
Thomas Haller
d933164087 platform: change order in which fields are compared in nm_platform_ip4_route_cmp()
..., nm_platform_ip6_route_cmp(), nm_platform_ip4_address_cmp() and
nm_platform_ip6_address_cmp().

Compare those fields first, for which we expect that their properties
differ. E.g. usually, each route destination in a set is unique, thus by
comparing those fields first we shortcut some comparisons.
2016-04-28 12:53:21 +02:00
Thomas Haller
4c2410bc92 platform: extend NMIPConfigSource to preserve the rtm_protocol field
For addresses (NMPlatformIPAddress) the @addr_source field is ignored
on a platform level. That is, all addresses inside the platform cache
have this value set to NM_IP_CONFIG_SOURCE_KERNEL. Maybe, for that reason,
the source should not be a part of the NMPlatformIPAddress structure, but
it is convenient for users to piggy back the source inside the platform
address structure.

For routes, the source is stored in NMPlatformIPRoute's @rt_source
field. When adding a route to kernel, we set the @rtm_protocol of the
route depending on the source. However, we want to map different source
values to the same protocol value.

On the other hand, when kernel sends us a route that gets put inside
the cache, we must preserve the protocol value and must not map
different protocol values to the same source.
The reason is, that a user can add two routes that only differ by
@rtm_protocol. In that sense, the @rtm_protocol fields is part of the
unique ID of a kernel route, and thus different values must map to
different sources.

Fix this, by extending the range of NMIPConfigSource to contain
a range of protocol fields.
2016-04-28 12:53:21 +02:00
Thomas Haller
e26fcce0f8 platform: refactor marking cloned routes in platform
We handle cloned routes (that have rtm_flags RTM_F_CLONED) differently.
We used to mark such routes by hacking NMIPConfigSource to have a special
value. No longer do this, because it mixes different concepts.

Note that the rt_cloned filed fits into a hole in the aligment
of NMPlatformIPRoute. Thus there is almost no overhead to this
change.
2016-04-28 12:53:21 +02:00
Thomas Haller
9e83383223 platform: add nmp_utils_ip_config_source_to_string()
Expose nmp_utils_ip_config_source_to_string() in the header file and
implement it via NM_UTILS_ENUM2STR_DEFINE().
2016-04-28 12:53:21 +02:00
Thomas Haller
6bf022359f core/trivial: rename "source" field of addresses and routes
The "source" field of NMPlatformIPRoute (now "rt_source") maps to the
protocol field of the route. The source of NMPlatformIPAddress (now
"addr_source") has no direct equivalent in the kernel.

As their use is different, they should have different names. Also,
the name "source" is used all over the place. Hence give the fields
a more distinct name.
2016-04-28 12:53:21 +02:00
Thomas Haller
44753a590e platform: sort links by ifindex in nm_platform_link_get_all()
This way, we get a defined order at startup.

Also, get rid of the logging statements. It was used for
debugging, but a "getter" really should not log the stuff it
is returning.
2016-04-28 12:53:21 +02:00
Thomas Haller
5fe99a1d1a core: add nm_utils_ipx_address_clear_host_address() util 2016-04-28 12:53:21 +02:00
Francesco Giudici
3c67a1ec5e cli: remove version check against NM
When performing NM package upgrade the new version of nmcli will be immediately
available while NM daemon will not, as it would not restart in order to avoid
to disrupt connectivity. This could create issues with tools leveraging
on nmcli output (till reboot). As apart from this case it is very unlikely
that a user can have this nmcli / NM daemon version mismatch situation,
the check could cause more harm than benefit in real user case
scenarios.

https://bugzilla.redhat.com/show_bug.cgi?id=1291785
2016-04-28 09:35:20 +02:00
Beniamino Galvani
0589e659ca device/ethernet: ignore s390 'portname' attribute when not set
The 'portname' sysfs attribute of s390 devices is deprecated since
kernel 4.4 and always set to 'no portname required'. But even on older
kernels such value must be interpreted as an unset portname and thus
ignored.

https://bugzilla.redhat.com/show_bug.cgi?id=1327204
2016-04-28 09:25:41 +02:00
Thomas Haller
e0c272c153 manager: use _LOGx() macros in nm-manager
They give each logging message a "manager: " prefix.
2016-04-27 18:29:51 +02:00
Beniamino Galvani
1e3d464954 merge: branch 'bg/gateway-never-default-rh1313091-v2'
https://bugzilla.redhat.com/show_bug.cgi?id=1313091
2016-04-27 17:17:48 +02:00
Beniamino Galvani
5b70254ea0 ifcfg-rh: emit a warning when DEFROUTE=no and GATEWAY is set 2016-04-27 17:15:49 +02:00
Beniamino Galvani
c1907a218a libnm-core: remove gateway when never-default=yes in NMSettingIPConfig
Having a gateway defined when never-default=yes causes troubles in
connection matching and anyway makes no sense.

If the combination is found, remove the gateway during the
normalization phase.

https://bugzilla.redhat.com/show_bug.cgi?id=1313091
2016-04-27 17:15:49 +02:00
Thomas Haller
7f7e1eb60b settings: fix write_hostname for relative-symbolic links
g_file_read_link() "reads" the symbolic link. If it's a relative path,
we get a relative path which is anchored on @file. We must resolve that
to be absolute.
2016-04-27 15:03:50 +02:00
Thomas Haller
d6e7fa164b settings: remove unnecessary "file" field for hostname from NMSettingPrivate 2016-04-27 14:51:55 +02:00
Thomas Haller
c4b88bf23f utils: add nm_utils_read_link_absolute() 2016-04-27 14:51:55 +02:00
Francesco Giudici
19350c8975 settings: add notification after connections load
The notification was missing from a long time. The issue has been exposed only
now due to the c57e5a6b66 fix which properly
implemented the "startup-complete" notification substituting out of place code
which masked the bug.
2016-04-27 11:10:58 +02:00
Beniamino Galvani
f4f9c9fa3c tui: quit from top-level form when exiting
The top-level form was left on screen after exit (this is visible only
on some types of terminal as vt100), breaking automated tests.

Fixes: b2fb80928e
2016-04-27 10:52:31 +02:00
Thomas Haller
767fa0ed3d settings: disconnect connection_ready_changed() handler when reaching startup_complete
We connect to notify::startup-complete signal of each connection,
but after we signal startup-complete once, we don't need that
signal anymore. Disconnect.
2016-04-26 15:48:20 +02:00
Thomas Haller
87ded99611 dns: merge branch 'th/dns-rc-manager-bgo765387'
https://bugzilla.gnome.org/show_bug.cgi?id=765387
2016-04-26 14:02:06 +02:00
Thomas Haller
2789345d5b dns: add new rc-manager=unmanaged
The following settings are effectively identical:

    dns=none,rc-manager=*any*
    dns=none,rc-manager=unmanaged
    dns=default,rc-manager=unmanaged

The new setting is only there for completeness and only
makes sense for a dns plugin.
2016-04-26 13:58:28 +02:00
Thomas Haller
161f86b5b3 dns: merge the dns "mode" and "rc-manager"
Already previously, the mode and rc-manager were intertwined in a complicated
way:

  - dns=none effectively disables rc-manager.

  - if resolv.conf was immutable, it would disable the rc-manager
    by setting "resolv_conf_mode=NM_DNS_MANAGER_RESOLV_CONF_UNMANAGED".

  - resolv_conf_mode was anyway a redundant piece of information to
    rc_manager.

Now there are only two relevant settings: priv->plugin and
priv->rc_manager. And they can be set independently from each other.
Before that was not possible. For example, you could not set a
dns plugin with rc-manager=unmanaged (the only way to achive that
was via an immutable resolv.conf or by having rc-manager=symlink
and let resolv.conf link somewhere else.
2016-04-26 13:58:28 +02:00
Thomas Haller
83fd710005 dns: when clearing "plugin" always disconnect signal handlers 2016-04-26 13:58:28 +02:00
Thomas Haller
a252dfdb9d dns: initialize rc-manager in init_resolv_conf_mode()
The "dns" and "rc-manager" properties are strongly related. Initialize them
together in init_resolv_conf_mode().

One difference is, that we now set rc_manager before setting the mode.
But that shouldn't matter.
2016-04-26 13:58:28 +02:00
Thomas Haller
aea2d98e2d dns: split parsing of rc-manager out of init_resolv_conf_manager()
Makes more sense in the next commit, when init_resolv_conf_manager()
gets merged with init_resolv_conf_mode(). Bear with me.
2016-04-26 13:58:28 +02:00
Thomas Haller
cd6a469668 dns: rename "rc-manager=none" to "symlink"
We already have "rc-manager=file", rename "rc-manager=none" to "symlink"
because that better describes what it is actually doing. Of course, the
old name is still accepted.
2016-04-26 13:58:27 +02:00
Thomas Haller
c17b4ba6c7 device: merge branch 'th/default-wired-connection-stable-uuid-bgo765464'
https://bugzilla.gnome.org/show_bug.cgi?id=765464
2016-04-26 12:56:01 +02:00
Thomas Haller
89cf9429a7 device: generate stable UUID for default-wired-connection
Generate a stable connection UUID for the default-wired-connection.
Otherwise, on every reboot, the UUID changes although the generated
connection is the same.

But also hash into the UUID the machine-id, the device name and the
hardware address. So, the UUID is only the same if the connection is
identical in every aspect.

Also, the UUID is used as Network_ID for the stable-privacy address
generation mode. It is bad to re-create different UUIDs on every boot
as it causes different addresses.
2016-04-26 12:50:16 +02:00
Thomas Haller
54233b6f3b core: use nm_utils_machine_id_read() in "nm-dhcp-client.c" 2016-04-26 12:48:28 +02:00
Thomas Haller
f137af2e23 core: add nm_utils_machine_id_read() and parse() util 2016-04-26 12:48:27 +02:00
Thomas Haller
d787b8c827 core: add nm_utils_get_secret_key() util 2016-04-26 12:48:27 +02:00
Lubomir Rintel
dd4d8b24da linux-platform: re-read the link type if the name changed
For some device types, we use the DEVTYPE from sysfs to determine the
link type. However, the way we read from sysfs can race with device
renames and we could miss the chance to read DEVTYPE correctly.

This doesn't completely fix the sysfs race, but cures the boot-time race
with systemd renaming the device while we are initializing the link.

We ideally should use GUDev for all sysfs accesses, but that would need
some more work for this particular case as currently we need the link type
before we have an udev device instance.

https://bugzilla.gnome.org/show_bug.cgi?id=764803

Co-Authored-By: Beniamino Galvani <bgalvani@redhat.com>
2016-04-26 12:20:42 +02:00
Dan Williams
8c8a577a30 dhcp/systemd: actually hook up information-only mode
Fixes: 89d1e46615
Tested-by: Celti on IRC
2016-04-25 17:00:54 -05:00
Thomas Haller
bad9becf99 libnm/doc: fix documentation of NMSettingIP6Config:addr-gen-mode
The value cannot be unset. It must be set to one of the two currently
supported values.
2016-04-25 16:52:34 +02:00
Lubomir Rintel
a57227914e bluetooth: add a missing GError initializer
(cherry picked from commit 3ad7be3e6a124fe9e279ec6d9de06c423ca50cc2)
2016-04-25 16:10:28 +02:00
Thomas Haller
77f287818c settings: merge branch 'th/settings-read-hostname' 2016-04-25 15:27:27 +02:00
Thomas Haller
316359d8b6 settings: refactor read_hostname_*() 2016-04-25 15:26:26 +02:00