Commit Graph

13873 Commits

Author SHA1 Message Date
Lubomir Rintel
b1076a698c build: re-add NetworkManager.conf.xml.in to dist
Fixes: 90683fcb3a
2015-11-28 17:26:33 +01:00
Thomas Haller
7300e59c14 platform: merge branch 'th/platform-netlink-events'
Add test cases for certain netlink peculiarities
and fix our NMLinxPlatform implementation to handle
them better.
2015-11-27 15:27:19 +01:00
Thomas Haller
832539a511 platform: emit signals by signal-id instead of string
We potentially emit a lot of signals. Don't look up the
signal by name because that adds quite some additional
overhead, like peeking for a GQuark.

Instead pass the numeric signal-id directly.
2015-11-27 15:17:44 +01:00
Thomas Haller
510e53ca16 platform: remove NMPlatformReason enum
This enum was unused and meaningless because the platform signals
are emitted as a consequence of netlink messages. It is not clear
whether a netlink message was received due to an external event
or an internal action.
2015-11-27 15:17:44 +01:00
Thomas Haller
8a87a91813 platform: cope differently with spurious RTM_DELLINK message when unslaving bridge-slave
Unslaving from a bridge causes a wrong RTM_DELLINK event for
the former slave.

    # ip link add dummy0 type dummy
    # ip link add bridge0 type bridge
    # ip link set bridge0 up
    # ip link set dummy0 master bridge0
    # ip monitor link &
    # ip link set dummy0 nomaster
    18: dummy0: <BROADCAST,NOARP> mtu 1500 qdisc noop master bridge0 state DOWN group default
        link/ether 76:44:5f:b9:38:02 brd ff:ff:ff:ff:ff:ff
    18: dummy0: <BROADCAST,NOARP> mtu 1500 master bridge0 state DOWN
        link/ether 76:44:5f:b9:38:02
    Deleted 18: dummy0: <BROADCAST,NOARP> mtu 1500 master bridge0 state DOWN
        link/ether 76:44:5f:b9:38:02
    18: dummy0: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN group default
        link/ether 76:44:5f:b9:38:02 brd ff:ff:ff:ff:ff:ff
    19: bridge0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default
        link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff
    19: bridge0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default
        link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff

Previously, during do_request_link() we would remember the link that is
about to be requested (delayed_deletion) and delay processing a new
RTM_DELLINK message until the end of do_request_link() -- and possibly
forget about about the deletion, if RTM_DELLINK was followed by a
RTM_NEWLINK.

However, this hack does not catch the case where an external command
unslaves the link.

Instead just accept the wrong event and raise a "removed" signal right
away. This brings the cache in an externally visible, wrong state that
will be fixed by a following "added" signal.

Still do that because working around the kernel bug is complicated. Also,
we already might emit wrong "added" signals for devices that are already
removed. As a consequence, a user should not consider the platform signals
until all events are processed.
Listeners to that signal should accept that added/removed link changes
can be wrong and should preferably handle them idly, when the events
have settled.

It can even be worse, that a RTM_DELLINK is not fixed by a following
RTM_NEWLINK:

    ...
    # ip link set dummy0 nomaster
    36: dummy0: <BROADCAST,NOARP> mtu 1500 qdisc noop master bridge0 state DOWN
        link/ether e2:f2:20:98:3a:be brd ff:ff:ff:ff:ff:ff
    36: dummy0: <BROADCAST,NOARP> mtu 1500 master bridge0 state DOWN
        link/ether e2:f2:20:98:3a:be
    Deleted 36: dummy0: <BROADCAST,NOARP> mtu 1500 master bridge0 state DOWN
        link/ether e2:f2:20:98:3a:be
    37: bridge0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN
        link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff
    37: bridge0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN
        link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff

So, when a slave is deleted, we have to refetch it too.

https://bugzilla.redhat.com/show_bug.cgi?id=1285719
2015-11-27 15:14:55 +01:00
Thomas Haller
83240f24ae Revert "platform: cancel delayed action REFRESH_LINK when receiving an update"
On some kernels (at least RHEL-7.2) we receive a spurious RTM_NEWLINK
message after the RTM_DELLINK message for deleting a bond master.

On RHEL-7, the following commands give:

    # ip link add dummy0 type dummy
    # ip link add bond0 type bond
    # ip link set bond0 up
    # ip link set dummy0 master bond0
    # ip monitor link &
    # ip link del bond0
    21: bond0: <BROADCAST,MULTICAST,MASTER> mtu 1500 qdisc noqueue state DOWN
        link/ether 1e:a6:6c:81:c1:8d brd ff:ff:ff:ff:ff:ff
    Deleted 21: bond0: <BROADCAST,MULTICAST,MASTER> mtu 1500 qdisc noop state DOWN
        link/ether 1e:a6:6c:81:c1:8d brd ff:ff:ff:ff:ff:ff
    20: dummy0: <BROADCAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN
        link/ether 1e:a6:6c:81:c1:8d brd ff:ff:ff:ff:ff:ff
    21: bond0: <BROADCAST,MULTICAST,MASTER> mtu 1500 qdisc noop state DOWN
        link/ether da:ee:58:70:6f:e5 brd ff:ff:ff:ff:ff:ff

    ^^^^^^^^^^^^^^^ RTM_NEWLINK after RTM_DELLINK (and there follows no
    RTM_DELLINK afterwards)

    21: bond0: <BROADCAST,MULTICAST,MASTER> mtu 1500 qdisc noop state DOWN
        link/ether da:ee:58:70:6f:e5 brd ff:ff:ff:ff:ff:ff
    20: dummy0: <BROADCAST,NOARP> mtu 1500 qdisc noqueue state DOWN
        link/ether 1e:a6:6c:81:c1:8d brd ff:ff:ff:ff:ff:ff
    20: dummy0: <BROADCAST,NOARP> mtu 1500 qdisc noqueue state DOWN
        link/ether 1e:a6:6c:81:c1:8d brd ff:ff:ff:ff:ff:ff

Fix that by reverting clear_REFRESH_LINK(). This fix has two downsides:

- on kernels where this hack is not necessary, we unnecessarily refetch
  a link
- the platform cache first removes the link, adds it again and removes
  it. This is ugly, but should have no real consequences because all
  listeners to the platform signals delay processing the signals to an
  idle handler.

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

This reverts commit f4f4e1cf09.
2015-11-27 14:38:12 +01:00
Thomas Haller
29c293728d platform/tests: add test for missing netlink notification for IFA_LINK_NETNSID
The related bug rh#1262908 in kernel causes missing netlink notifications
when moving a IFA_LINK interface to another netns.

Add a test for our workaround.

Related: https://bugzilla.redhat.com/show_bug.cgi?id=1262908
2015-11-27 14:38:12 +01:00
Thomas Haller
5650c82a8e platform: workaround kernel bug about missing IFLA_LINK/parent when creating veth
The related bug rh#1285827 in kernel causes a missing IFLA_LINK/parent
attribute when creating a veth pair:

    # ip monitor link &
    [1] 6745

    # ip link add dev vm1 type veth peer name vm2
    30: vm2@NONE: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN
        link/ether be:e3:b7:0e:14:52 brd ff:ff:ff:ff:ff:ff
    31: vm1@vm2: <BROADCAST,MULTICAST,M-DOWN> mtu 1500 qdisc noop state DOWN
        link/ether da:e6:a6:c5:42:54 brd ff:ff:ff:ff:ff:ff

Add a workaround and test.

Related: https://bugzilla.redhat.com/show_bug.cgi?id=1285827
2015-11-27 14:22:06 +01:00
Thomas Haller
4488cf6903 platform: add workaround for incomplete netlink link messages
Due to kernel bugs [1], the first netlink event about a new link
sometimes lacks the IFLA_LINKINFO with the link-type lnk data.

In the case the data is missing, schedule a re-fetch the link
hoping that it gets send.

[1] https://bugzilla.redhat.com/show_bug.cgi?id=1284001
2015-11-27 14:22:06 +01:00
Thomas Haller
557c495326 platform/tests: add namespace helper functions to nmtstp 2015-11-27 14:22:06 +01:00
Thomas Haller
d72fe89899 platform/tests: add @expected_link_type to nmtstp_wait_for_link() 2015-11-27 14:22:06 +01:00
Thomas Haller
f122879c83 platform/tests: drop "platform" test binary
"platform" implements a iproute2 like command-line
tool based on NMPlatform.

It is badly maintained and mostly unused. If we want
to test something, we should write tests that are run
automatically during `make check`. Manual tests just
don't fly.
2015-11-27 14:22:06 +01:00
Thomas Haller
998772805c nmtst: refactor NMTST_BUSY_WAIT() and rename to NMTST_WAIT*() 2015-11-27 14:22:06 +01:00
Thomas Haller
c97f7b54fe nmtst: support shorthand "NMTST_DEBUG=TRACE" to set logging level 2015-11-27 14:22:05 +01:00
Lubomir Rintel
90683fcb3a build: substitute config directory in Makefile
The autoconf substitutions should be expanded in Makefiles and shell scripts
only, does not work well in XML.

Fixes: 3e0b590e10
2015-11-27 14:18:34 +01:00
Lubomir Rintel
3e0b590e10 build: Remove NM_CONFIG_KEYFILE_PATH_DEFAULT from config.h
Can't just substitute sysconfdir into a header file -- it's meant to be
expanded in a Makefile. Otherwise, unexpanded ${prefix} will end up in a
header file.

We do that for NMCONFDIR already, let's use it here too.

Fixes: 2144457fab
2015-11-27 10:04:10 +01:00
Beniamino Galvani
09072d0d5e ppp-manager: set 'export_on_construction' flag
Instead of reimplementing constructed() just to call
nm_exported_object_export(), use the 'export_on_construction' flag
which does this automatically. This also fixes the following error:

nm_exported_object_export: assertion failed: (priv->_constructed)

Fixes: 8a8ecc46ca
2015-11-26 23:11:29 +01:00
Jiří Klimeš
191f213c49 clients: (trivial) remove unused commented code in nm-vpn-helpers 2015-11-26 11:09:15 +01:00
Jiří Klimeš
b8d6bd1a98 clients: move clients/tui/vpn-helpers.c to clients/common/nm-vpn-helpers.c
The file has not been used up to now. But it is going to be used by both
nmtui and nmcli later.
2015-11-26 11:08:44 +01:00
Beniamino Galvani
d1a776bff9 ip4-config: properly handle gateway in nm_ip4_config_replace()
When @src didn't have a gateway and @dst did, the function left @dst's
gateway set to 0.0.0.0; fix this and unset the gateway in such case.

Fixes: 063677101a
2015-11-26 10:02:35 +01:00
Jiří Klimeš
4a06701e88 cli: add 'strongswan' and 'fortisslvpn' to known VPN types 2015-11-25 17:14:02 +01:00
Jiří Klimeš
579fd36566 cli: improve error messages for 'nmcli device set'
Fixes: 4dffbf8f6a
2015-11-25 16:39:00 +01:00
Jiří Klimeš
72374f4252 wifi: (trivial) remove unused failed_link_count 2015-11-25 15:47:59 +01:00
Jiří Klimeš
542200f539 clients: check errors of polkit_unix_session_new_for_process_sync()
polkit_unix_session_new_for_process_sync() can fail. And calling
polkit_agent_listener_register() with NULL PolkitSubject results in errors.

https://bugzilla.gnome.org/show_bug.cgi?id=758625
2015-11-25 12:08:07 +01:00
Thomas Haller
3d8eb6b1e0 gitignore: ignore ifnet/tests/check_ifnet binary
This file no longer exists on master, but it is annoying when
switching branches.
2015-11-25 11:59:37 +01:00
Beniamino Galvani
123d0ba9b8 merge: branch 'bg/create-sw-devices-bgo749369-tun'
Add support for creating TUN/TAP devices.

https://bugzilla.gnome.org/show_bug.cgi?id=749369
2015-11-25 11:53:37 +01:00
Beniamino Galvani
c223e811f1 nmcli/bash-completion: add completion for 'tun' connection mode 2015-11-25 11:53:04 +01:00
Beniamino Galvani
43badf7cdf libnm-glib: print HW address of generic devices in test tool
This is not particularly useful per se, but allows to check that
generic devices are instantiated properly.
2015-11-25 11:39:57 +01:00
Beniamino Galvani
8ca6e412c1 libnm-glib: add support for TUN devices
Since libnm is the preferred way to interact with NM now, we don't
want to add new device types to libnm-glib.

Make libnm-glib recognize TUN devices as generic ones and modify
NMDeviceGeneric to use the correct D-Bus interface based on the actual
device type.
2015-11-25 11:39:57 +01:00
Beniamino Galvani
33e76cf0e0 libnm-glib: refactor _nm_device_type_for_path()
Refactor nm-device.c to expose a private _nm_device_type_for_path()
function which can be used by subclasses to query the actual device
type. In particular, NMDeviceGeneric will use the result of this
function to figure out which interface to use for the D-Bus proxy.
2015-11-25 11:39:57 +01:00
Beniamino Galvani
877de231b8 device/tun: remove unused property enum FLAGS 2015-11-25 11:39:57 +01:00
Beniamino Galvani
337304f19d libnm: add NMDeviceTun 2015-11-25 11:39:57 +01:00
Beniamino Galvani
9110ad39c5 device/tun: support device creation
Allow the creation of a new TUN/TAP interface when a tun connection is
activated.
2015-11-25 11:39:57 +01:00
Beniamino Galvani
5b22711908 platform: support creation of TUN/TAP devices 2015-11-25 11:39:57 +01:00
Beniamino Galvani
64c6b124d2 cli: add support for tun settings
Add nmcli support for adding and modifying TUN/TAP connections.
2015-11-25 11:39:57 +01:00
Beniamino Galvani
1f30147a7a libnm-core: add NMSettingTun
Add a new NMSettingTun which contains configuration properties for TUN/TAP
interfaces.
2015-11-25 11:39:57 +01:00
Lubomir Rintel
fa96bade79 nm-device: don't try to re-add LL address if the devices is torn down
Fixes: 9f92bb1f63
2015-11-25 11:22:22 +01:00
Thomas Haller
8aab22fe45 core: don't handle SIGUSR1 and SIGUSR2 signals for pre 2.36.0 glib
https://bugzilla.gnome.org/show_bug.cgi?id=758614

Reported-by: Glenn Washburn <development@efficientek.com>
2015-11-25 10:54:18 +01:00
Thomas Haller
4c4b67e515 nm-glib: add nm_glib_check_version() util 2015-11-25 10:54:18 +01:00
Glenn Washburn
7a97d16944 dhcp-helper: call g_type_init() to support pre 2.36.0 glib
https://bugzilla.gnome.org/show_bug.cgi?id=758614

[thaller@redhat.com: original patch modified to use nm_g_type_init()]
2015-11-25 10:15:32 +01:00
Lubomir Rintel
960127422d systemd: add an initializer
Fixes build with exceptions enabled.
2015-11-24 16:31:18 +01:00
Lubomir Rintel
495faa3191 build: add a missing file into dist
Fixes: aa22b2d87f
2015-11-24 16:31:07 +01:00
Lubomir Rintel
c0f59cdb2c po: remove special characters from translations
Makes Zanata unhappy, in the Java way.

  for i in po/*.po; do awk '
    /^"  0 = / { print "\"%s\""; n=1; next; }
    /^"  8 = / { n=0; next }
    { if (!n) print }' $i >x
    mv x $i
  done

Fixes: 3641ddb00a
2015-11-24 15:34:33 +01:00
Jiří Klimeš
847f3b646b cli: make a prompt a translatable string in do_connection_clone()
Fixes: 0c65b28960
2015-11-24 15:22:06 +01:00
Jiří Klimeš
795a3943ea device: use nm_utils_find_helper() to find out ping/ping6 binary (bgo #758566)
https://bugzilla.gnome.org/show_bug.cgi?id=758566
2015-11-24 14:30:01 +01:00
Thomas Haller
e2b9346d71 ifcfg-rh: remove unused selinux.h include from "plugin.c" 2015-11-24 12:20:55 +01:00
Thomas Haller
5276f6896b tests: merge branch 'th/test-run-valgrind' 2015-11-24 11:03:21 +01:00
Thomas Haller
4dacf0b1ad nmtst/valgrind: allow calling 'run-test-valgrind.sh' script directly
When you want to run valgrind for a test, you either had to
invoke valgrind manually, or doing it via `make check` (provided
you configured --with-valgrind).

Make it more convenient to run valgrind by passing the test
to run to the "run-test-valgrind.sh" wrapper.

This also allows to pass -p/-s to the test, which is not possible
during `make check` because selecting tests conflicts with "--tap".
The following invocations are largely equivalent and work as
expected:

  $ ./tools/run-test-valgrind.sh ./src/platform/tests/test-link-linux -p /link/software/detect/vlan

  $ NMTST_DEBUG=no-debug,p=/link/software/detect/vlan ./tools/run-test-valgrind.sh ./src/platform/tests/test-link-linux
2015-11-24 11:02:55 +01:00
Thomas Haller
73cb579108 nmtst: support -p and -s arguments from gtestutils via $NMTST_DEBUG
For tests based on glib's test framework, you can select which tests to
run by passing -p/-s on the command line.

Usually, we want to invoke our tests via `make check` which conveniently
calls valgrind (run-test-valgrind.sh) or spawns a private D-Bus server
(libnm-test-launch.sh, libnm-glib-test-launch.sh). At that point, it is
not directly possible to specify command line arguments for the tests,
which is why it is convenient to specify arguments via $NMTST_DEBUG
environment variable.

Parse "p" and "s" arguments from $NMTST_DEBUG and pass them to g_test_init()
to select which tests to run.

  NMTST_DEBUG=p=/core/general/test_setting_ip4_changed_signal ./libnm-core/tests/test-general

However, there is a problem here: in gtestutils, -p/-s conflicts with --tap,
which is how our Makefile invokes the tests. Thus the new options explicitly
don't work when being called during `make check`. Which makes this much
less useful. I only noticed that afterwards, so still keep the patch
because it might still be convenient during developing tests to set the
environment variable once, and then repeatedly spawn the tests, without
specifying -p/-s.
2015-11-24 09:46:06 +01:00
Thomas Haller
a6a2fd7eef nmtst: pass -m=quick when specifying quick test in $NMTST_DEBUG
When the environment variable indicates that we want to run quick
tests, pass "-m=quick" to g_test_init().
2015-11-24 09:42:05 +01:00