Commit graph

14128 commits

Author SHA1 Message Date
Lubomir Rintel
4c3e69f9e9 test: use g_assert_not_reached () instead of asserting FALSE
It's declared as never returning, making do a better at understanding control
flow. Otherwise it makes a poor guess:

  In file included from test-crypto.c:37:
  ../../shared/nm-test-utils.h:1344:3: error: variable 'family' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
                  g_assert (FALSE);
                  ^~~~~~~~~~~~~~~~
2016-02-12 09:05:27 +01:00
Beniamino Galvani
87edaa2a42 core: merge branch 'bg/route-metric-compare-rh1302532'
https://bugzilla.redhat.com/show_bug.cgi?id=1302532
2016-02-11 21:59:47 +01:00
Beniamino Galvani
08c3378f64 core: fix matching of default metric value for static routes
When NM tries to match a generated connection to a persistent one, it
considers also the metric of static routes. However, if the field is
set to -1 (use default value for the device) on the persistent
connection, the comparison will always fail because the generated
connection contains the actual value read from kernel.

To fix the issue, modify check_possible_match() to deal correctly with
-1 and translate it to the expected value for the current device when
performing the comparison.

This allows connections with static routes and default metric to
properly be re-assumed when NM is restarted.

https://bugzilla.redhat.com/show_bug.cgi?id=1302532
2016-02-11 21:57:45 +01:00
Beniamino Galvani
8682bb7f5f nmtst: introduce nmtst_setting_ip_config_add_{address,route} helpers 2016-02-11 21:57:09 +01:00
Dan Williams
e2637760f1 wifi: allow autoconnect on AP/AdHoc mode connections with manual IP configuration
The existing checks assumed that all AP/AdHoc connections would use the
shared IP method.  But what we really want to check for here is whether the
connection is AP/AdHoc.  Leave the existing 'shared' check for backwards
compatibility.

Also move the check above the timestamp check, since the user shouldn't need
to manually set a timestamp just to get an AP-mode connection to autoconnect.
2016-02-11 14:37:38 -06:00
Dan Williams
1fd91056d4 build: define g_assert_cmpmem() for glib < 2.46
Fixes: b73c0e2f6d
2016-02-11 12:40:18 -06:00
Thomas Haller
dc394a6537 macros: add NM_IN_STRSET()
Add macro similar to NM_IN_SET() that checks for C strings.
NULL values are allowed and handled as one would expect.
2016-02-11 17:54:38 +01:00
Thomas Haller
1211b5b631 macros: simplify NM_IN_SET() macro
Also fix NM_IN_SET_SE() to guaranteed return 0 or 1.
2016-02-11 17:54:38 +01:00
Dan Williams
b73c0e2f6d keyfile: convert testcases to g_assert() 2016-02-11 10:44:41 -06:00
Beniamino Galvani
efa5cee6d0 man: fix nesting of tags in NetworkManager.conf man page
Fixes: 9f1e9913b9
2016-02-11 17:21:36 +01:00
Beniamino Galvani
9e5c99465d cli: fix compile error
connections.c: In function ‘sort_connections’:
 connections.c:1536:3: error: ‘return’ with no value, in function returning non-void [-Werror=return-type]
    return;
    ^

Fixes: e8927c14ec
2016-02-11 17:14:35 +01:00
Dan Williams
e5dd4c6882 ifupdown: convert last tests to g_assert() 2016-02-11 10:03:42 -06:00
Lubomir Rintel
76cb1d4b72 dispatcher: drop a useless condition
The request->scripts are allocated in handle_action() and request_free() is
only called after that, so it never sees it NULL. Coverity knows:

CID 59385 (#1 of 1): Dereference before null check (REVERSE_INULL)
check_after_deref: Null-checking request->scripts suggests that it may be null,
but it has already been dereferenced on all paths leading to the check.
2016-02-11 17:01:03 +01:00
Lubomir Rintel
e8927c14ec client: fix NULL dereference with no connections
Coverity complains:

CID 59386 (#1 of 1): Dereference before null check (REVERSE_INULL)
check_after_deref: Null-checking cons suggests that it may be null, but it has
already been dereferenced on all paths leading to the check.
2016-02-11 17:01:03 +01:00
Lubomir Rintel
1783826856 cli: sort_access_points() doesn't take a NULL argument
The device never returns NULL access point list, it only deallocates it on
dispose(). Make this clear for Coverity:

CID 59387 (#1 of 1): Dereference before null check (REVERSE_INULL)
check_after_deref: Null-checking aps suggests that it may be null, but it has
already been dereferenced on all paths leading to the check.
2016-02-11 17:01:03 +01:00
Dan Williams
80d9a43a25 tests: get rid of FAIL macro 2016-02-11 09:50:29 -06:00
gunchleoc
007aeba021 wifi: fixed some strings "cannot specific" => "cannot specify"
https://github.com/NetworkManager/NetworkManager/pull/2
2016-02-11 15:31:07 +01:00
Thomas Haller
3fd414442e ifcfg-rh: ignore explicit IPv4 default routes in reader
NetworkManager does not allow default routes to be specified
as normal routes. They must be ignored. Especially, iproute2
which reads the ifcfg files in initscripts, does not allow
to specify a prefix length "default/x" except for "default/0".

https://bugzilla.gnome.org/show_bug.cgi?id=761631
2016-02-11 14:27:28 +01:00
Beniamino Galvani
14c16a8b22 exported-object: set object path after skeleton creation
When exporting an object, we first set the object path and then create
GDBus interface skeletons. While doing this, a signal can be generated
[1] and then nm_exported_object_signal_hook() can trigger the failed
assertion "interface != NULL" because the object is already exported
(priv->path != NULL) but the interface has not been registered yet.

To fix this, set the object path only after skeletons have been
created.

[1] This happens here every time I disable networking and restart NM:
    #0  _g_log_abort (libglib-2.0.so.0)
    #1  g_log (libglib-2.0.so.0)
    #2  nm_exported_object_signal_hook (NetworkManager)
    #3  signal_emit_unlocked_R (libgobject-2.0.so.0)
    #4  g_signal_emit_valist (libgobject-2.0.so.0)
    #5  g_signal_emit (libgobject-2.0.so.0)
    #6  set_state (NetworkManager)
    #7  nm_manager_update_state (NetworkManager)
    #8  get_property (NetworkManager)
    #9  object_get_property (libgobject-2.0.so.0)
    #10 on_source_notify (libgobject-2.0.so.0)
    #11 g_object_bind_property_full (libgobject-2.0.so.0)
    #12 g_object_bind_property (libgobject-2.0.so.0)
    #13 nm_exported_object_skeleton_create (NetworkManager)
    #14 nm_exported_object_create_skeletons (NetworkManager)
    #15 nm_exported_object_export (NetworkManager)
    #16 nm_manager_setup (NetworkManager)
    #17 main (NetworkManager)
    #18 __libc_start_main (libc.so.6)
    #19 _start (NetworkManager)

https://mail.gnome.org/archives/networkmanager-list/2016-February/msg00041.html
2016-02-11 12:55:21 +01:00
Beniamino Galvani
f57dd6735e libnm-core: fix documentation for MAC_ADDRESS_RANDOMIZATION property
Fixes: 6a46dfca26
2016-02-11 12:01:29 +01:00
Thomas Haller
c1470a353c nmtst: drop details argument from add-test helper 2016-02-10 00:15:41 +01:00
Thomas Haller
03ec751402 nmtst: fix nmtst_test_data_unpack() macro
Fixes: e6244814eb
2016-02-09 10:51:33 +01:00
Dan Williams
170b94598a libnm: fix NMSettingVxlan ageing and limit max values
They are actually u32 in the kernel.  Plus if we use G_MAXINT32 it
causes gtkdoc to write out "Allowed values: <= G_MAXLONG" on i386
and "Allowed values: <= G_MAXINT" on x86_64, breaking multilib.

Fixes: 95dfd99afc
2016-02-05 16:24:40 -06:00
Dan Williams
2eabd61f7f libnm: fix copy & paste error in NMSettingVxlan properties
Fixes: 95dfd99afc
2016-02-05 16:18:05 -06:00
Thomas Haller
04ec21ccc2 logging: add new logging macros _LOGx_err() to log errno
Not yet used, only implemented for nm-linux-platform.c as a
show case.

Use it like:

  _LOGW_err (errno, "failed to popen()");
2016-02-05 11:10:38 +01:00
Thomas Haller
bd9479cc1a platform: swap _LOG2t() and _LOG2T() macros
To be consistent with _LOGT()/_LOGt() and consistent with _LOG2D().
The upper cased macro logs always, the lower cased macro is disabled
by default.
2016-02-05 10:48:05 +01:00
Thomas Haller
bd17fc6d24 platform: assume support for IPv6 temporary addrsses if detection fails
We detect support for IPv6 temporary addresses (IFA_F_MANAGETEMPADDR) or /64 v6 prefixes
(IFA_F_NOPREFIXROUTE) based on the presence of extended address flags. For the most part
this just works, but it fails down if upon initialization no addresses are present.

In such a case we would have assumed no support. Change that to default to available
support as the feature is already 2 years in upstream kernel.
2016-02-04 18:04:43 +01:00
Thomas Haller
e58b3dac80 contrib/rpm: wrap long description lines
rpmlint warns description-line-too-long if the line exceeds 79 characters.
2016-02-04 18:04:43 +01:00
Thomas Haller
0661f66c40 contrib/rpm: minor cleanup 2016-02-04 17:59:05 +01:00
Thomas Haller
35c120ee15 doc: update CONTRIBUTING to no longer allow // FIXME comments
Most of our FIXME/TODO comments are already (rightly) /**/.
Just get rid of this non-obvious inconsistancy in our coding
style.
2016-02-04 17:59:05 +01:00
Beniamino Galvani
b5a469a894 device: check nm_ip6_config_get_address_first_nontentative() argument
Since commit 9ff161b2a1 ("device: move have_ip6_address() to
nm_ip6_config_get_address_first_nontentative()") the IP configuration
argument of nm_ip6_config_get_address_first_nontentative() must be
non-NULL. Add checks where needed.

Fixes: 9ff161b2a1
2016-02-03 17:54:12 +01:00
Thomas Haller
05b34e11d6 contrib/rpm: update comment in 00-server.conf 2016-02-03 16:25:19 +01:00
Thomas Haller
b4d1e3eb7b contrib/rpm: remove unneeded chkconfig and systemd-sysv requirements 2016-02-03 16:19:02 +01:00
Thomas Haller
5344a3297b contrib/rpm: remove unused 10-ibft-plugin.conf file
Fixes: 6f0036151f
2016-02-03 15:57:58 +01:00
Thomas Haller
6490dc154c contrib/rpm: add rpm_version in spec file
and rename realversion to real_version to follow the pattern.
2016-02-03 15:47:28 +01:00
Thomas Haller
455b981215 contrib/rpm: update comment for patches in spec file
We don't want to create backups of original files when
patching. Update the comment in the spec file to indicate
that.
2016-02-03 15:42:19 +01:00
Thomas Haller
e6244814eb nmtst: add nmtst_add_test_func() helper to schedule tests with arguments 2016-02-03 15:27:52 +01:00
Thomas Haller
9fda0817ab nmtst: don't use G_STRLOC in test functions
Instead pass separate values for file and line. Otherwise, we create
a unique string for each occurance.
2016-02-03 13:34:38 +01:00
Thomas Haller
123747963a nmtst: improve test macros FAIL() and ASSERT()
Fail only printed a message to stderr and exited.
Instead, print it with g_error(), which also breaks
in the debugger and produces a core-dump.

Also, it constructed the message based on an unchecked
format string and constructed a format string dynamically.
Just don't do that.

Also add a comment that these macros are discouraged because
they are cumbersome to write (requiring a test-name and a failure
message).
2016-02-03 12:41:35 +01:00
Thomas Haller
c510323368 all/tests: fix messages for ASSERT() macro
These places pass an invalid arguments for the given
format string. Fix them, by dropping the overly verbose
ASSERT() macro.
2016-02-03 12:37:43 +01:00
Jiří Klimeš
0f4ddf7882 po: update translations for "m[monitor]" -> "m[onitor]" change 2016-02-03 10:16:24 +01:00
Jiří Klimeš
1351b852f5 cli: fix nmcli help for 'monitor' command 2016-02-03 10:04:47 +01:00
Jiří Klimeš
3cb3fedef8 vpn-plugin-info: add description for @filename parameter 2016-02-03 09:58:16 +01:00
Thomas Haller
87dc14476b contrib/rpm: make build more configurable by using conditionals
Also add a new conditional "debug" to enable more assertions and
more logging, which is disabled by default.

Also add a conditional "test" to disable running the unit tests
(make check) while building the package.

http://rpm.org/wiki/PackagerDocs/ConditionalBuilds
2016-02-02 16:09:24 +01:00
Thomas Haller
3b01d25561 contrib/rpm: add --no-build option to build_clean.sh
Option to skip building the source package. Useful if you already
have a source tarball from a previous run.
2016-02-02 16:05:23 +01:00
Thomas Haller
a75f358be5 device: merge branch 'th/device-ext-ip6-config-captured-bgo761371'
https://bugzilla.gnome.org/show_bug.cgi?id=761371
2016-02-02 11:53:44 +01:00
Thomas Haller
118a75fcde device: check ext_ip6_config_captured for ll_addr in dhcp6_start_with_link_ready()
We should not check ip6_config for the link local address because
ip6_config contains the merged settings we want to configure,
not the addresses that are actually configured on the device.
Check ext_ip6_config_captured for that.

Also, reuse nm_ip6_config_get_address_first_nontentative() which
only takes an address after it survived DAD.
2016-02-02 11:43:57 +01:00
Thomas Haller
9ff161b2a1 device: move have_ip6_address() to nm_ip6_config_get_address_first_nontentative() 2016-02-02 11:43:57 +01:00
Thomas Haller
5ff8decb8f device: add ext_ip6_config_captured to remember the last-read platform configuration
ext_ip6_config gets modified to only contain items that are configured
externally, not by internal choice.
2016-02-02 11:43:57 +01:00
Thomas Haller
dfdce13cee core: add nm_ip6_config_new_cloned() function 2016-02-02 11:43:54 +01:00