Commit graph

1109 commits

Author SHA1 Message Date
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
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
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
Thomas Haller
ddefd6931e 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.

(cherry picked from commit 7f7e1eb60b)
2016-05-12 15:28:05 +02:00
Thomas Haller
51188fb046 settings: remove unnecessary "file" field for hostname from NMSettingPrivate
(cherry picked from commit d6e7fa164b)
2016-05-12 15:28:05 +02:00
Thomas Haller
97c15ed358 settings: don't unload settings plugins on failure
Also, registering a weak-pointer to close the module that
was just made as resident is pointless.

(cherry picked from commit c6a92224a4)
2016-04-29 15:56:20 +02:00
Lubomir Rintel
9ecead6081 ifupdown: avoid calloc()
It can return NULL and makes Coverity upset:

CID 75369 (#1 of 1): Dereference null return value (NULL_RETURNS)
4.  dereference: Dereferencing a null pointer ret.

(cherry picked from commit 76844c65d6)
2016-04-29 13:14:56 +02:00
Lubomir Rintel
544827a8d1 ifnet: fix error handling
CID 76722 (#1 of 1): Logically dead code (DEADCODE)
dead_error_line: Execution cannot reach this statement:
g_set_error(error, nm_setti....

(cherry picked from commit 2e563d9c84)
2016-04-29 13:14:55 +02:00
Francesco Giudici
863f2ffb4d 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.

(cherry picked from commit 19350c8975)
2016-04-28 16:45:16 +02:00
Thomas Haller
7ede2a7a63 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.

(cherry picked from commit 89cf9429a7)
2016-04-26 12:59:20 +02:00
Thomas Haller
9f6dd5afb7 settings: refactor read_hostname_*()
(cherry picked from commit 316359d8b6)
2016-04-25 15:28:49 +02:00
Thomas Haller
eb4e694565 settings: cleanup #if blocks for HOSTNAME_PERSIST_*
(cherry picked from commit 79d85ca180)
2016-04-25 15:28:48 +02:00
Patrick J. Volkerding
6e86ad8e0f settings: fix Slackware hostname setting
https://mail.gnome.org/archives/networkmanager-list/2016-April/msg00075.html
(cherry picked from commit 1a714ee5e6)
2016-04-25 15:28:47 +02:00
Thomas Haller
b78e4de648 ifcfg-rh: support zero prefix length for IP addresses in reader
(cherry picked from commit a170320c35)
2016-04-12 11:16:12 +02:00
Thomas Haller
9152dec99f build: disable deprecation checks for internal compilation
For internal compilation we want to be able to use deprecated
API without warnings.

Define the version min/max macros to effectively disable deprecation
warnings.

However, don't do it via CFLAGS option in the makefiles, instead hack it
to "nm-default.h". After all, *every* source file that is for internal
compilation needs to include this header as first.
2016-04-05 22:22:58 +02:00
Lubomir Rintel
a8e8e76641 dbus: fix up the XML formatting
The conversion script didn't do a very good job. It got fired.
2016-04-05 14:37:51 +02:00
Lubomir Rintel
6e2b188361 dbus: convert the annotations to gtk-doc blocks 2016-04-05 14:37:51 +02:00
Beniamino Galvani
1422ce0a6a ifcfg-rh: don't chain up after failure of replace_and_commit()
If replace_and_commit() found existing route files (and the callback
has potentially already been invoked), it is wrong to chain up to
parent class and continue the update.

Fixes: f79d62692e
2016-03-30 18:12:32 +02:00
Robby Workman
c0a506648f settings: add persistent hostname support for Slackware 2016-03-29 15:51:34 -05:00
Thomas Haller
7991298c51 core: be strict about connection argument in D-Bus methods
There is no excuse for clients to send connections to NetworkManager
that have invalid/unknown fields. Just reject them.

This is a dangerous change, because we might now reject connections
that we were accepting previously. Who know what clients were sending
and it used to work.
2016-03-29 11:56:26 +02:00
Thomas Haller
3d8776108c libnm-core: add _nm_simple_connection_new_from_dbus() function
Contary to nm_simple_connection_new_from_dbus(), this internal
function allows to specify parse-flags.
2016-03-26 12:10:54 +01:00
Lubomir Rintel
618373a14f dbus: use the annotations for documentation
gdbus only understands those (and gtk docstrings, which we should eventually
use) when generating the documentation.
2016-03-26 11:28:19 +01:00
Beniamino Galvani
a4b4e0bc5b ifcfg-rh: add support for domain-suffix-match properties 2016-03-16 17:32:17 +01:00
Lubomir Rintel
0adac47922 ifupdown: style fixes 2016-03-15 09:18:01 +01:00
Lubomir Rintel
c4fed9bd36 ifnet: fix error handling
Oh my.
2016-03-15 09:00:03 +01:00
Lubomir Rintel
12063468a3 ifnet: fix a possible NULL dereference
CID 75367 (#1 of 1): Dereference null return value (NULL_RETURNS)
30. dereference: Incrementing a pointer which might be null: pos.
2016-03-15 09:00:03 +01:00
Lubomir Rintel
e4aaa48b82 ifupdown: fix up a bad rebase
Fixes: 0cb45af977
2016-03-14 16:39:43 +01:00
Lubomir Rintel
1b826d9dd9 ifupdown: set wireless mode 2016-03-14 16:32:15 +01:00
Lubomir Rintel
b6bbf3df1e ifupdown: ssid is now GBytes for quite some time
Fixes: c43f88907b
2016-03-14 16:32:15 +01:00
Lubomir Rintel
5b14492b0b ifupdown: wireless-essid is good too 2016-03-14 16:32:15 +01:00
Lubomir Rintel
0cb45af977 ifupdown: don't remove the object in its constructor
This is wrong an all the complexity of a property and associated bookkeeping is
completely unnecessary.
2016-03-14 16:32:15 +01:00
Lubomir Rintel
a5c204a69a ifupdown: drop a bogus warning
The key might be a wireless setting that has already been processed, not a
wireless-security setting.
2016-03-14 16:32:15 +01:00
Thomas Haller
fd8c56425e all/tests: fix tests after adjusting glib logging level
Fixes: b49322b568
2016-03-10 14:04:32 +01:00
Thomas Haller
f6ea8f5e67 keyfile/tests: remove trailing space from test name
The test names are useful, for example to run only specific tests via
  ./test-keyfile -p "/keyfile/test_read_valid_wired_connection "

The trailing space in the test name however is unexpected. Remove it.
2016-03-10 13:54:39 +01:00
Thomas Haller
b36d721525 all: drop str_if_set() in favor of the "?:" operator
str_if_set() was added to replace the non-standard gcc extension "?:".
However, "?:" is supported by clang as well and we already use it at
several places.

Also, str_if_set() did not follow our naming scheme and renaming to
nm_str_if_set() would be ugly. So just drop it.
2016-03-08 17:57:20 +01:00
Lubomir Rintel
1c5d8d0aec all: fix a couple more gvariant iteration leaks 2016-03-08 17:44:15 +01:00
Lubomir Rintel
3f92f43c8a test: add missing test file to distribution
Fixes: 9e4abc99e7
2016-03-04 20:41:23 +01:00
Thomas Haller
86ccdcf366 ifcfg-rh: log debug level message when loading of ifcfg file fails for common reasons 2016-03-04 18:31:03 +01:00
Thomas Haller
7e4178b383 ifcfg-rh: skip loading files for unhandled types due to existing ifup script
When an ifcfg file doesn't specify the TYPE, ifup will
look for a script "ifup-${DEVICETYPE}", where DEVICETYPE
is determined as
  [ -z "$DEVICETYPE" ] && DEVICETYPE=$(echo ${DEVICE} | sed "s/[0-9]*$//")

Avoid handling such files by checking that no such ifup script exists.
2016-03-04 18:31:03 +01:00
Thomas Haller
9e4abc99e7 ifcfg-rh: ignore "sit" connections without explicit TYPE based on IPV6TUNNELIPV4
If a ifcfg file has no TYPE=sit, we would detect it as ethernet,
although the presence of IPV6TUNNELIPV4 indicates that it of type
"sit". Ignore such connections.
2016-03-04 18:11:48 +01:00
Thomas Haller
8ccba8d09f ifcfg-rh/tests/trivial: remove self-explanatory comments 2016-03-04 18:11:45 +01:00
Beniamino Galvani
4090716d96 core: use hostnamed to set the transient hostname
In commit 6dc35e66d4 ("settings: add hostnamed support") we started
to use systemd-hostnamed for setting the system static hostname
(i.e. the one written to /etc/hostname), but nm-policy.c still called
sethostname() to set the transient (dynamic) hostname when this needs
to be changed, for example after a reverse lookup of our dynamic IP
address.

Thus, when using systemd the hostname change failed because process'
capabilities are restricted and sethostname() requires CAP_SYS_ADMIN.

We should set also the transient hostname through hostnamed when this
is available.

https://bugzilla.redhat.com/show_bug.cgi?id=1308974
2016-03-04 14:27:09 +01:00
Beniamino Galvani
505faf0d6d settings: use logging helpers 2016-03-04 11:53:04 +01:00
Thomas Haller
1bf76b784f ifcfg-rh/tests: remove call to nm_connection_normalize()
Coverity complains that the return value is not checked.
Normaliziation here is not necessary.
2016-03-04 08:37:54 +01:00
Thomas Haller
cd4f84b738 all: don't include error->code in log messages
GError codes are only unique per domain, so logging the code without
also indicating the domain is not helpful. And anyway, if the error
messages are not distinctive enough to tell the whole story then we
should fix the error messages.

Based-on-patch-by: Dan Winship <danw@gnome.org>
2016-03-03 18:54:20 +01:00