Commit Graph

15047 Commits

Author SHA1 Message Date
Thomas Haller
e663b88c59 all/trivial: rename STRLEN() macro to NM_STRLEN()
We should not have defines/macros in header files without a nm/NM
prefix. STRLEN() was one of the few offenders.

https://mail.gnome.org/archives/networkmanager-list/2016-February/msg00048.html
2016-02-14 11:34:42 +01:00
Thomas Haller
afaa27ddbb libnm/keyfile/trivial: rename VPN_SECRETS_GROUP define to NM_KEYFILE_GROUP_VPN_SECRETS
It is a define from an internal header. Still, all defines in headers
should be named with a NM prefix.
2016-02-14 11:14:35 +01:00
Beniamino Galvani
b9bb1c793d device/vlan: check existence of ip6 configuration before reapplying it
The connection might not have an ipv6 configuration, check for this
before calling nm_device_reactivate_ip6_config().

Fixes: 45b77dbcfc

https://bugzilla.redhat.com/show_bug.cgi?id=1307070
2016-02-12 17:22:21 +01:00
Thomas Haller
89e806e1a6 systemd: don't use <uchar.h>
Not around on Ubuntu 12.04. Define the char16_t and char32_t types
ourselves.

Fixes: 2835934244
2016-02-12 17:03:28 +01:00
Thomas Haller
7ec5acdc66 travis: fix setting NMTST_DEBUG for travis-check.sh script 2016-02-12 16:54:40 +01:00
Lubomir Rintel
868e1ddc07 cli: remove some dead code
Coverity points out.
2016-02-12 15:48:12 +01:00
Lubomir Rintel
ace8d96bed test: assert that the signal connection succeeds properly
0 is not success and negative can not happen, as Coverity points out.
2016-02-12 15:48:12 +01:00
Lubomir Rintel
d9218f6074 device: warn if we couldn't reapply the ip configuration
Coverity is suspicious and rightly so.
2016-02-12 15:48:12 +01:00
Lubomir Rintel
86a0a14687 test: avoid assert with side effect
Not a real problem, but makes Coverity uncomfortable.
2016-02-12 15:48:12 +01:00
Thomas Haller
2c2d9d2e4c build: cleanup default includes
- "gsystem-local-alloc.h" and <gio/gio.h> are already included via
  "nm-default.h". No need to include them separately.

- include "nm-macros-internal.h" via "nm-default.h" and drop all
  explict includes.

- in the modified files, ensure that we always include "config.h"
  and "nm-default.h" first. As second, include the header file
  for the current source file (if applicable). Then follow external
  includes and finally internal nm includes.

- include nm headers inside source code files with quotes

- internal header files don't need to include default headers.
  They can savely assume that "nm-default.h" is already included
  and with it glib, nm-glib.h, nm-macros-internal.h, etc.
2016-02-12 15:36:01 +01:00
Beniamino Galvani
97be12b662 platform: always try to refetch new ethernet links
Due to a kernel bug [1], we sometimes receive spurious NEWLINK
messages after a wifi interface has disappeared. Since the link is not
present anymore we can't determine its type and thus it will show up
as a Ethernet one, with no address specified.  Request the link again
to check if it really exists.

[1] https://bugzilla.redhat.com/show_bug.cgi?id=1302037

https://bugzilla.gnome.org/show_bug.cgi?id=761151
2016-02-12 14:41:56 +01:00
Thomas Haller
fa8c0877ce trivial: fix spelling in comment 2016-02-12 14:26:54 +01:00
Beniamino Galvani
0bfe70c574 cli: remove unused NMC_FIELDS_SETTING_*_COMMON defines 2016-02-12 13:46:12 +01:00
Beniamino Galvani
b3401bf921 device: add nm_device_get_applied_setting() 2016-02-12 13:46:12 +01:00
Thomas Haller
ac97715688 contrib/rpm: create dnsmasq-shared.d configuration directory 2016-02-12 13:01:53 +01:00
Thomas Haller
d4479a9b10 coding-style: remove unnecessary braces 2016-02-12 13:01:53 +01:00
chrysn
a94fb97763 core: include dnsmasq config files in shared connections
The dnsmasq process started as DHCP and DNS server for shared
connections now accepts additional configuration files at
/etc/NetworkManager/dnsmasq-shared.d/.

https://bugzilla.gnome.org/show_bug.cgi?id=761717
2016-02-12 13:01:34 +01:00
Thomas Haller
2835934244 systemd: merge branch 'systemd' into master 2016-02-12 11:14:26 +01:00
Thomas Haller
1a716a7cd2 systemd: update code from upstream
This is a direct dump from systemd git on 2016-02-11, git commit
95adafc428b5b4be0ddd4d43a7b96658390388bc (v229).

======

SYSTEMD_DIR=../systemd
COMMIT=95adafc428b5b4be0ddd4d43a7b96658390388bc

(
  cd "$SYSTEMD_DIR"
  git checkout "$COMMIT"
  git reset --hard
  git clean -fdx
)

git ls-files :/src/systemd/src/ | xargs -d '\n' rm -f

nm_copy_sd() {
    mkdir -p "./src/systemd/$(dirname "$1")"
    cp "$SYSTEMD_DIR/$1" "./src/systemd/$1"
}

nm_copy_sd "src/basic/alloc-util.c"
nm_copy_sd "src/basic/alloc-util.h"
nm_copy_sd "src/basic/async.h"
nm_copy_sd "src/basic/escape.c"
nm_copy_sd "src/basic/escape.h"
nm_copy_sd "src/basic/fileio.c"
nm_copy_sd "src/basic/fileio.h"
nm_copy_sd "src/basic/fd-util.c"
nm_copy_sd "src/basic/fd-util.h"
nm_copy_sd "src/basic/fs-util.c"
nm_copy_sd "src/basic/fs-util.h"
nm_copy_sd "src/basic/hash-funcs.c"
nm_copy_sd "src/basic/hash-funcs.h"
nm_copy_sd "src/basic/hashmap.c"
nm_copy_sd "src/basic/hashmap.h"
nm_copy_sd "src/basic/hexdecoct.c"
nm_copy_sd "src/basic/hexdecoct.h"
nm_copy_sd "src/basic/hostname-util.c"
nm_copy_sd "src/basic/hostname-util.h"
nm_copy_sd "src/basic/in-addr-util.c"
nm_copy_sd "src/basic/in-addr-util.h"
nm_copy_sd "src/basic/io-util.c"
nm_copy_sd "src/basic/io-util.h"
nm_copy_sd "src/basic/list.h"
nm_copy_sd "src/basic/log.h"
nm_copy_sd "src/basic/macro.h"
nm_copy_sd "src/basic/mempool.h"
nm_copy_sd "src/basic/mempool.c"
nm_copy_sd "src/basic/parse-util.c"
nm_copy_sd "src/basic/parse-util.h"
nm_copy_sd "src/basic/path-util.c"
nm_copy_sd "src/basic/path-util.h"
nm_copy_sd "src/basic/prioq.h"
nm_copy_sd "src/basic/prioq.c"
nm_copy_sd "src/basic/random-util.c"
nm_copy_sd "src/basic/random-util.h"
nm_copy_sd "src/basic/refcnt.h"
nm_copy_sd "src/basic/set.h"
nm_copy_sd "src/basic/siphash24.c"
nm_copy_sd "src/basic/siphash24.h"
nm_copy_sd "src/basic/socket-util.h"
nm_copy_sd "src/basic/sparse-endian.h"
nm_copy_sd "src/basic/stdio-util.h"
nm_copy_sd "src/basic/string-table.c"
nm_copy_sd "src/basic/string-table.h"
nm_copy_sd "src/basic/string-util.c"
nm_copy_sd "src/basic/string-util.h"
nm_copy_sd "src/basic/strv.c"
nm_copy_sd "src/basic/strv.h"
nm_copy_sd "src/basic/time-util.c"
nm_copy_sd "src/basic/time-util.h"
nm_copy_sd "src/basic/umask-util.h"
nm_copy_sd "src/basic/unaligned.h"
nm_copy_sd "src/basic/utf8.c"
nm_copy_sd "src/basic/utf8.h"
nm_copy_sd "src/basic/util.c"
nm_copy_sd "src/basic/util.h"
nm_copy_sd "src/libsystemd-network/arp-util.c"
nm_copy_sd "src/libsystemd-network/arp-util.h"
nm_copy_sd "src/libsystemd-network/dhcp6-internal.h"
nm_copy_sd "src/libsystemd-network/dhcp6-lease-internal.h"
nm_copy_sd "src/libsystemd-network/dhcp6-network.c"
nm_copy_sd "src/libsystemd-network/dhcp6-option.c"
nm_copy_sd "src/libsystemd-network/dhcp6-protocol.h"
nm_copy_sd "src/libsystemd-network/dhcp-identifier.c"
nm_copy_sd "src/libsystemd-network/dhcp-identifier.h"
nm_copy_sd "src/libsystemd-network/dhcp-internal.h"
nm_copy_sd "src/libsystemd-network/dhcp-lease-internal.h"
nm_copy_sd "src/libsystemd-network/dhcp-network.c"
nm_copy_sd "src/libsystemd-network/dhcp-option.c"
nm_copy_sd "src/libsystemd-network/dhcp-packet.c"
nm_copy_sd "src/libsystemd-network/dhcp-protocol.h"
nm_copy_sd "src/libsystemd-network/lldp.h"
nm_copy_sd "src/libsystemd-network/lldp-internal.h"
nm_copy_sd "src/libsystemd-network/lldp-internal.c"
nm_copy_sd "src/libsystemd-network/lldp-network.h"
nm_copy_sd "src/libsystemd-network/lldp-network.c"
nm_copy_sd "src/libsystemd-network/lldp-port.c"
nm_copy_sd "src/libsystemd-network/lldp-port.h"
nm_copy_sd "src/libsystemd-network/lldp-tlv.c"
nm_copy_sd "src/libsystemd-network/lldp-tlv.h"
nm_copy_sd "src/libsystemd-network/network-internal.c"
nm_copy_sd "src/libsystemd-network/network-internal.h"
nm_copy_sd "src/libsystemd-network/sd-dhcp6-client.c"
nm_copy_sd "src/libsystemd-network/sd-dhcp6-lease.c"
nm_copy_sd "src/libsystemd-network/sd-dhcp-client.c"
nm_copy_sd "src/libsystemd-network/sd-dhcp-lease.c"
nm_copy_sd "src/libsystemd-network/sd-ipv4ll.c"
nm_copy_sd "src/libsystemd-network/sd-ipv4acd.c"
nm_copy_sd "src/libsystemd-network/sd-lldp.c"
nm_copy_sd "src/libsystemd/sd-id128/sd-id128.c"
nm_copy_sd "src/shared/dns-domain.c"
nm_copy_sd "src/shared/dns-domain.h"
nm_copy_sd "src/systemd/_sd-common.h"
nm_copy_sd "src/systemd/sd-dhcp6-client.h"
nm_copy_sd "src/systemd/sd-dhcp6-lease.h"
nm_copy_sd "src/systemd/sd-dhcp-client.h"
nm_copy_sd "src/systemd/sd-dhcp-lease.h"
nm_copy_sd "src/systemd/sd-event.h"
nm_copy_sd "src/systemd/sd-ndisc.h"
nm_copy_sd "src/systemd/sd-id128.h"
nm_copy_sd "src/systemd/sd-ipv4acd.h"
nm_copy_sd "src/systemd/sd-ipv4ll.h"
nm_copy_sd "src/systemd/sd-lldp.h"
2016-02-12 10:47:07 +01:00
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