Commit Graph

7573 Commits

Author SHA1 Message Date
Thomas Haller
ab2456493d utils/core: add NM_UTILS_NS_PER_MSEC macro 2016-03-17 15:00:48 +01:00
Beniamino Galvani
2f45aaa55f supplicant: honor the domain-suffix-match properties 2016-03-16 17:32:17 +01:00
Beniamino Galvani
a4b4e0bc5b ifcfg-rh: add support for domain-suffix-match properties 2016-03-16 17:32:17 +01:00
Lubomir Rintel
8f82fa83ce ethernet: set the connection type when generating the connection
Otherwise the connection wouldn't verify:

  <error> [1458066126.2270] device (eth10): Generated connection does not verify:
    connection.type: property type should be set to '802-3-ethernet'
  <debug> [1458066126.2271] manager: (eth10): can't assume; no connection

(cherry picked from commit 4b71939e9ac3df93bfe72af0eac42b4ebaf94e15)
2016-03-16 11:38:00 +01:00
Thomas Haller
c7aea6b620 platform: use gint32 for monotonic-timestamp seconds
@now is obtained via nm_utils_get_monotonic_timestamp_s(),
which is gint32 (although it will never be negative).

Use the correct type.
2016-03-15 18:28:43 +01:00
Thomas Haller
6cb7322465 platform: remove padding for IP address lifetimes
We used to pad the lifetime since the beginning (commit
f121995fad).

However, there is not race involved, since our platform cache
is in sync with the messages from kernel (which didn't used to
be the case).

Also, when receiving a RA with a zero preferred time, we must
not extend the address lifetime by 5 seconds, but instead deprecate
the address immediately.

https://bugzilla.gnome.org/show_bug.cgi?id=763513
2016-03-15 18:28:43 +01:00
Beniamino Galvani
ca5da5d80f device: fix handling of available connections
The prune list is for elements that must be deleted from the list of
available connections. So, when processing all the existing
connections an element must be deleted from the prune list iff it's
available.

Fixes: 8b2abe0e2c

https://bugzilla.redhat.com/show_bug.cgi?id=1316488
2016-03-15 17:38:58 +01:00
Thomas Haller
46f5c07643 platform: add nmp_netns_bind_to_path() helper function
Based-on-patch-by: Stjepan Gros <stjepan.gros@gmail.com>
2016-03-15 12:56:59 +01:00
Thomas Haller
3428d8607d 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.
2016-03-15 12:56:58 +01:00
Thomas Haller
a0cce2b195 platform/tests: add test for nm_platform_link_set_netns() 2016-03-15 12:56:58 +01:00
Thomas Haller
ad345cdf7d 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).
2016-03-15 12:56:58 +01:00
Stjepan Gros
9995699116 platform: add nm_platform_link_set_netns() function
[thaller@redhat.com: cherry-picked original patch and modified
  slightly]
2016-03-15 12:56:58 +01:00
Thomas Haller
30fe52c766 platform/tests: refactor creation of test_netns_general()
Need to add more then one netns test.
2016-03-15 12:56:58 +01:00
Thomas Haller
2eab5ed347 utils: inject platform into nm_utils_complete_generic() 2016-03-15 12:56:58 +01:00
Thomas Haller
56121fec83 route-manager: make NMRouteManager namespace aware 2016-03-15 12:56:58 +01:00
Thomas Haller
80136bed74 default-route-manager: make NMDefaultRouteManager namespace aware 2016-03-15 12:56:58 +01:00
Thomas Haller
fc53700fce default-route-manager: use explict platform instance instead of NM_PLATFORM_GET singleton 2016-03-15 12:56:58 +01:00
Thomas Haller
3ba9444728 rdisc: make NMRDisc namespace aware 2016-03-15 12:56:58 +01:00
Thomas Haller
a0c8f9c345 rdisc/trivial: adjust indention in nm_rdisc_class_init() 2016-03-15 12:56:58 +01:00
Thomas Haller
c924aae14a platform: add defines for "/proc/self/ns/" paths 2016-03-15 12:56:57 +01:00
Thomas Haller
7df7619e22 platform: properly change netns in do_change_link() 2016-03-15 12:56:57 +01:00
Lubomir Rintel
d6c399b1dd systemd: fall back to CLOCK_MONOTONIC
https://github.com/systemd/systemd/pull/2843
2016-03-15 12:53:19 +01:00
Lubomir Rintel
93bc9c0294 ocd: style fix 2016-03-15 09:18:16 +01:00
Lubomir Rintel
0adac47922 ifupdown: style fixes 2016-03-15 09:18:01 +01:00
Lubomir Rintel
c4fed9bd36 ifnet: fix error handling
Oh my.
2016-03-15 09:00:03 +01:00
Lubomir Rintel
12063468a3 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.
2016-03-15 09:00:03 +01:00
Lubomir Rintel
4e0968182c 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.
2016-03-15 09:00:03 +01:00
Lubomir Rintel
e4aaa48b82 ifupdown: fix up a bad rebase
Fixes: 0cb45af977
2016-03-14 16:39:43 +01:00
Lubomir Rintel
1b826d9dd9 ifupdown: set wireless mode 2016-03-14 16:32:15 +01:00
Lubomir Rintel
b6bbf3df1e ifupdown: ssid is now GBytes for quite some time
Fixes: c43f88907b
2016-03-14 16:32:15 +01:00
Lubomir Rintel
5b14492b0b ifupdown: wireless-essid is good too 2016-03-14 16:32:15 +01:00
Lubomir Rintel
0cb45af977 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.
2016-03-14 16:32:15 +01:00
Lubomir Rintel
a5c204a69a ifupdown: drop a bogus warning
The key might be a wireless setting that has already been processed, not a
wireless-security setting.
2016-03-14 16:32:15 +01:00
Francesco Giudici
0f6febc6fb wifi: hack for wext devices reporting IW_MODE_AUTO configuration mode.
https://bugzilla.gnome.org/show_bug.cgi?id=763388
2016-03-11 18:59:40 +01:00
Thomas Haller
500bbbf761 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").
2016-03-11 11:12:00 +01:00
Thomas Haller
aed3c810b3 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".
2016-03-11 11:02:12 +01:00
Thomas Haller
a8bc65b1a1 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.
2016-03-11 09:28:12 +01:00
Thomas Haller
18133ea142 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().
2016-03-11 09:28:10 +01:00
Thomas Haller
4f8522423a lldp/tests: add test for ttl 2016-03-10 17:16:05 +01:00
Thomas Haller
cba9dc9d03 lldp/tests: use nmtst_main_loop_run() 2016-03-10 17:14:29 +01:00
Thomas Haller
0b12209951 lldp/tests: add a test with another lldp frame 2016-03-10 16:52:19 +01:00
Thomas Haller
8cafd4d39d 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.
2016-03-10 16:46:50 +01:00
Thomas Haller
c442617899 lldp/tests: refactor tests to run receive different frames 2016-03-10 16:46:50 +01:00
Thomas Haller
57af1d6e2a lldp/tests/trivial: some renaming and moving of code 2016-03-10 16:46:50 +01:00
Thomas Haller
fd8c56425e all/tests: fix tests after adjusting glib logging level
Fixes: b49322b568
2016-03-10 14:04:32 +01:00
Thomas Haller
f6ea8f5e67 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.
2016-03-10 13:54:39 +01:00
Thomas Haller
b49322b568 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.
2016-03-10 11:30:55 +01:00
Beniamino Galvani
43ddfa398e device: trivial: group all forward declarations of static functions 2016-03-09 15:05:37 +01:00
Thomas Haller
bccb4e358c 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"
2016-03-09 12:38:54 +01:00
Thomas Haller
f7941ceba3 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.
2016-03-09 11:45:03 +01:00