Commit Graph

7207 Commits

Author SHA1 Message Date
Dan Williams
6596ceee14 supplicant: ignore NotConnected errors when disconnecting 2015-04-10 10:17:43 -05:00
Dan Williams
3c19ce7616 supplicant: track and expose wpa_supplicant's CurrentBSS property 2015-04-10 10:17:43 -05:00
Thomas Haller
7c5d361c66 platform/trivial: rename object_type_from_nl_object() to _nlo_get_object_type()
The function names in linux-platform should get better prefixes
indicating whether they are related to libnl or nm objects.

Add a prefix _nlo_ for functions that operate on libnl objects.
2015-04-09 17:45:59 +02:00
Thomas Haller
850af91f22 platform/trivial: move code around so that libnl related stuff is together
Reorder some functions in nm-platform, so that we first have independent
libnl wrappers/utils, then NMPlatform type definition, and then the
rest.
2015-04-09 17:31:11 +02:00
Thomas Haller
ee64b8585b platform/trivial: add OBJECT_TYPE_MAX enum value 2015-04-09 17:31:11 +02:00
Beniamino Galvani
eab389bd8a build: update systemd code
This is a direct dump from systemd git on 2015-04-08, git commit
431c3b6bab9c; it updates the existing files and imports systemd IPv4LL
implementation.

    SYSTEMD_DIR=../systemd
    COMMIT=431c3b6bab9ceb54cd144d8df24d764a8a5f8fcc

    (
       cd "$SYSTEMD_DIR"
       git checkout "$COMMIT"
       git reset --hard
       git clean -fdx
    )
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd/sd-id128/sd-id128.c ./src/systemd/src/libsystemd/sd-id128/sd-id128.c
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/dhcp-identifier.c ./src/systemd/src/libsystemd-network/dhcp-identifier.c
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/dhcp-identifier.h ./src/systemd/src/libsystemd-network/dhcp-identifier.h
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/dhcp-internal.h ./src/systemd/src/libsystemd-network/dhcp-internal.h
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/dhcp-lease-internal.h ./src/systemd/src/libsystemd-network/dhcp-lease-internal.h
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/dhcp-network.c ./src/systemd/src/libsystemd-network/dhcp-network.c
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/dhcp-option.c ./src/systemd/src/libsystemd-network/dhcp-option.c
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/dhcp-packet.c ./src/systemd/src/libsystemd-network/dhcp-packet.c
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/dhcp-protocol.h ./src/systemd/src/libsystemd-network/dhcp-protocol.h
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/dhcp6-internal.h ./src/systemd/src/libsystemd-network/dhcp6-internal.h
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/dhcp6-lease-internal.h ./src/systemd/src/libsystemd-network/dhcp6-lease-internal.h
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/dhcp6-network.c ./src/systemd/src/libsystemd-network/dhcp6-network.c
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/dhcp6-option.c ./src/systemd/src/libsystemd-network/dhcp6-option.c
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/dhcp6-protocol.h ./src/systemd/src/libsystemd-network/dhcp6-protocol.h
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/network-internal.c ./src/systemd/src/libsystemd-network/network-internal.c
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/network-internal.h ./src/systemd/src/libsystemd-network/network-internal.h
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/sd-dhcp-client.c ./src/systemd/src/libsystemd-network/sd-dhcp-client.c
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/sd-dhcp-lease.c ./src/systemd/src/libsystemd-network/sd-dhcp-lease.c
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/sd-dhcp6-client.c ./src/systemd/src/libsystemd-network/sd-dhcp6-client.c
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/sd-dhcp6-lease.c ./src/systemd/src/libsystemd-network/sd-dhcp6-lease.c
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/ipv4ll-internal.h ./src/systemd/src/libsystemd-network/ipv4ll-internal.h
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/ipv4ll-internal.h ./src/systemd/src/libsystemd-network/ipv4ll-internal.h
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/ipv4ll-network.c ./src/systemd/src/libsystemd-network/ipv4ll-network.c
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network//ipv4ll-packet.c ./src/systemd/src/libsystemd-network//ipv4ll-packet.c
    /bin/cp "$SYSTEMD_DIR"/src/libsystemd-network/sd-ipv4ll.c ./src/systemd/src/libsystemd-network/sd-ipv4ll.c
    /bin/cp "$SYSTEMD_DIR"/src/shared/async.h ./src/systemd/src/shared/async.h
    /bin/cp "$SYSTEMD_DIR"/src/shared/fileio.c ./src/systemd/src/shared/fileio.c
    /bin/cp "$SYSTEMD_DIR"/src/shared/fileio.h ./src/systemd/src/shared/fileio.h
    /bin/cp "$SYSTEMD_DIR"/src/shared/list.h ./src/systemd/src/shared/list.h
    /bin/cp "$SYSTEMD_DIR"/src/shared/log.h ./src/systemd/src/shared/log.h
    /bin/cp "$SYSTEMD_DIR"/src/shared/macro.h ./src/systemd/src/shared/macro.h
    /bin/cp "$SYSTEMD_DIR"/src/shared/path-util.c ./src/systemd/src/shared/path-util.c
    /bin/cp "$SYSTEMD_DIR"/src/shared/path-util.h ./src/systemd/src/shared/path-util.h
    /bin/cp "$SYSTEMD_DIR"/src/shared/refcnt.h ./src/systemd/src/shared/refcnt.h
    /bin/cp "$SYSTEMD_DIR"/src/shared/siphash24.c ./src/systemd/src/shared/siphash24.c
    /bin/cp "$SYSTEMD_DIR"/src/shared/siphash24.h ./src/systemd/src/shared/siphash24.h
    /bin/cp "$SYSTEMD_DIR"/src/shared/socket-util.h ./src/systemd/src/shared/socket-util.h
    /bin/cp "$SYSTEMD_DIR"/src/shared/sparse-endian.h ./src/systemd/src/shared/sparse-endian.h
    /bin/cp "$SYSTEMD_DIR"/src/shared/strv.c ./src/systemd/src/shared/strv.c
    /bin/cp "$SYSTEMD_DIR"/src/shared/strv.h ./src/systemd/src/shared/strv.h
    /bin/cp "$SYSTEMD_DIR"/src/shared/time-util.c ./src/systemd/src/shared/time-util.c
    /bin/cp "$SYSTEMD_DIR"/src/shared/time-util.h ./src/systemd/src/shared/time-util.h
    /bin/cp "$SYSTEMD_DIR"/src/shared/utf8.c ./src/systemd/src/shared/utf8.c
    /bin/cp "$SYSTEMD_DIR"/src/shared/utf8.h ./src/systemd/src/shared/utf8.h
    /bin/cp "$SYSTEMD_DIR"/src/shared/util.c ./src/systemd/src/shared/util.c
    /bin/cp "$SYSTEMD_DIR"/src/shared/util.h ./src/systemd/src/shared/util.h
    /bin/cp "$SYSTEMD_DIR"/src/shared/unaligned.h ./src/systemd/src/shared/unaligned.h
    /bin/cp "$SYSTEMD_DIR"/src/shared/in-addr-util.c ./src/systemd/src/shared/in-addr-util.c
    /bin/cp "$SYSTEMD_DIR"/src/shared/in-addr-util.h ./src/systemd/src/shared/in-addr-util.h
    /bin/cp "$SYSTEMD_DIR"/src/systemd/_sd-common.h ./src/systemd/src/systemd/_sd-common.h
    /bin/cp "$SYSTEMD_DIR"/src/systemd/sd-dhcp-client.h ./src/systemd/src/systemd/sd-dhcp-client.h
    /bin/cp "$SYSTEMD_DIR"/src/systemd/sd-dhcp-lease.h ./src/systemd/src/systemd/sd-dhcp-lease.h
    /bin/cp "$SYSTEMD_DIR"/src/systemd/sd-dhcp6-client.h ./src/systemd/src/systemd/sd-dhcp6-client.h
    /bin/cp "$SYSTEMD_DIR"/src/systemd/sd-dhcp6-lease.h ./src/systemd/src/systemd/sd-dhcp6-lease.h
    /bin/cp "$SYSTEMD_DIR"/src/systemd/sd-event.h ./src/systemd/src/systemd/sd-event.h
    /bin/cp "$SYSTEMD_DIR"/src/systemd/sd-id128.h ./src/systemd/src/systemd/sd-id128.h
    /bin/cp "$SYSTEMD_DIR"/src/systemd/sd-ipv4ll.h ./src/systemd/src/systemd/sd-ipv4ll.h
2015-04-08 16:12:44 +02:00
Thomas Haller
bd0c44c1cf route-manager/test: add variations to test code 2015-04-08 14:50:43 +02:00
Thomas Haller
62c652c352 route-manager: refactor route-manager and route_sync()
Refactor the implementation of nm_route_manager_ip4_route_sync()
and nm_route_manager_ip6_route_sync().

- merge the implementations for IPv4 and IPv6.

- pre-sort the routes and iterate them in a way that we don't
  need to lookup a route in other lists. Do this by iterating
  two sorted lists at a time in a merge-sort way.
  The runtime complexity of sync is now O(n*ln(n)).

- previously, the algorithm would merge routes it found in platform
  to priv->ipx_routes. That was wrong, because then we loose the
  information which routes we wanted to configure internally and which
  are present externally.
  Instead, priv->ipx_routes now contains all the routes that were
  explicitly configured via sync(). Hence, it knows what should be
  configured (@ipx_routes) and can compare to what is configured
  (@plat_routes).

https://bugzilla.gnome.org/show_bug.cgi?id=740064
2015-04-08 14:50:43 +02:00
Thomas Haller
e65639bde9 util: add nm_utils_array_remove_at_indexes() function 2015-04-08 14:39:17 +02:00
Thomas Haller
3179b45412 default-route-manager: cleanup logging macros 2015-04-08 14:39:16 +02:00
Thomas Haller
110200d5d4 default-route-manager: use NMPlatformVTableRoute 2015-04-08 14:39:16 +02:00
Thomas Haller
290faa003d platform: add VTable to handle IPv4 and IPv6 routes generically 2015-04-08 14:39:16 +02:00
Thomas Haller
57453189e0 test: add option in nmtst_platform_ip4_routes_equal() to ignore ordering
Same for nmtst_platform_ip6_routes_equal().

It's useful to check for equal routes ignoring the ordering.
2015-04-08 14:39:16 +02:00
Thomas Haller
ba8ce3bbe5 route-manager/test: check for exact expected error message 2015-04-08 14:39:16 +02:00
Thomas Haller
5fd3827e49 route-manager/test: fix usage of g_assert_expect_message()
Tests that use g_assert_expect_message() must initialize with
nmtst_init_assert_logging().

Otherwise, the caller can change the logging level via
  NMTST_DEBUG=log-level=DEBUG,log-domains=DEFAULT
which breaks the assertions.

nmtst_init_assert_logging() allows the caller to turn of
checking of assertions via
  NMTST_DEBUG=log-level=DEBUG,log-domains=DEFAULT,no-expect-message

Also, don't use g_message() in platform tests otherwise the test fail
because nmtst now sets g_log_set_always_fatal().
2015-04-08 14:39:16 +02:00
Thomas Haller
cdd3e1c302 platform/test: clear host part of routes in fake platform
Adding a route with host part non zero is rejected by kernel.
But NMLinuxPlatform works around it -- so must fake platform.
2015-04-08 14:39:16 +02:00
Thomas Haller
21b129084f platform/test: fake platform must use nm-logging for reporting errors
Just like linux platform does.
2015-04-08 14:39:16 +02:00
Thomas Haller
24288f713a platform/test: split initialization of platform tests out
test-route-manager soon wants a different initialization
2015-04-08 14:39:16 +02:00
Thomas Haller
b6d3b98655 test: setup logging during nmtst_init_assert_logging()
Before, when having a test with nmtst_init_assert_logging(),
the caller was expected to setup logging separately according
to the log level that the test asserts against.

Since 5e74891b58, the logging
level can be reset via NMTST_DEBUG also for tests that
assert logging. In this case, it would be useful, if the test
would not overwrite the logging level that is set externally
via NMTST_DEBUG.

Instead, let the test pass the logging configuration to
nmtst_init_assert_logging(), and nmtst will setup logging
-- either according to NMTST_DEBUG or as passed in.

This way, setting the log level works also for no-expect-message
tests:

  NMTST_DEBUG="debug,no-expect-message,log-level=TRACE" $TEST
2015-04-08 14:39:16 +02:00
Thomas Haller
07f95c371c platform: don't write debug message to stderr
Use nm-logging instead.
2015-04-08 14:39:16 +02:00
Beniamino Galvani
aabc6fc57b wifi: indicate 2ghz and 5ghz wifi device capabilities
Add new capabilities CAP_FREQ_2GHZ and CAP_FREQ_5GHZ to indicate the
frequency bands supported by a Wifi device.

Add also CAP_FREQ_VALID, which is set when the values of the other 2
capabilities are available.

Original patch by Dan Williams <dcbw@redhat.com>

https://bugzilla.gnome.org/show_bug.cgi?id=723295
2015-04-08 10:48:38 +02:00
Lubomir Rintel
d78f4614a0 device: use "new-activation" reason when deactivating for another activation
"user-requested" has a side effect of disabling autoconnect.

Fixes: 600489003f
2015-04-08 10:00:14 +02:00
Lubomir Rintel
1ad193a017 device,libnm,cli: add "new-activation" reason for device state change
It will be used when the device is disconnected for new connection activation.
2015-04-08 10:00:11 +02:00
Lubomir Rintel
c1c3d7e145 device: translate NM_DEVICE_STATE_REASON_UNKNOWN to "unknown" 2015-04-08 09:59:24 +02:00
Beniamino Galvani
8af18182f3 build: move systemd DHCP files to a common directory
Create a new directory 'src/systemd' and move systemd DHCP files
there. This new directory will contain all the files imported from
systemd.
2015-04-08 09:17:51 +02:00
Thomas Haller
7914a6b6bd dispatcher: fix crash due to wrong signature of variant for argument of "Action" D-Bus call
Fixes: 8da83a2ba3

https://bugzilla.gnome.org/show_bug.cgi?id=747456
2015-04-07 19:18:15 +02:00
Dan Winship
37a5bfcbeb supplicant-manager, wifi: (trivial) fix signal argument types
A few places in the NMSupplicantInterface API and in NMDeviceWifi's
use of it were still using "GHashTable *properties" where they should
have been using "GVariant *properties". (This didn't cause any actual
problems because nothing was looking at those arguments.)

(Also fix a comment typo.)
2015-04-06 16:13:03 -04:00
Dan Williams
689bf383e9 firewall: clean up call completion and use GCancellable 2015-04-03 16:58:41 -04:00
Dan Winship
5a1b6b4bbd core: port NMManager's aipd proxy to GDBus 2015-04-03 16:58:41 -04:00
Dan Winship
473cfec01c bluetooth: port bluez4 code to gdbus 2015-04-03 16:58:40 -04:00
Dan Winship
8da83a2ba3 core: port the daemon side of the dispatcher to gdbus 2015-04-03 16:58:40 -04:00
Dan Winship
da7d3ed5e1 core: port nm-sleep-monitor-upower to gdbus 2015-04-03 16:58:40 -04:00
Dan Winship
2e8acfa9d8 core: trivial NMSleepMonitor fixes
Fix nm-sleep-monitor-upower.c indentation, and fix the type of the
(unused) first argument in NMManager's NMSleepMonitor signal handlers.
2015-04-03 16:58:40 -04:00
Dan Winship
5c9032cb5d firewall: port nm-firewall-manager to gdbus 2015-04-03 16:58:40 -04:00
Dan Winship
9f42c6df9a core: use _nm_dbus_error_has_name() 2015-04-03 16:58:40 -04:00
Dan Winship
9926ba376a libnm, core: use typechecked proxy_call methods 2015-04-03 16:58:40 -04:00
Dan Winship
1a0bc83c39 libnm, core: use _nm_dbus_signal_connect() 2015-04-03 16:58:40 -04:00
Lubomir Rintel
4cb97cf66f manager: remove a connection from device if we're activating it on another device
The connection now might be being activated on another device. Defer the
removal until we're sure the activation request will proceed and only add the
active connection afterwards.

https://bugzilla.gnome.org/show_bug.cgi?id=730492
2015-04-03 18:59:33 +02:00
Lubomir Rintel
6fc3736c7a manager: pick an available device if none was specified upon connection activation
This offloads some complexity from the client.

https://bugzilla.gnome.org/show_bug.cgi?id=730492
2015-04-03 18:59:33 +02:00
Lubomir Rintel
6e94f302b2 manager: reuse a device connection is active on if none was given upon activation
If a connection is already active let's keep it on the same device. This makes
it possible to reactivate a connection without client knowing which device is
it active on.

https://bugzilla.gnome.org/show_bug.cgi?id=730492
2015-04-03 18:59:33 +02:00
Dan Williams
568a8d1da9 bridge/bond/team: device availability shouldn't depend on IFF_UP (bgo #746918)
The merge of lr/udev-unmanaged-fd731014 made all devices wait until
udev found them, but that makes these three device types fail activate
when created by NM itself.

Since their availability depended on IFF_UP, they could not be
activated (eg, 'nmcli con up team0') until they were IFF_UP.  But
when they are created by NM, although NM knows the ifindex the
platform ignores the interface until udev finds it.  Thus immediately
after creating the interface in _internal_activate_device() it
won't be known to the platform, so the nm_device_is_available()
check that controls whether the device moves to DISCONNECTED
will fail.  This prevents any activation and emits the message:

"Connection 'foo' is not available on the device %s at this time."

because the device is still in the UNAVAILABLE state.

danw asked why we care about IFF_UP for these devices, and I can't
remember why, and I don't think it makes sense to require now.

https://bugzilla.gnome.org/show_bug.cgi?id=746918
2015-04-02 15:10:43 -05:00
Dan Williams
a8299f6ae9 team: ratelimit teamd spawning 2015-04-02 14:44:41 -05:00
Dan Williams
24a764e831 team: respawn teamd when it exits instead of failing activation (rh #1145988)
teamd can recover interface state on its own, so if it died unexpectedly
we don't need to fail the device.  Also, if for some reason a teamd is
already up and running when activating the interface, we can ask for
its configuration and if it has the same configuration we are about to
use, just talk to the existing copy instead of killing it.
2015-04-02 14:44:31 -05:00
Bernd Edlinger
1282b468bd wifi: clear WPAS_REMOVED_TAG when scanning Wi-Fi AP
(cherry picked from commit 47c505523c72b6454dec4681c0edda535c3a2e91)

https://bugzilla.gnome.org/show_bug.cgi?id=733105
2015-04-02 17:42:58 +02:00
Lubomir Rintel
0f71335d52 device: use UNMANAGED reason instead of REMOVED when unmanaging devices upon quit
Since f85513b (device: do not touch sysctls after the device was removed) the
device is not unconfigured/cleaned up when it's removed. When we're quitting
the device is not actually removed, we're just unmanaging it -- let's just
use a different reason so that the cleanup runs.

Fixes: f85513b8e4
2015-04-02 11:19:55 -04:00
Beniamino Galvani
fa19fc0a7a build: fix compile warnings in DNS manager
Fixes the following warnings in nm-dns-manager.c with NETCONFIG_PATH set:

  dns-manager/nm-dns-manager.c: In function 'dispatch_netconfig':
  dns-manager/nm-dns-manager.c:313:2: warning: implicit declaration of function 'waitpid' [-Wimplicit-function-declaration]
    ret = waitpid (pid, NULL, 0);
    ^
  dns-manager/nm-dns-manager.c:271:14: warning: unused variable 'tmp' [-Wunused-variable]
    char *str, *tmp;
                ^
  dns-manager/nm-dns-manager.c:329:13: warning: 'ret' may be used uninitialized in this function [-Wmaybe-uninitialized]
    return ret > 0;
               ^
2015-04-01 15:52:24 +02:00
Beniamino Galvani
3db2e9d013 build: fix compile error in DNS manager
Fixes the following error in nm-dns-manager.c with NETCONFIG_PATH set:

  dns-manager/nm-dns-manager.c:320:4: error: too many arguments to function 'g_set_error_literal'
      g_set_error_literal (error,
2015-04-01 15:52:21 +02:00
Lubomir Rintel
63514d7a41 dbus-manager: disconnect thre private server before destroying it
Fixes a dbus warning: "this watch should have been invalidated"
2015-04-01 14:59:16 +02:00
Lubomir Rintel
dc1928a0d0 device: progress the device activation if it has a valid assumed connection
If we detect a LL address and this not decide to readd it, don't stop at
ip-config; progress to ip-check.

Fixes: 396dc2b3b4
2015-04-01 14:59:16 +02:00
Thomas Haller
10cde91f10 core: add "fatal-warnings" option to NM_DEBUG
NM already understands the command line argument --g-fatal-warnings
which causes setting of g_log_set_always_fatal().

Also interpret the "fatal-warnings" token in NM_DEBUG environment
variable and in main.debug configuration setting.

Usage hint: either set

  $ export NM_DEBUG=RLIMIT_CORE,fatal-warnings

or add the following section to NetworkManager.conf

    [main]
    debug=RLIMIT_CORE,fatal-warnings

https://mail.gnome.org/archives/networkmanager-list/2015-March/msg00093.html
2015-04-01 10:58:28 +02:00