NetworkManager.git
8 years agoplatform: add nmp_netns_bind_to_path() helper function
Thomas Haller [Tue, 8 Mar 2016 12:08:21 +0000 (13:08 +0100)]
platform: add nmp_netns_bind_to_path() helper function

Based-on-patch-by: Stjepan Gros <stjepan.gros@gmail.com>
8 years agoplatform: support switching partial namespaces
Thomas Haller [Mon, 14 Mar 2016 13:20:33 +0000 (14:20 +0100)]
platform: support switching partial namespaces

Previously, the push/pop API to switch between namespaces would always
switch both the net and mount namespace together.

There are situations, where we want to only switch one namespace.
For example, the function nmp_netns_bind_to_path() introduced next
only wants to switch the net namespace to get /proc/self/ns/net,
but must not switch the mount namespace as it bind-mounds in the
namespace of the caller.

8 years agoplatform/tests: add test for nm_platform_link_set_netns()
Thomas Haller [Mon, 14 Mar 2016 14:44:01 +0000 (15:44 +0100)]
platform/tests: add test for nm_platform_link_set_netns()

8 years agoplatform/tests: pass platform argument to nmtstp helper functions
Thomas Haller [Mon, 14 Mar 2016 14:23:05 +0000 (15:23 +0100)]
platform/tests: pass platform argument to nmtstp helper functions

Make the test helper independent from the platform singleton instance.
That way, we can also use them for other platform instances (e.g. in a
different namespace).

8 years agoplatform: add nm_platform_link_set_netns() function
Stjepan Gros [Tue, 8 Mar 2016 12:02:58 +0000 (13:02 +0100)]
platform: add nm_platform_link_set_netns() function

[thaller@redhat.com: cherry-picked original patch and modified
  slightly]

8 years agoplatform/tests: refactor creation of test_netns_general()
Thomas Haller [Mon, 14 Mar 2016 14:08:42 +0000 (15:08 +0100)]
platform/tests: refactor creation of test_netns_general()

Need to add more then one netns test.

8 years agoutils: inject platform into nm_utils_complete_generic()
Thomas Haller [Tue, 8 Mar 2016 12:57:20 +0000 (13:57 +0100)]
utils: inject platform into nm_utils_complete_generic()

8 years agoroute-manager: make NMRouteManager namespace aware
Thomas Haller [Tue, 8 Mar 2016 13:09:41 +0000 (14:09 +0100)]
route-manager: make NMRouteManager namespace aware

8 years agodefault-route-manager: make NMDefaultRouteManager namespace aware
Thomas Haller [Tue, 8 Mar 2016 12:43:40 +0000 (13:43 +0100)]
default-route-manager: make NMDefaultRouteManager namespace aware

8 years agodefault-route-manager: use explict platform instance instead of NM_PLATFORM_GET singleton
Thomas Haller [Tue, 8 Mar 2016 12:42:05 +0000 (13:42 +0100)]
default-route-manager: use explict platform instance instead of NM_PLATFORM_GET singleton

8 years agordisc: make NMRDisc namespace aware
Thomas Haller [Tue, 8 Mar 2016 12:11:36 +0000 (13:11 +0100)]
rdisc: make NMRDisc namespace aware

8 years agordisc/trivial: adjust indention in nm_rdisc_class_init()
Thomas Haller [Tue, 8 Mar 2016 12:15:28 +0000 (13:15 +0100)]
rdisc/trivial: adjust indention in nm_rdisc_class_init()

8 years agoplatform: add defines for "/proc/self/ns/" paths
Thomas Haller [Tue, 8 Mar 2016 12:07:59 +0000 (13:07 +0100)]
platform: add defines for "/proc/self/ns/" paths

8 years agoplatform: properly change netns in do_change_link()
Thomas Haller [Tue, 8 Mar 2016 12:02:09 +0000 (13:02 +0100)]
platform: properly change netns in do_change_link()

8 years agonmtst: add NMTST_DEBUG option "D"
Thomas Haller [Mon, 14 Mar 2016 13:23:30 +0000 (14:23 +0100)]
nmtst: add NMTST_DEBUG option "D"

8 years agosystemd: fall back to CLOCK_MONOTONIC
Lubomir Rintel [Tue, 15 Mar 2016 11:53:19 +0000 (12:53 +0100)]
systemd: fall back to CLOCK_MONOTONIC

https://github.com/systemd/systemd/pull/2843

8 years agoocd: style fix
Lubomir Rintel [Tue, 15 Mar 2016 08:18:16 +0000 (09:18 +0100)]
ocd: style fix

8 years agoifupdown: style fixes
Lubomir Rintel [Tue, 15 Mar 2016 08:18:01 +0000 (09:18 +0100)]
ifupdown: style fixes

8 years agoifnet: fix error handling
Lubomir Rintel [Mon, 14 Mar 2016 16:27:25 +0000 (17:27 +0100)]
ifnet: fix error handling

Oh my.

8 years agoifnet: fix a possible NULL dereference
Lubomir Rintel [Mon, 14 Mar 2016 16:19:38 +0000 (17:19 +0100)]
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.

8 years agonmp-netns: fix error handling
Lubomir Rintel [Mon, 14 Mar 2016 16:09:11 +0000 (17:09 +0100)]
nmp-netns: fix error handling

GError is not used, the error branch would always result in NULL dereference.

Also, check for the result being zero for clarity -- it's the only allowed
success indication.

CID 75365 (#3 of 3): Explicit null dereferenced (FORWARD_NULL)
12. var_deref_op: Dereferencing null pointer error.

8 years agocli: fix memory leak in connection listing
Beniamino Galvani [Mon, 14 Mar 2016 14:05:28 +0000 (15:05 +0100)]
cli: fix memory leak in connection listing

8 years agoifupdown: fix up a bad rebase
Lubomir Rintel [Mon, 14 Mar 2016 15:39:43 +0000 (16:39 +0100)]
ifupdown: fix up a bad rebase

Fixes: 0cb45af97761e47d97c8f76346f7f1bef46ce2cb

8 years agonm-object: delay object property completion until the objects are initialized
Lubomir Rintel [Thu, 10 Mar 2016 18:22:20 +0000 (19:22 +0100)]
nm-object: delay object property completion until the objects are initialized

We don't want to update the properties until the objects referred are complete.
Otherwise the clients get confused. Very confused:

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

We already delay the notification signals. Let's replace that with delaying the
actual ObjectCreatedData processing instead.

8 years agoifupdown: set wireless mode
Lubomir Rintel [Mon, 14 Mar 2016 12:42:43 +0000 (13:42 +0100)]
ifupdown: set wireless mode

8 years agoifupdown: ssid is now GBytes for quite some time
Lubomir Rintel [Mon, 14 Mar 2016 12:14:12 +0000 (13:14 +0100)]
ifupdown: ssid is now GBytes for quite some time

Fixes: c43f88907be66f8f62a8edbe76ae2aec4ff61190

8 years agoifupdown: wireless-essid is good too
Lubomir Rintel [Mon, 14 Mar 2016 11:46:08 +0000 (12:46 +0100)]
ifupdown: wireless-essid is good too

8 years agoifupdown: don't remove the object in its constructor
Lubomir Rintel [Mon, 14 Mar 2016 11:36:54 +0000 (12:36 +0100)]
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.

8 years agoifupdown: drop a bogus warning
Lubomir Rintel [Mon, 14 Mar 2016 12:48:47 +0000 (13:48 +0100)]
ifupdown: drop a bogus warning

The key might be a wireless setting that has already been processed, not a
wireless-security setting.

8 years agocontrib/rpm: with-udev-dir now has a sensible default
Lubomir Rintel [Mon, 14 Mar 2016 15:12:04 +0000 (16:12 +0100)]
contrib/rpm: with-udev-dir now has a sensible default

8 years agobuild: install udev files under prefix
Lubomir Rintel [Mon, 14 Mar 2016 12:49:58 +0000 (13:49 +0100)]
build: install udev files under prefix

It should really be in /usr/lib, not /lib. Not a real issue, since the two are
usually links, but the latter is supposably for compatibility only. This also
installs into correct place when configured with a different --prefix.

8 years agotests: fix test-networkmanager-service.py for Python 3 incompatibility
Jan Tojnar [Sun, 13 Mar 2016 12:11:07 +0000 (13:11 +0100)]
tests: fix test-networkmanager-service.py for Python 3 incompatibility

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

8 years agoshared: add nm_g_object_ref() and nm_g_object_unref() function
Thomas Haller [Sat, 12 Mar 2016 14:38:53 +0000 (15:38 +0100)]
shared: add nm_g_object_ref() and nm_g_object_unref() function

8 years agowifi: hack for wext devices reporting IW_MODE_AUTO configuration mode.
Francesco Giudici [Fri, 11 Mar 2016 08:55:39 +0000 (09:55 +0100)]
wifi: hack for wext devices reporting IW_MODE_AUTO configuration mode.

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

8 years agosession-monitor/trivial: rename local functions for unique prefix
Thomas Haller [Fri, 11 Mar 2016 10:11:58 +0000 (11:11 +0100)]
session-monitor/trivial: rename local functions for unique prefix

Don't use a "sd_" prefix for our local functions because
then it's not immediately clear which functions are ours
and which are from systemd-logind. Just rename them to have
a "st_sd_*" prefix ("st" like "session tracking").

8 years agosystemd: split "nm-sd.h" out of "nm-sd-adapt.h"
Thomas Haller [Fri, 11 Mar 2016 09:25:40 +0000 (10:25 +0100)]
systemd: split "nm-sd.h" out of "nm-sd-adapt.h"

Now we have:

"nm-sd.h" is a header file of NetworkManager with utilities
related to systemd. It can be used anywhere freely.

Also, systemd headers that are considered public API (like
"sd-event.h") can be used without restrictions.

When compiling the systemd sources, we always must include
"nm-sd-adapt.h" as first. Similarly, systemd headers must
not include "nm-sd-adapt.h", because they are either public
(in which case the adapter is not needed) or they are internal
(in which case they are themself included via a systemd source).

Sometimes, we must internal API (like "dhcp-lease-internal.h").
In this case, we also must include "nm-sd-adapt.h".

8 years agosystemd: merge branch 'th/systemd-lldp-bgo763384' into master
Thomas Haller [Tue, 26 Jan 2016 16:22:54 +0000 (17:22 +0100)]
systemd: merge branch 'th/systemd-lldp-bgo763384' into master

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

8 years agosystemd: integrate sd-event into glib main loop
Thomas Haller [Wed, 9 Mar 2016 11:27:56 +0000 (12:27 +0100)]
systemd: integrate sd-event into glib main loop

We should not try to reimplement sd-event based on glib,
instead we should hook sd-event into the glib mainloop.

8 years agosystemd: merge branch systemd into th/systemd-lldp-bgo763384
Thomas Haller [Mon, 29 Feb 2016 13:30:15 +0000 (14:30 +0100)]
systemd: merge branch systemd into th/systemd-lldp-bgo763384

As the lldp API changed, adjust "nm-lldp-listener.c".

Note that the commit is not yet functional due to missing
sd_event_source_set_enabled() and sd_event_source_set_time().

8 years agolldp: merge branch 'th/lldp-tests'
Thomas Haller [Thu, 10 Mar 2016 16:25:11 +0000 (17:25 +0100)]
lldp: merge branch 'th/lldp-tests'

8 years agolldp/tests: add test for ttl
Thomas Haller [Thu, 10 Mar 2016 15:32:34 +0000 (16:32 +0100)]
lldp/tests: add test for ttl

8 years agolldp/tests: use nmtst_main_loop_run()
Thomas Haller [Thu, 10 Mar 2016 15:38:07 +0000 (16:38 +0100)]
lldp/tests: use nmtst_main_loop_run()

8 years agolldp/tests: add a test with another lldp frame
Thomas Haller [Thu, 10 Mar 2016 14:18:44 +0000 (15:18 +0100)]
lldp/tests: add a test with another lldp frame

8 years agolldp/tests: refactor checking for lldp neighbors
Thomas Haller [Thu, 10 Mar 2016 13:31:04 +0000 (14:31 +0100)]
lldp/tests: refactor checking for lldp neighbors

Also assert against the number of properties in the attributes
and explicitly assert against the values of chassis-id-type,
port-id-type, and system-description.

8 years agolldp/tests: refactor tests to run receive different frames
Thomas Haller [Thu, 10 Mar 2016 11:33:28 +0000 (12:33 +0100)]
lldp/tests: refactor tests to run receive different frames

8 years agolldp/tests/trivial: some renaming and moving of code
Thomas Haller [Thu, 10 Mar 2016 11:26:02 +0000 (12:26 +0100)]
lldp/tests/trivial: some renaming and moving of code

8 years agolldp: fix name of NM_LLDP_ATTR_IEEE_802_1_VID string
Thomas Haller [Thu, 10 Mar 2016 15:24:48 +0000 (16:24 +0100)]
lldp: fix name of NM_LLDP_ATTR_IEEE_802_1_VID string

Fixes: 07a9364d9c151bc3086a863759d31d0857ae011e

8 years agonmtst: add nmtst_main_loop_quit_on_notify function
Thomas Haller [Thu, 10 Mar 2016 15:46:30 +0000 (16:46 +0100)]
nmtst: add nmtst_main_loop_quit_on_notify function

8 years agonmtst: add nmtst_assert_variant_*() helper macros
Thomas Haller [Thu, 10 Mar 2016 13:40:39 +0000 (14:40 +0100)]
nmtst: add nmtst_assert_variant_*() helper macros

8 years agoall/tests: fix tests after adjusting glib logging level
Thomas Haller [Thu, 10 Mar 2016 12:57:45 +0000 (13:57 +0100)]
all/tests: fix tests after adjusting glib logging level

Fixes: b49322b568725c8c92c0732b14cc726748ec57d3

8 years agokeyfile/tests: remove trailing space from test name
Thomas Haller [Thu, 10 Mar 2016 12:54:39 +0000 (13:54 +0100)]
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.

8 years agologging: use non-fatal logging level for glib backend
Thomas Haller [Thu, 10 Mar 2016 10:15:32 +0000 (11:15 +0100)]
logging: use non-fatal logging level for glib backend

In our usage of glib logging, every g_critical()/g_return*()/g_warning()
is considered a bug. They must not occur in a regular program run,
so that we can run NetworkManager with G_DEBUG=fatal-warnings.

On the other hand, all nm_log() statements (even with severity <error>)
are valid conditions that can occur at runtime.

As a consequence, when nm-logging uses glib as backend, we must not use
G_LOG_LEVEL_WARNING level. Otherwise

  $ /usr/sbin/NetworkManager --debug --g-fatal-warnings

will dump core on the message

  "<warn> glib-version: cannot handle SIGUSR1 and SIGUSR2 signals. Consider upgrading glib to 2.36.0 or newer"

Thereby, downgrade the glib level for "<info>" to G_LOG_LEVEL_INFO.

8 years agocli: prefer 'modify' over 'monitor' when the command is abbreviated
Beniamino Galvani [Thu, 10 Mar 2016 09:18:41 +0000 (10:18 +0100)]
cli: prefer 'modify' over 'monitor' when the command is abbreviated

In previous releases 'nmcli connection m' was interpreted as 'modify',
but recently the monitor command was introduced with a higher
priority, changing the behavior when the abbreviated form is
used.

Restore the old behavior.

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

8 years agolibnm-core: fix memory leak in nm-setting-ip-tunnel.c
Beniamino Galvani [Wed, 9 Mar 2016 22:16:20 +0000 (23:16 +0100)]
libnm-core: fix memory leak in nm-setting-ip-tunnel.c

Fixes: ae8c7a8967c6f91aeeea75a37cd3d14bf0edb67d

8 years agodevice: trivial: group all forward declarations of static functions
Beniamino Galvani [Wed, 9 Mar 2016 14:04:11 +0000 (15:04 +0100)]
device: trivial: group all forward declarations of static functions

8 years agosystemd: update code from upstream
Thomas Haller [Mon, 7 Mar 2016 13:50:08 +0000 (14:50 +0100)]
systemd: update code from upstream

This is a direct dump from systemd git on 2016-03-07, git commit
280d397ab313b647fbd824d1cb58eb8323c74501.

======

SYSTEMD_DIR=../systemd
COMMIT=280d397ab313b647fbd824d1cb58eb8323c74501

(
  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/ether-addr-util.c"
nm_copy_sd "src/basic/ether-addr-util.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.c"
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-neighbor.c"
nm_copy_sd "src/libsystemd-network/lldp-neighbor.h"
nm_copy_sd "src/libsystemd-network/lldp-network.c"
nm_copy_sd "src/libsystemd-network/lldp-network.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-event/sd-event.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"

8 years agobuild: compile with -Wno-duplicate-decl-specifier
Thomas Haller [Wed, 9 Mar 2016 10:17:36 +0000 (11:17 +0100)]
build: compile with -Wno-duplicate-decl-specifier

Duplicated const specifiers are allowed by C99 and can easily
happen in macros. Also, systemd's interal code will use them.

Disable this warning, it doesn't seem useful.

8 years agoman: update version number and dates in manual pages
Beniamino Galvani [Wed, 9 Mar 2016 09:07:38 +0000 (10:07 +0100)]
man: update version number and dates in manual pages

Bump NM version number to 1.2 and add the project name to non-XML
pages. Also, update the dates to the date of the last non-trivial
change and update their format to YYYY-MM-DD, as specified by 'man
man-pages'.

8 years agomanager: fix assumption of child connections with autoconnect=no
Beniamino Galvani [Tue, 8 Mar 2016 11:02:54 +0000 (12:02 +0100)]
manager: fix assumption of child connections with autoconnect=no

During startup, when a link is detected (enp0s25 in the example below)
we try to create also virtual devices (ipip1) on it through
system_create_virtual_device(), however this realizes only devices for
connections which can autoactivate.

To support the assumption of child devices with autoconnect=no, we
should take in consideration in retry_connections_for_parent_device()
only connections for which the link does not exist, and let existing
links be handled by platform_link_added(), which also realizes them.

Reproducer:
 $ nmcli c add type ip-tunnel ifname ipip1 con-name ipip1+ autoconnect no \
               mode ipip remote 172.25.16.1 dev enp0s25 ip4 1.2.3.4/31
 $ nmcli c up ipip1+
 $ systemctl restart NetworkManager

Result:
 * before: ipip1+ is not assumed, ipip1 is not present in 'nmcli d' output
 * after:  ipip1+ is assumed, ipip1 detected

8 years agobuild: add a missing file to distribution
Lubomir Rintel [Tue, 8 Mar 2016 18:30:36 +0000 (19:30 +0100)]
build: add a missing file to distribution

8 years agoall: drop str_if_set() in favor of the "?:" operator
Thomas Haller [Tue, 8 Mar 2016 16:41:31 +0000 (17:41 +0100)]
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.

8 years agobuild: hide internal symbols in NetworkManager binary
Thomas Haller [Tue, 8 Mar 2016 16:21:22 +0000 (17:21 +0100)]
build: hide internal symbols in NetworkManager binary

We must export some symbols from NetworkManager binary so that
the device plugins can function. However, many symbols are truly
private and must not be exposed.

Especially, our internal clone of the systemd ABI must be hidden
to avoid resolution conflicts when loading any external systemd
libraries.

8 years agocore/trivial: rename NM_ASSERT_VALID_PATH_COMPONENT() helper
Thomas Haller [Tue, 8 Mar 2016 16:35:41 +0000 (17:35 +0100)]
core/trivial: rename NM_ASSERT_VALID_PATH_COMPONENT() helper

All defines from header files must have a NM prefix.

8 years agoall: fix a couple more gvariant iteration leaks
Lubomir Rintel [Tue, 8 Mar 2016 15:45:25 +0000 (16:45 +0100)]
all: fix a couple more gvariant iteration leaks

8 years agopo: update Polish (pl) translation (bgo #763327)
Piotr Drąg [Tue, 8 Mar 2016 15:35:39 +0000 (16:35 +0100)]
po: update Polish (pl) translation (bgo #763327)

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

8 years agonm-object: don't leak the properties on changed signals
Lubomir Rintel [Tue, 8 Mar 2016 15:02:27 +0000 (16:02 +0100)]
nm-object: don't leak the properties on changed signals

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

8 years agodevice: fix leaking GSList element in _replace_vpn_config_in_list()
Thomas Haller [Tue, 8 Mar 2016 09:26:27 +0000 (10:26 +0100)]
device: fix leaking GSList element in _replace_vpn_config_in_list()

Fixes: 9bbf5e94c2ff676f685a7740713140026efbcb7c

8 years agodevice: don't assert the presence of old vpn configurations
Beniamino Galvani [Mon, 7 Mar 2016 17:14:30 +0000 (18:14 +0100)]
device: don't assert the presence of old vpn configurations

When a VPN connection is active and the parent device becomes
unmanaged (due to device removal or system entering sleep), all
configurations are removed from the interface and the device is taken
down. After that, the VPN is disconnected and tries to remove the old
VPN configuration from device, causing the following assertion to
fail:

  _replace_vpn_config_in_list: assertion '!old' failed

Remove the assertion as @old can be missing for valid reasons.

8 years agoplatform: merge branch 'th/platform-netns-bgo762408'
Thomas Haller [Mon, 7 Mar 2016 11:49:27 +0000 (12:49 +0100)]
platform: merge branch 'th/platform-netns-bgo762408'

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

8 years agoplatform: add network namespace support to platform
Thomas Haller [Fri, 19 Feb 2016 00:06:28 +0000 (01:06 +0100)]
platform: add network namespace support to platform

Add a new NMPNetns class. This allows creation, deletion and
switching of network namespaces. The API only offers push/pop
operations to switch the namespace. This way the API enforces
the user to always restore the previous namespace.

A NMPlatform instance not only uses the netlink socket, but also
sysfs, udev, ethtool, mii. Still, a NMPlatform instance lives
entirely inside one namespace and is not spanning multiple namespaces.
To properly support network namespaces, the platform instance must
switch the namespace as necessary, transparent to the caller.
Udev is only supported in the main namespace.

For now, network namespaces are not actually used and are disabled
via the NM_PLATFORM_NETNS_SUPPORT argument.

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

8 years agoplatform: don't create udev client if udev isn't used
Thomas Haller [Fri, 4 Mar 2016 19:57:07 +0000 (20:57 +0100)]
platform: don't create udev client if udev isn't used

Inside container, where we don't use udev we don't receive
any events from udev client. Thus the client only returns
devices when iterating it initially, but no events for newly
added devices that appear later.

Thus, inside containers we don't want to create a udev client
at all.

8 years agocore: move simple utils function from "nm-platform-utils.h"
Thomas Haller [Mon, 7 Mar 2016 10:45:44 +0000 (11:45 +0100)]
core: move simple utils function from "nm-platform-utils.h"

Most functions defined in "nm-platform-utils.h" perform a lookup
of link properties, for example via ethtool or sysfs. Those functions
depend on the system configuration, such as the current network namespace.

Move the simple helper functions away to "nm-core-internal.h", so that
all remaining functions from "nm-platform-utils.h" are really related to
somthing that interacts with the system/kernel.

8 years agoplatform: add and use nm_utils_ifname_cpy() helper
Thomas Haller [Mon, 7 Mar 2016 10:11:59 +0000 (11:11 +0100)]
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.

8 years agowifi: use g_strlcpy() instead of strncpy() to ensure NUL terminated ifname
Thomas Haller [Sun, 6 Mar 2016 16:16:52 +0000 (17:16 +0100)]
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.

8 years agolibnm-util: remove unneeded check for non-null after dereferencing pointer
Thomas Haller [Sun, 6 Mar 2016 16:06:50 +0000 (17:06 +0100)]
libnm-util: remove unneeded check for non-null after dereferencing pointer

Since commit 01b9b4104c365002fae5e45b564956062fe146d4, we assume
that @error is properly set. No need to check for non-null.
Found by coverity.

8 years agocontrib/rpm: macro cosmetics
Lubomir Rintel [Sat, 5 Mar 2016 16:28:52 +0000 (17:28 +0100)]
contrib/rpm: macro cosmetics

8 years agocontrib/rpm: include the valgrind suppression file in debuginfo package
Lubomir Rintel [Fri, 4 Mar 2016 21:18:24 +0000 (22:18 +0100)]
contrib/rpm: include the valgrind suppression file in debuginfo package

8 years agodevice/ip-tunnel: implement get_generic_capabilities()
Beniamino Galvani [Fri, 4 Mar 2016 20:24:15 +0000 (21:24 +0100)]
device/ip-tunnel: implement get_generic_capabilities()

Since 87a3df2e572e ("device: remove default-unmanaged and refactor
unmanaged flags") the device must properly report the IS_SOFTWARE
capability in order to be potentially activated.

8 years agotest: add missing test file to distribution
Lubomir Rintel [Fri, 4 Mar 2016 19:39:10 +0000 (20:39 +0100)]
test: add missing test file to distribution

Fixes: 9e4abc99e726fc48c5558fef3fa983fe430c35ab

8 years agonmcli: fix check on allowed parameters for slave connections
Francesco Giudici [Tue, 23 Feb 2016 10:56:46 +0000 (11:56 +0100)]
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.

8 years agobus-manager: avoid leaking responses for sync bus calls
Lubomir Rintel [Fri, 4 Mar 2016 18:02:28 +0000 (19:02 +0100)]
bus-manager: avoid leaking responses for sync bus calls

8 years agoifcfg-rh: merge branch 'th/ifcfg-ignore-other'
Thomas Haller [Fri, 4 Mar 2016 17:27:17 +0000 (18:27 +0100)]
ifcfg-rh: merge branch 'th/ifcfg-ignore-other'

8 years agoifcfg-rh: log debug level message when loading of ifcfg file fails for common reasons
Thomas Haller [Fri, 4 Mar 2016 16:53:46 +0000 (17:53 +0100)]
ifcfg-rh: log debug level message when loading of ifcfg file fails for common reasons

8 years agoifcfg-rh: skip loading files for unhandled types due to existing ifup script
Thomas Haller [Fri, 4 Mar 2016 16:48:02 +0000 (17:48 +0100)]
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.

8 years agoifcfg-rh: ignore "sit" connections without explicit TYPE based on IPV6TUNNELIPV4
Thomas Haller [Fri, 4 Mar 2016 15:34:54 +0000 (16:34 +0100)]
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.

8 years agoifcfg-rh/tests/trivial: remove self-explanatory comments
Thomas Haller [Fri, 4 Mar 2016 15:47:14 +0000 (16:47 +0100)]
ifcfg-rh/tests/trivial: remove self-explanatory comments

8 years agonmtst: convert nmtst_assert_error() to a macro to preserve func:line information
Thomas Haller [Fri, 4 Mar 2016 15:46:16 +0000 (16:46 +0100)]
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".

8 years agomerge: branch 'bg/sethostname-hostnamed-rh1308974'
Beniamino Galvani [Fri, 4 Mar 2016 13:33:01 +0000 (14:33 +0100)]
merge: branch 'bg/sethostname-hostnamed-rh1308974'

Use hostnamed to set the transient hostname when possible.

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

8 years agopolicy: move code from set_system_hostname() to _set_hostname()
Beniamino Galvani [Mon, 22 Feb 2016 09:10:15 +0000 (10:10 +0100)]
policy: move code from set_system_hostname() to _set_hostname()

8 years agopolicy: simplify set_system_hostname()
Beniamino Galvani [Mon, 22 Feb 2016 09:01:30 +0000 (10:01 +0100)]
policy: simplify set_system_hostname()

Move some conditionals to the beginning of the function.

8 years agocore: use hostnamed to set the transient hostname
Beniamino Galvani [Thu, 18 Feb 2016 17:19:30 +0000 (18:19 +0100)]
core: use hostnamed to set the transient hostname

In commit 6dc35e66d45e ("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

8 years agoplatform: cleanup logging for udev-add event
Thomas Haller [Fri, 4 Mar 2016 12:19:34 +0000 (13:19 +0100)]
platform: cleanup logging for udev-add event

8 years agologging: merge branch 'bg/logging-messages-bgo763040'
Beniamino Galvani [Fri, 4 Mar 2016 11:06:51 +0000 (12:06 +0100)]
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

8 years agodhcp: client: use logging helpers
Beniamino Galvani [Thu, 3 Mar 2016 09:19:28 +0000 (10:19 +0100)]
dhcp: client: use logging helpers

8 years agodnsmasq-manager: use logging helpers
Beniamino Galvani [Thu, 3 Mar 2016 08:20:34 +0000 (09:20 +0100)]
dnsmasq-manager: use logging helpers

8 years agoppp-manager: use logging helpers
Beniamino Galvani [Thu, 3 Mar 2016 08:20:30 +0000 (09:20 +0100)]
ppp-manager: use logging helpers

8 years agobus-manager: use logging helpers
Beniamino Galvani [Thu, 3 Mar 2016 08:20:26 +0000 (09:20 +0100)]
bus-manager: use logging helpers

8 years agoaudit: use logging helpers
Beniamino Galvani [Thu, 3 Mar 2016 08:20:23 +0000 (09:20 +0100)]
audit: use logging helpers

8 years agopolicy: use logging helpers
Beniamino Galvani [Thu, 3 Mar 2016 08:20:18 +0000 (09:20 +0100)]
policy: use logging helpers

8 years agosupplicant: use logging helpers
Beniamino Galvani [Thu, 3 Mar 2016 08:20:14 +0000 (09:20 +0100)]
supplicant: use logging helpers