NetworkManager.git
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

8 years agosettings: use logging helpers
Beniamino Galvani [Thu, 3 Mar 2016 08:20:10 +0000 (09:20 +0100)]
settings: use logging helpers

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

8 years agodevice: improve logging messages
Beniamino Galvani [Thu, 3 Mar 2016 08:20:00 +0000 (09:20 +0100)]
device: improve logging messages

Add a "device" prefix to the messages.

8 years agodispatcher: use logging helpers
Beniamino Galvani [Thu, 3 Mar 2016 08:19:47 +0000 (09:19 +0100)]
dispatcher: use logging helpers

8 years agodevice/ethernet: fix crash on 802.1x authentication timeout
Beniamino Galvani [Fri, 4 Mar 2016 09:15:32 +0000 (10:15 +0100)]
device/ethernet: fix crash on 802.1x authentication timeout

Fixes the following:
GLib-GObject-WARNING **: invalid cast from 'NMSimpleConnection' to 'NMSettingsConnection'

Fixes: 06da3532428e3498c1e808ff8be1af48b540a6ff

8 years agom4: update introspection.m4 with original file from gobject-introspection
Thomas Haller [Fri, 4 Mar 2016 08:23:44 +0000 (09:23 +0100)]
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 f6272144e98c00db18cf67.

Reimport the file with latest changes, but still preserving our
workaround.

8 years agoall: explicitly ignore return values
Thomas Haller [Fri, 4 Mar 2016 08:02:45 +0000 (09:02 +0100)]
all: explicitly ignore return values

Coverity warns that usually we check for the return value.

8 years agoroute-manager/tests: add assertion for adding route
Thomas Haller [Fri, 4 Mar 2016 07:58:25 +0000 (08:58 +0100)]
route-manager/tests: add assertion for adding route

Not checking the return value is marked by coverity. Just workaround it.

8 years agoroute-manager/tests: add assertion for adding route
Thomas Haller [Fri, 4 Mar 2016 07:58:25 +0000 (08:58 +0100)]
route-manager/tests: add assertion for adding route

Not checking the return value is marked by coverity. Just workaround it.

8 years agolibnm: fix clearing real-devices in NMManager's free_devices()
Thomas Haller [Fri, 4 Mar 2016 07:54:46 +0000 (08:54 +0100)]
libnm: fix clearing real-devices in NMManager's free_devices()

Found by coverity.

8 years agodevice: assert for valid device argument in nm_device_remove_pending_action()
Thomas Haller [Fri, 4 Mar 2016 07:46:51 +0000 (08:46 +0100)]
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        }

8 years agoifcfg-rh/tests: remove call to nm_connection_normalize()
Thomas Haller [Fri, 4 Mar 2016 07:36:13 +0000 (08:36 +0100)]
ifcfg-rh/tests: remove call to nm_connection_normalize()

Coverity complains that the return value is not checked.
Normaliziation here is not necessary.

8 years agoall: merge branch 'danw/gerror-bgo762868'
Thomas Haller [Thu, 3 Mar 2016 18:08:40 +0000 (19:08 +0100)]
all: merge branch 'danw/gerror-bgo762868'

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

8 years agoall: don't include error->code in log messages
Thomas Haller [Sun, 28 Feb 2016 17:12:28 +0000 (18:12 +0100)]
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>
8 years agoall: use g_error_matches()
Dan Winship [Tue, 8 Apr 2014 16:00:09 +0000 (12:00 -0400)]
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]

8 years agoall: clean-up usage of GError
Thomas Haller [Sun, 28 Feb 2016 15:25:36 +0000 (16:25 +0100)]
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>
8 years agoshared: add NM_G_ERROR_MSG()
Thomas Haller [Sun, 28 Feb 2016 15:06:05 +0000 (16:06 +0100)]
shared: add NM_G_ERROR_MSG()

8 years agosettings: set @error on failure of nm_settings_plugin_add_connection()
Beniamino Galvani [Thu, 3 Mar 2016 13:24:18 +0000 (14:24 +0100)]
settings: set @error on failure of nm_settings_plugin_add_connection()

8 years agoiface-helper: fix RA processing with more than one router
Lubomir Rintel [Thu, 3 Mar 2016 14:35:14 +0000 (15:35 +0100)]
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.

8 years agotests: fix bashism in run-test-dbus-session.sh
Michael Biebl [Tue, 1 Mar 2016 18:43:44 +0000 (19:43 +0100)]
tests: fix bashism in run-test-dbus-session.sh

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

8 years agodhcp/systemd: enable DHCPv6 support
Beniamino Galvani [Sun, 21 Feb 2016 10:43:34 +0000 (11:43 +0100)]
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

8 years agoFix missing commas in list-devices devtypes dict.
Adrian Likins [Wed, 2 Mar 2016 16:25:43 +0000 (11:25 -0500)]
Fix missing commas in list-devices devtypes dict.

8 years agomanager: use logging helpers
Beniamino Galvani [Wed, 2 Mar 2016 10:38:26 +0000 (11:38 +0100)]
manager: use logging helpers

8 years agolibnm-glib/libnm/vpn: fix handling of ConnectInteractive() failure (rh #1298732)
Dan Williams [Fri, 26 Feb 2016 22:16:09 +0000 (16:16 -0600)]
libnm-glib/libnm/vpn: fix handling of ConnectInteractive() failure (rh #1298732)

If the plugin supports interactive mode, but the VPN binary (like vpnc
or openvpn) doesn't support it, then the plugin should return
NM_VPN_PLUGIN_ERROR_INTERACTIVE_NOT_SUPPORTED from its connect_interactive()
hook.  This lets NetworkManager know to fall back to plain Connect().

Since this notification is done through an error return, the VPN service
plugin code sees the failure and moves the plugin state back to
STOPPED.  NetworkManager sees that state change, and terminates the
connection attempt while waiting for a reply to the Connect() method.

(VPN service plugins that don't support interactive mode at all don't
have this problem because that error is returned before the plugin's
state is moved to STARTING.)

To fix this, do two things:

1) if the connect_interactive() hook fails and returns the error
NM_VPN_PLUGIN_ERROR_INTERACTIVE_NOT_SUPPORTED, postpone the STOPPED
state change for a few seconds to allow NM time to fall back to
plain Connect().  We still want to move the plugin state back to
STOPPED eventually, because otherwise it could stay in STARTING
forever.

2) change state to STARTING only if the connect/connect_interactive
plugin hooks were successful.  Otherwise the plugin would still be
in STARTING state, and it's not valid to call Connect()/ConnectInteractive()
during the STARTING state.

https://mail.gnome.org/archives/networkmanager-list/2016-February/msg00091.html
https://bugzilla.redhat.com/show_bug.cgi?id=1298732

8 years agologging: print timestamp only with msec precision
Thomas Haller [Tue, 1 Mar 2016 14:20:31 +0000 (15:20 +0100)]
logging: print timestamp only with msec precision

8 years agologging: change logging format to drop "[file:line] func():" part
Thomas Haller [Thu, 25 Feb 2016 16:21:29 +0000 (17:21 +0100)]
logging: change logging format to drop "[file:line] func():" part

Choose a new logging format.

- the logging format must not be configurable and it must be the
  same for all backends. It is neat that journal supports additional
  fields, but an average user still posts the output of plain
  journalctl, without "--output verbose" (which would also be hard
  to read).
  Also, we get used to a certain logging format, so having different
  formats is confusing. If one format is better then another, it should
  be used for all backends: syslog, journal and debug.
  The only question is, what is the best format.

- the timestamp: I find it useful to see how much time between two
  events passed. The timestamp printed by syslog doesn't have sufficient
  granularity, and the internal journal fields are not readily available.
  We used to print the timestamps for <error>, <debug> and <trace>,
  but ommited them for <info> and <warn> levels. We now print them for
  all levels, which has a uniform alignment.

- the location: the "[file:line] func():" part is mostly redundant
  and results in wide lines. It also causes a misalignment of the
  logging lines, or -- as I recently added alignment of the location --
  it results in awkward whitespace and truncation.
  But the location is really just necessary because our logging messages
  are bad:
    "<debug> [1456397604.038226] (9) 11-dhclient succeeded"
  The solution to this is not
    "<debug> [1456397604.038226] [nm-dispatcher.c:358] dispatcher_results_process(): (9) 11-dhclient succeeded"
  but a properly worded message:
    "<debug> [1456397604.038226] dispatcher: request #9, script 11-dhclient succeeded"

- logging-message: we need to write better logging messages.
  I like some form of "tags" that are easy to grep:
    "platform: signal: link changed: 4: ..."
  Downside is, that this is not nice to read as a full sentence.
  So, especially for <info> and <warn> logging, more human readable
  messages are better.
  We should find a compromise, where the log message explains what
  happens, but is still concise and contains patterns that are easy
  to grep and identify visually.

https://mail.gnome.org/archives/networkmanager-list/2016-February/msg00077.html

8 years agoplatform: add flags argument to nm_platform_ip4_address_add()
Thomas Haller [Mon, 29 Feb 2016 16:06:21 +0000 (17:06 +0100)]
platform: add flags argument to nm_platform_ip4_address_add()

The argument is still always unset. We will need it later to set
IFA_F_NOPREFIXROUTE.

8 years agoplatform: track ifa_flags for cached IPv4 addresses
Thomas Haller [Mon, 29 Feb 2016 15:50:55 +0000 (16:50 +0100)]
platform: track ifa_flags for cached IPv4 addresses

It's useful to track the flags for IPv4 addresses too.

- we might want to sort IPv4 addresses according to whether they
  are permanent or dynamic.

- later we want to set IFA_F_NOPREFIXROUTE also for IPv4 addresses.
  While the ability to "set" a flag doesn't necessarily require that we
  also keep the flags present in NMPlatformIP4Address, it is more consistent.

8 years agoplatform: call ethtool functions via platform
Thomas Haller [Fri, 19 Feb 2016 22:34:25 +0000 (23:34 +0100)]
platform: call ethtool functions via platform

When adding namespace support later, we must call ethtool
from the proper namespace, i.e. via a NMPlatform instance.

Avoid calling ethtool directly.

8 years agosystemd/tests: add test_lldp_create() test
Thomas Haller [Tue, 1 Mar 2016 12:45:51 +0000 (13:45 +0100)]
systemd/tests: add test_lldp_create() test

This test makes sense because "test-systemd" is not
linked against any other systemd library. So this test
verifies that our libsystemd clone is self contained.

8 years agorelease: bump version to 1.1.91 (1.2-beta2)
Beniamino Galvani [Tue, 1 Mar 2016 12:14:46 +0000 (13:14 +0100)]
release: bump version to 1.1.91 (1.2-beta2)

8 years agocore: merge branch 'th/build-core'
Thomas Haller [Tue, 1 Mar 2016 11:54:22 +0000 (12:54 +0100)]
core: merge branch 'th/build-core'

Add a test "test-systemd" which links against our copy
of systemd code and a minimal core library. For that,
cleanup and split NetworkManagerUtils.h.

8 years agosystemd/tests: add test util for systemd
Thomas Haller [Tue, 1 Mar 2016 07:56:14 +0000 (08:56 +0100)]
systemd/tests: add test util for systemd

Most interestingly is also, whether we can link libsystemd.a without
having undefined references (which might be wrongly satisfied by an
externally loaded libsystem shared library.

8 years agocore: split "nm-core-utils.h" out of "NetworkManagerUtils.h"
Thomas Haller [Tue, 1 Mar 2016 08:56:51 +0000 (09:56 +0100)]
core: split "nm-core-utils.h" out of "NetworkManagerUtils.h"

"NetworkManagerUtils.h" contains a bunch of helper tools for core
daemon ("src/").

Unfortunately, it has dependencies to other parts of core,
such as "nm-device.h" and "nm-platform.h". Split out a part
of tools that are independent so that they can be used without
dragging in other dependencies.

"nm-core-utils.h" should only use libnm-core, "nm-logging.h"
and shared.

"NetworkManagerUtils.h" should provide all "nm-core-utils.h" and
possibly other utilities that have larger dependencies.

8 years agologging: make logging independent of platform
Thomas Haller [Tue, 1 Mar 2016 09:17:44 +0000 (10:17 +0100)]
logging: make logging independent of platform

"nm-logging.h" is a basic core module that should have few other
dependencies. Instead of letting nm-logging.c directly call a function
from "nm-linux-platform.c", let platform register a handler as needed.

This way, you can build a core library containing nm-logging but no
nm-platform.

8 years agolldp/tests: fix memleaks in test
Thomas Haller [Tue, 1 Mar 2016 11:35:19 +0000 (12:35 +0100)]
lldp/tests: fix memleaks in test

valgrind complains since commit ae9cc8910ddd04d43c9a15dbbe92a4863b6c49f0.

8 years agorelease: update NEWS
Beniamino Galvani [Tue, 23 Feb 2016 06:42:59 +0000 (07:42 +0100)]
release: update NEWS

8 years agomerge: branch 'bg/vlan-reorder-hdr-bgo762626'
Beniamino Galvani [Mon, 29 Feb 2016 17:23:15 +0000 (18:23 +0100)]
merge: branch 'bg/vlan-reorder-hdr-bgo762626'

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