Commit Graph

15047 Commits

Author SHA1 Message Date
Thomas Haller
0e90f1ba83 platform: add and use nm_utils_ifname_cpy() helper
Coverity complains rightly about "strncpy (dst, ifname, IFNAMSIZ)"
because it might leave @dst non-NULL-terminated, in case @ifname
is too long (which already would be a bug in the first place).

Replace the strcpy() uses by a new helper nm_utils_ifname_cpy()
that asserts against valid arguments.
2016-03-07 11:36:57 +01:00
Thomas Haller
1dbe1d70df wifi: use g_strlcpy() instead of strncpy() to ensure NUL terminated ifname
IFNAMSIZ is 16 but strncpy doesn't ensure a NUL terminated string in
this case. Coverity rightly complains about it. Use g_strlcpy() instead.

Note that no valid ifname should be 16 characters long in the first
place.
2016-03-06 17:38:28 +01:00
Thomas Haller
a5e09d2887 libnm-util: remove unneeded check for non-null after dereferencing pointer
Since commit 01b9b4104c, we assume
that @error is properly set. No need to check for non-null.
Found by coverity.
2016-03-06 17:06:50 +01:00
Lubomir Rintel
df9ac197c0 contrib/rpm: macro cosmetics 2016-03-05 18:56:28 +01:00
Lubomir Rintel
c0d7810271 contrib/rpm: include the valgrind suppression file in debuginfo package 2016-03-05 18:56:28 +01:00
Beniamino Galvani
5eeae70f69 device/ip-tunnel: implement get_generic_capabilities()
Since 87a3df2e57 ("device: remove default-unmanaged and refactor
unmanaged flags") the device must properly report the IS_SOFTWARE
capability in order to be potentially activated.
2016-03-04 22:09:00 +01:00
Lubomir Rintel
3f92f43c8a test: add missing test file to distribution
Fixes: 9e4abc99e7
2016-03-04 20:41:23 +01:00
Francesco Giudici
fb8fe1d8cb nmcli: fix check on allowed parameters for slave connections
When editing a connection, check its slave-type parameter. If not null,
we will not have ip properties but possibly others, slave-type specific.
2016-03-04 19:14:26 +01:00
Lubomir Rintel
ec16e5cad9 bus-manager: avoid leaking responses for sync bus calls 2016-03-04 19:08:25 +01:00
Thomas Haller
9d9dd84a71 ifcfg-rh: merge branch 'th/ifcfg-ignore-other' 2016-03-04 18:32:13 +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
Thomas Haller
2ff11525c6 nmtst: convert nmtst_assert_error() to a macro to preserve func:line information
Within the macro, the assertion print the proper location of where
the failure happens, instead of pointing to "nm-test-utils.h".
2016-03-04 17:01:41 +01:00
Beniamino Galvani
0fe8a557f8 merge: branch 'bg/sethostname-hostnamed-rh1308974'
Use hostnamed to set the transient hostname when possible.

https://bugzilla.redhat.com/show_bug.cgi?id=1308974
2016-03-04 14:33:01 +01:00
Beniamino Galvani
14d3103ba9 policy: move code from set_system_hostname() to _set_hostname() 2016-03-04 14:27:09 +01:00
Beniamino Galvani
f87d25f7a1 policy: simplify set_system_hostname()
Move some conditionals to the beginning of the function.
2016-03-04 14:27:09 +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
Thomas Haller
298ab55225 platform: cleanup logging for udev-add event 2016-03-04 13:19:34 +01:00
Beniamino Galvani
7d00394f40 logging: merge branch 'bg/logging-messages-bgo763040'
Introduce logging helpers where possible, to uniform the format of
messages and prepend a tag specifying the module that generated the
message, along with other useful information (interface name, ...).

https://bugzilla.gnome.org/show_bug.cgi?id=763040
2016-03-04 12:06:51 +01:00
Beniamino Galvani
d6d9f47a32 dhcp: client: use logging helpers 2016-03-04 11:59:37 +01:00
Beniamino Galvani
cc19352e11 dnsmasq-manager: use logging helpers 2016-03-04 11:55:41 +01:00
Beniamino Galvani
627b943d6a ppp-manager: use logging helpers 2016-03-04 11:55:41 +01:00
Beniamino Galvani
24900e26ef bus-manager: use logging helpers 2016-03-04 11:55:41 +01:00
Beniamino Galvani
47a04ad015 audit: use logging helpers 2016-03-04 11:55:41 +01:00
Beniamino Galvani
f48ee45ff0 policy: use logging helpers 2016-03-04 11:55:41 +01:00
Beniamino Galvani
d2cc33a5b9 supplicant: use logging helpers 2016-03-04 11:53:05 +01:00
Beniamino Galvani
505faf0d6d settings: use logging helpers 2016-03-04 11:53:04 +01:00
Beniamino Galvani
1d5ff2160d bluez-manager: use logging helpers 2016-03-04 11:48:04 +01:00
Beniamino Galvani
67473283ca device: improve logging messages
Add a "device" prefix to the messages.
2016-03-04 11:48:04 +01:00
Beniamino Galvani
392c3909d8 dispatcher: use logging helpers 2016-03-04 11:48:04 +01:00
Beniamino Galvani
bb7da812fe device/ethernet: fix crash on 802.1x authentication timeout
Fixes the following:
GLib-GObject-WARNING **: invalid cast from 'NMSimpleConnection' to 'NMSettingsConnection'

Fixes: 06da353242
2016-03-04 11:43:03 +01:00
Thomas Haller
7e091a230a m4: update introspection.m4 with original file from gobject-introspection
Originally m4/introspection.m4 was copied from gobject-introspection
repository. We however modified it in commit f6272144e9.

Reimport the file with latest changes, but still preserving our
workaround.
2016-03-04 09:25:23 +01:00
Thomas Haller
d17aedf91f all: explicitly ignore return values
Coverity warns that usually we check for the return value.
2016-03-04 09:06:21 +01:00
Thomas Haller
9f16498938 route-manager/tests: add assertion for adding route
Not checking the return value is marked by coverity. Just workaround it.
2016-03-04 08:59:36 +01:00
Thomas Haller
f2165ab959 route-manager/tests: add assertion for adding route
Not checking the return value is marked by coverity. Just workaround it.
2016-03-04 08:58:25 +01:00
Thomas Haller
e4af0f6767 libnm: fix clearing real-devices in NMManager's free_devices()
Found by coverity.
2016-03-04 08:56:38 +01:00
Thomas Haller
2d6cf0df19 device: assert for valid device argument in nm_device_remove_pending_action()
Coverity complains in nm-active-connection.c:

   996        if (priv->pending_activation_id) {
      CID 59368 (#1 of 1): Dereference after null check (FORWARD_NULL)4. var_deref_model: Passing null pointer priv->device to nm_device_remove_pending_action, which dereferences it. [show details]
   997                nm_device_remove_pending_action (priv->device, priv->pending_activation_id, TRUE);
   998                g_clear_pointer (&priv->pending_activation_id, g_free);
   999        }
2016-03-04 08:47:44 +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
21ff042051 all: merge branch 'danw/gerror-bgo762868'
https://bugzilla.gnome.org/show_bug.cgi?id=762868
2016-03-03 19:08:40 +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
Dan Winship
6265398b6e all: use g_error_matches()
Use g_error_matches() where we're testing error codes. In particular,
use it rather than looking at only ->code and not also ->domain, which
is just wrong.

[thaller@redhat.com: rebase and modify original patch]
2016-03-03 18:54:20 +01:00
Thomas Haller
01b9b4104c all: clean-up usage of GError
Functions that take a GError** MUST fill it in on error. There is no
need to check whether error is NULL if the function it was passed to
had a failing return value.

Likewise, a proper GError must have a non-NULL message, so there's no
need to double-check that either.

Based-on-patch-by: Dan Winship <danw@gnome.org>
2016-03-03 18:54:20 +01:00
Thomas Haller
7871d850f5 shared: add NM_G_ERROR_MSG() 2016-03-03 18:54:20 +01:00
Beniamino Galvani
c30627f106 settings: set @error on failure of nm_settings_plugin_add_connection() 2016-03-03 18:54:20 +01:00
Lubomir Rintel
99b37d768f iface-helper: fix RA processing with more than one router
We construct new IP6Config on each rdisc_config_changed(). That's not a smart
thing to do, since that makes us throw away the previous configuration.

In case the two routers on the same network, the first RA triggers
rdisc_config_changed() for changed gateway and addresses. On handling the
second RA rdisc_config_changed() doesn't add the address, resulting in the
address being removed on ip6 config sync.

A side effect of this is that the address is still tentative, resulting in DAD
retry and an new address being added. So the networking still works, but at the
expense of a single DAD failure and an address that's perhaps different from what
was expected.
2016-03-03 16:00:56 +01:00
Michael Biebl
0518489b39 tests: fix bashism in run-test-dbus-session.sh
https://bugzilla.gnome.org/show_bug.cgi?id=762940
2016-03-03 13:45:50 +01:00
Beniamino Galvani
89d1e46615 dhcp/systemd: enable DHCPv6 support
Until now the internal DHCP client could start a DHCPv6 transaction
but was not able to parse the lease and pass the information back to
the core. Add the missing glue code to make this work.

https://bugzilla.gnome.org/show_bug.cgi?id=762432
2016-03-03 11:29:27 +01:00
Adrian Likins
6c59443ad5 Fix missing commas in list-devices devtypes dict. 2016-03-02 18:43:28 +01:00