Commit graph

14888 commits

Author SHA1 Message Date
Thomas Haller
90733d970d sleep-monitor: cleanup #if usage by using USE_UPOWER in "nm-sleep-monitor.c"
(cherry picked from commit 2b087b4782)
2016-05-24 15:15:25 +02:00
Thomas Haller
1242147efa sleep-monitor: use defines for D-Bus paths for upower's sleep-monitor
(cherry picked from commit 400e9fc9fb)
2016-05-24 15:15:25 +02:00
Thomas Haller
4e7d3b0546 sleep-monitor: use dispose() method for upower's sleep-monitor
(cherry picked from commit 6864a7036f)
2016-05-24 15:15:25 +02:00
Beniamino Galvani
6b1431b9ac 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.

(cherry picked from commit c76eb3e8f7)
2016-05-24 15:15:07 +02:00
Thomas Haller
025af2a55f 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".

(cherry picked from commit b97ae18379)
2016-05-24 15:12:17 +02:00
Thomas Haller
aa67e0c005 sleep-monitor/trivial: rename "sd_proxy" instance to "proxy"
It's not only relevant for systemd (sd).

(cherry picked from commit 6e45909f79)
2016-05-24 15:12:14 +02:00
Thomas Haller
bd509b5ea2 po: remove file "src/nm-sleep-monitor-systemd.c" from POTFILES.in as it has no translations
Fixes: 753f727af5
(cherry picked from commit bf9a74c69f)
2016-05-24 15:12:12 +02:00
Thomas Haller
f8a7e32eba manager: use _LOGx() macros in nm-manager
They give each logging message a "manager: " prefix.

(cherry picked from commit e0c272c153)
2016-05-24 15:11:17 +02:00
Beniamino Galvani
ee72e66c13 sleep-monitor-systemd: merge branch 'th/sleep-monitor-sd-cleanup'
Some cleanup of "nm-sleep-monitor-systemd.c"
(cherry picked from commit 64e8f0076d)
2016-05-24 15:10:08 +02:00
Thomas Haller
5293991255 sleep-monitor: disconnect signal handlers from D-Bus proxy on destroy
The lifetime of the proxy is not necesarily the same as the lifetime
of the NMSleepMonitor instance. Disconnect the signals during dispose().

(cherry picked from commit a09a5f7fc1)
2016-05-24 15:09:03 +02:00
Thomas Haller
3f30283a76 sleep-monitor: don't localize messages in core daemon
The daemon does not run with a particular locale of a user. Localizing
makes no sense (at least, we don't do it usually and it would make
logging localized).

(cherry picked from commit 753f727af5)
2016-05-24 15:09:01 +02:00
Thomas Haller
331f571dff sleep-monitor: properly handle cancelling of "Inhibit" D-Bus call
As we don't take a reference on @self during the asynchronous
request, we must properly support cancelling in case of early
destruction.

I think, it's gdbus' responsibility not to leak any file descriptors
when cancelling a D-Bus request that returns file descriptors. Thus,
our usual pattern works here too.

(cherry picked from commit 2e3ff56cdc)
2016-05-24 15:08:59 +02:00
Thomas Haller
eaa068cfb3 sleep-monitor: handle early destruction of NMSleepMonitor instance
When destroing the sleep monitor before the D-Bus proxy is created,
we must cancel creation of the proxy.

(cherry picked from commit 3fa3dba1b1)
2016-05-24 15:08:57 +02:00
Thomas Haller
23bd466af6 sleep-monitor: drop unused class methods for signals
(cherry picked from commit 2919b9271d)
2016-05-24 15:08:56 +02:00
Thomas Haller
a61ff3de97 sleep-monitor: implement dispose() instead of finalize()
To release resources, dispose() is preferred over finalize()
because it is called earlier.

(cherry picked from commit a7308bbe9c)
2016-05-24 15:08:54 +02:00
Thomas Haller
f8fc8b3302 sleep-monitor: don't return value from drop_inhibitor()
(cherry picked from commit fc14d32e99)
2016-05-24 15:08:52 +02:00
Thomas Haller
1648fd3c14 sleep-monitor: use LOG macros in "nm-sleep-monitor-systemd.c"
(cherry picked from commit d0a6f6f34c)
2016-05-24 15:08:48 +02:00
Beniamino Galvani
d6861b5b04 core: merge branch 'th/settings-cleanup-bgo765000'
https://bugzilla.gnome.org/show_bug.cgi?id=765000
(cherry picked from commit de2fa9b647)
2016-05-24 15:05:02 +02:00
Thomas Haller
ed050337b3 active-connection: update D-Bus properties of active-connection when settings-connection changes
$ nmcli connection up my-connection
  Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/42)

  $ nmcli connection modify my-connection connection.id other-name

  $ nmcli -f connection.id connection show other-name
  connection.id: other-name

  $ nmcli -f GENERAL.CONNECTION device show enp0s25
  GENERAL.CONNECTION: my-connection

  $ nmcli connection down other-name
  Error: 'other-name' is not an active connection.
  Error: no active connection provided.

  $ nmcli connection down my-connection
  Connection 'my-connection' successfully deactivated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/13)

When modifying a connection, NMActiveConnection must update the D-Bus
properties that belong to the settings-connection.

(cherry picked from commit 18019d55a1)
2016-05-24 15:03:26 +02:00
Thomas Haller
ab6d813e96 settings: merge "connection-updated" and "connection-updated-by-user" signals
This is mostly interesting of NMPolicy, which no longer needs to
subscribe to two almost identical signals (where the by-user signal
was always invoked together with the plain "updated" signal).

(cherry picked from commit 3164c026a2)
2016-05-24 15:03:24 +02:00
Thomas Haller
52644bfebd settings: combine "updated" and "updated-by-user" signal in NMSettingsConnection
Instead of connecting to two similar signals, combine them into one
and pass "by_user" argument.

We still need to keep the original NM_SETTINGS_CONNECTION_UPDATED signal,
because it is exposed on D-Bus.

(cherry picked from commit 65c55e2a78)
2016-05-24 15:03:22 +02:00
Thomas Haller
fba19c43ee settings: emit NM_SETTINGS_CONNECTION_UPDATED right away and not on an idle handler
I want to combine NM_SETTINGS_CONNECTION_UPDATED and NM_SETTINGS_CONNECTION_UPDATED_BY_USER
into one signal. Thus, they must have same behavior with respect as to whether they are
scheduled on idle.

Emit NM_SETTINGS_CONNECTION_UPDATED right away.

The "Updated" signal is exposed via D-Bus on the settings object.
Removing the idle handling has no bad consequences there.

Apart from that, the signal has only the listener NMSettings::connection_updated().
connection_updated() first emits NM_SETTINGS_SIGNAL_CONNECTION_UPDATED, which only
has listener: NMPolicy::connection_updated(), which already delegates to
an idle handler.

Second, NMSettings::connection_updated() emits
NM_CP_SIGNAL_CONNECTION_UPDATED which has the following listeners:

  - NMBluezDevice::cp_connection_updated(), which can cause the
    connection to be tracked/untracked. Any further changes are
    already delayed on an idle handler (check_emit_usable_schedule()).

  - NMDevice::cp_connection_added_or_updated(), which causes the
    connection to be tracked by the device. It also emits
    "notify::available-connections", which however is only relevant
    for the D-Bus bindings.
    At last, it does available_connections_check_delete_unrealized()
    which also is on an idle handler already.

(cherry picked from commit a4f1a1794f)
2016-05-24 15:03:20 +02:00
Thomas Haller
887fc983be device/bluez: delay check_emit_usable() for NM_CP_SIGNAL_CONNECTION_UPDATED
Currently, NM_CP_SIGNAL_CONNECTION_UPDATED signal will be invoked on an
idle handler. I want to change that, so to be save, delay actions that
matter on an idle handler.

(cherry picked from commit 640ef67cd7)
2016-05-24 15:03:18 +02:00
Thomas Haller
30590effc8 device/bluez: refactor registering to connections
No (intentional) change in behavior.

(cherry picked from commit 3325cd3d90)
2016-05-24 15:03:17 +02:00
Thomas Haller
946fb983f6 policy: handle schedule_activate_all() in an idle handler
schedule_activate_all() needs to iterate over all devices and is thus
relatively costly (and scales O(n^2)).

By scheduling the action on an idle handler we delay and combine
multiple redundant requests.

Another reason is that NM_SETTINGS_CONNECTION_UPDATED is currently
executed on an idle handler which first leads to
NM_SETTINGS_SIGNAL_CONNECTION_UPDATED signal and eventually calls
schedule_activate_all().
I want to change that to emit the connection update signal immediately,
thus to preserve the delay, we delay handling in NMPolicy.

(cherry picked from commit 920054d8aa)
2016-05-24 15:03:16 +02:00
Thomas Haller
8b357f43c6 settings: drop signal slots from NMSettings
NMSettings has no derived classes and obviously nobody is using
those slots. Just drop them.

(cherry picked from commit d571933505)
2016-05-24 15:03:13 +02:00
Thomas Haller
480e69cc82 settings: refactor connection_changed()
Again, no functional change.

(cherry picked from commit f7e7df772d)
2016-05-24 15:03:12 +02:00
Thomas Haller
6359213ea4 settings: refactor connection-changed handler
No change in behavior, just not pass on this GUINT_TO_POINTER (TRUE).

(cherry picked from commit 866df17e97)
2016-05-24 15:03:11 +02:00
Thomas Haller
c70d6bf498 settings: use NM_GOBJECT_PROPERTIES_DEFINE in NMSettings/NMSettingsConnection/NMActiveConnection
(cherry picked from commit 30b8842a48)
2016-05-24 15:03:09 +02:00
Thomas Haller
a6634183e1 device: drop available_connections_notify() and call _notify() directly
(cherry picked from commit 8c86648313)
2016-05-24 15:03:08 +02:00
Thomas Haller
f4113b8b24 manager: fix implementation of NMManager's "startup-complete
Due to a bug, NMManager would connect to "notify::connections"
and might miss an important notification when NMSettings declares
startup-complete.

Fixes: b067ca7034
(cherry picked from commit c57e5a6b66)
2016-05-24 15:03:06 +02:00
Beniamino Galvani
a97ba456fe config: add file name to error messages for parsing failures
When one of the configuration snippet is malformed, NM doesn't tell
which file caused the error:

$ NetworkManager --print-config
Failed to read configuration: Key file does not start with a group

Fix this.

$ NetworkManager --print-config
Failed to read configuration: /usr/lib/NetworkManager/conf.d/test.conf: Key file does not start with a group

(cherry picked from commit 57c001200d)
2016-05-19 18:13:55 +02:00
Beniamino Galvani
1cedca3e69 cli: remove wrong assertion in check_valid_name()
As explained in the function comment, a NULL value for @val is
acceptable. Otherwise:

$ nmcli connection edit
 (process:2276): nmcli-CRITICAL **: check_valid_name: assertion 'val' failed

Fixes: fb8fe1d8cb
(cherry picked from commit 73221a809d)
2016-05-19 17:13:03 +02:00
Thomas Haller
1b815346aa clients: fix build error for missing nm_vpn_plugin_info_get_service() after bad backport
nm_vpn_plugin_info_get_service() is new API on master, not available here.
Reimplement it.

Fixes: 7c209b2a7d
2016-05-19 13:23:40 +02:00
Thomas Haller
2c34cd9ab5 cli: merge branch 'th/cli-vpn-import-fixes-rh1337300'
https://bugzilla.redhat.com/show_bug.cgi?id=1337300

(cherry picked from commit 3d25b2e1a1)
2016-05-19 13:12:43 +02:00
Thomas Haller
964baa0e33 clients,cli: show better error message when failing to load VPN plugin
VPN plugins are often not installed or they might be legacy-only.
In both cases we should show a better error message about the
failure reason.

(cherry picked from commit d0f01aa2c2)
2016-05-19 13:12:02 +02:00
Thomas Haller
7c209b2a7d clients,cli: for connection-add consider VPNs as loaded from the plugin
Instead of using (only) a hard-coded list of VPN types,
prefer lookup the VPN settings from the .name files.

Still, fallback to a hard-coded list if the plugin cannot
be found, because for connection-add we currently don't
actually need the plugin installed.

(cherry picked from commit 41976e3069)
2016-05-19 13:12:02 +02:00
Thomas Haller
83ea6abc6c clients: don't assert against existance of plugin in nm_vpn_supports_ipv6()
Obviously, loading a plugin can fail easily.

(cherry picked from commit 2b4b9d34e4)
2016-05-19 13:12:02 +02:00
Thomas Haller
be9e068654 clients: lookup VPN plugins either by "name" or "service"
... not constructing a "service" by prepending a D-Bus prefix to "name" (urgh).

(cherry picked from commit 0225c4567b)
2016-05-19 13:12:02 +02:00
Thomas Haller
981e5f6716 nmcli-completion: complete filename for VPN import and passwd-file
Also hard-code the VPN types strongswan and fortisslvpn.

https://bugzilla.redhat.com/show_bug.cgi?id=1337300
(cherry picked from commit 09a015b23b)
2016-05-19 13:12:02 +02:00
Michael Olbrich
10ba492047 sleep-monitor-upower: add missing include
Otherwise building fails with:

  nm-sleep-monitor-upower.c:132:45: error: expected declaration specifiers or '...' before 'nm_sleep_monitor_get'
  nm-sleep-monitor-upower.c:132:67: error: expected declaration specifiers or '...' before '(' token

https://mail.gnome.org/archives/networkmanager-list/2016-May/msg00053.html
2016-05-19 12:41:12 +02:00
Thomas Haller
1d78b173bd NEWS: fix mistake in NEWS file about wifi.mac-address-randomization
(cherry picked from commit e0e1c59160)
2016-05-19 12:12:30 +02:00
Beniamino Galvani
0fd523c58d cli: append newline to failure message
Fixes: a06487a6ae
(cherry picked from commit dbd0634c84)
2016-05-16 17:56:08 +02:00
Beniamino Galvani
1d4a9e64fb device: merge branch 'bg/dhcp-assumed-generated-route-rh1265239'
https://bugzilla.redhat.com/show_bug.cgi?id=1265239
(cherry picked from commit adb534518b)
2016-05-16 15:48:53 +02:00
Beniamino Galvani
c65baf3121 device: take care of default route of DHCP generated-assumed connections
In general we don't touch the externally set default route on devices
that use a generated-assumed connection. When the IP method is AUTO
(or DHCP), this means that we are not able to restore the default
route after a temporary expiration of the lease which removes
addresses/routes from the device.

Change this, and let NM update the default route for generated-assumed
devices using dynamic addressing.

https://bugzilla.redhat.com/show_bug.cgi?id=1265239
(cherry picked from commit 9b7f9af077)
2016-05-16 15:47:33 +02:00
Beniamino Galvani
1d01cd587c device: don't update applied connection for generated assumed devices
The applied connection must describe the configuration that was
initially activated on the device. Even if the IP configuration
changes, we shouldn't reset the applied connection for devices using a
generated-assumed connection, otherwise we would lose information on
the IP method we're trying on the device.

(cherry picked from commit c84fd50287)
2016-05-16 15:47:29 +02:00
Beniamino Galvani
2959977164 device: apply MTU setting also to devices without IPv4 configuration
Usually the MTU in the ethernet.mtu property is applied to the device
during the commit of IPv4 configuration.  For devices with
ipv4.method=disabled or slave devices that phase is skipped and so the
setting does not have effect.  Apply the MTU explicitly in such cases.

https://bugzilla.redhat.com/show_bug.cgi?id=1303968
https://bugzilla.redhat.com/show_bug.cgi?id=1303731
(cherry picked from commit 53dfaddda2)
2016-05-16 10:57:27 +02:00
Thomas Haller
38ce17b8b9 man: minor rewording in NetworkManager.conf about connection.stop-match
(cherry picked from commit 7d0119d249)
2016-05-13 19:33:06 +02:00
Dan Williams
3cba4194f2 manager: don't unmanage devices without L3 config on shutdown
Use the following logic when quitting, if the device is managed:

  1) if the connection is assumed, leave it up
  2) if the device has no connection (eg, !req) leave it up
  3) if the device only has L2 leave it up

[thaller@redhat.com: original patch reworked by bgalvani@redhat.com and me]

https://bugzilla.redhat.com/show_bug.cgi?id=1311988
https://bugzilla.redhat.com/show_bug.cgi?id=1333983

(cherry picked from commit 25aaaab3b7)
(cherry picked from commit dab2d46aa2)
2016-05-13 19:30:11 +02:00
Thomas Haller
9a37d1d970 libnm: don't require initialized @out_encrypted argument in nm_utils_file_is_private_key()
No need to require the caller to initialize the optional out-argument.
Otherwise we get:

  (nm-connection-editor:2471): libnm-CRITICAL **: nm_utils_file_is_private_key: assertion 'out_encrypted == NULL || *out_encrypted == FALSE' failed

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

Fixes: 1c4f41c610
(cherry picked from commit 81499355b0)
2016-05-13 14:26:52 +02:00