Commit Graph

15047 Commits

Author SHA1 Message Date
Lubomir Rintel
e4aaa48b82 ifupdown: fix up a bad rebase
Fixes: 0cb45af977
2016-03-14 16:39:43 +01:00
Lubomir Rintel
ad8251e3a4 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.
2016-03-14 16:32:44 +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
Lubomir Rintel
6da97a8c48 contrib/rpm: with-udev-dir now has a sensible default 2016-03-14 16:32:15 +01:00
Lubomir Rintel
fa16fb1808 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.
2016-03-14 16:32:14 +01:00
Jan Tojnar
226ef19109 tests: fix test-networkmanager-service.py for Python 3 incompatibility
https://bugzilla.gnome.org/show_bug.cgi?id=763544
2016-03-13 18:30:05 +01:00
Thomas Haller
4a00bcf5a6 shared: add nm_g_object_ref() and nm_g_object_unref() function 2016-03-13 12:31:04 +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
e1e428b21e systemd: merge branch 'th/systemd-lldp-bgo763384' into master
https://bugzilla.gnome.org/show_bug.cgi?id=763384
2016-03-11 09:37:04 +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
d432edba55 lldp: merge branch 'th/lldp-tests' 2016-03-10 17:25:11 +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
3802fd46dd lldp: fix name of NM_LLDP_ATTR_IEEE_802_1_VID string
Fixes: 07a9364d9c
2016-03-10 16:46:50 +01:00
Thomas Haller
0cee9ef7b5 nmtst: add nmtst_main_loop_quit_on_notify function 2016-03-10 16:46:50 +01:00
Thomas Haller
3a09a7e991 nmtst: add nmtst_assert_variant_*() helper macros 2016-03-10 14:49:55 +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
f0c6a0315d 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
2016-03-10 11:12:02 +01:00
Beniamino Galvani
551c5de120 libnm-core: fix memory leak in nm-setting-ip-tunnel.c
Fixes: ae8c7a8967
2016-03-09 23:16:23 +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
Beniamino Galvani
c885fd55e8 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'.
2016-03-09 10:11:27 +01:00
Beniamino Galvani
e80fc0566a 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
2016-03-09 09:48:44 +01:00
Lubomir Rintel
a939a665a1 build: add a missing file to distribution 2016-03-08 19:30:36 +01:00
Thomas Haller
b36d721525 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.
2016-03-08 17:57:20 +01:00
Thomas Haller
24d96e6f65 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.
2016-03-08 17:45:50 +01:00
Thomas Haller
d5cc42ff6f core/trivial: rename NM_ASSERT_VALID_PATH_COMPONENT() helper
All defines from header files must have a NM prefix.
2016-03-08 17:45:50 +01:00
Lubomir Rintel
1c5d8d0aec all: fix a couple more gvariant iteration leaks 2016-03-08 17:44:15 +01:00
Piotr Drąg
634888aff8 po: update Polish (pl) translation (bgo #763327)
https://bugzilla.gnome.org/show_bug.cgi?id=763327
2016-03-08 16:40:28 +01:00
Lubomir Rintel
bb35883235 nm-object: don't leak the properties on changed signals
https://bugzilla.redhat.com/show_bug.cgi?id=1314976
2016-03-08 16:02:27 +01:00
Thomas Haller
fd9eeca3be device: fix leaking GSList element in _replace_vpn_config_in_list()
Fixes: 9bbf5e94c2
2016-03-08 10:26:31 +01:00
Beniamino Galvani
639f2d4b05 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.
2016-03-07 18:22:12 +01:00
Thomas Haller
b2b73809c5 platform: merge branch 'th/platform-netns-bgo762408'
https://bugzilla.gnome.org/show_bug.cgi?id=762408
2016-03-07 12:49:27 +01:00
Thomas Haller
c7b3862503 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
2016-03-07 12:28:13 +01:00
Thomas Haller
1a1c5fb717 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.
2016-03-07 11:58:01 +01:00
Thomas Haller
6165df788d 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.
2016-03-07 11:49:52 +01:00