Commit graph

5989 commits

Author SHA1 Message Date
Thomas Haller
313af401d3 platform/test: refactor detection of root-test 2015-04-21 18:04:37 +02:00
Thomas Haller
bdb2f94519 platform: pass @platform instance to build_rtnl_addr() 2015-04-21 17:52:10 +02:00
Thomas Haller
c6529a9d74 platform: add self argument to platform functions
Most nm_platform_*() functions operate on the platform
singleton nm_platform_get(). That made sense because the
NMPlatform instance was mainly to hook fake platform for
testing.

While the implicit argument saved some typing, I think explicit is
better. Especially, because NMPlatform could become a more usable
object then just a hook for testing.

With this change, NMPlatform instances can be used individually, not
only as a singleton instance.

Before this change, the constructor of NMLinuxPlatform could not
call any nm_platform_*() functions because the singleton was not
yet initialized. We could only instantiate an incomplete instance,
register it via nm_platform_setup(), and then complete initialization
via singleton->setup().
With this change, we can create and fully initialize NMPlatform instances
before/without setting them up them as singleton.

Also, currently there is no clear distinction between functions
that operate on the NMPlatform instance, and functions that can
be used stand-alone (e.g. nm_platform_ip4_address_to_string()).
The latter can not be mocked for testing. With this change, the
distinction becomes obvious. That is also useful because it becomes
clearer which functions make use of the platform cache and which not.

Inside nm-linux-platform.c, continue the pattern that the
self instance is named @platform. That makes sense because
its type is NMPlatform, and not NMLinuxPlatform what we
would expect from a paramter named @self.

This is a major diff that causes some pain when rebasing. Try
to rebase to the parent commit of this commit as a first step.
Then rebase on top of this commit using merge-strategy "ours".
2015-04-21 17:51:34 +02:00
Thomas Haller
ccba1b1e2d trivial: fix spelling in comments 2015-04-20 11:27:56 +02:00
Jiří Klimeš
560e19514e core: set nm-plugin-missing device property 2015-04-20 10:04:15 +02:00
Jiří Klimeš
fc6373bea9 device: add nm-plugin-missing property indicating NM device plugin not available
It is useful for indicating that the device type is supported but the required
plugin is not installed.
2015-04-20 10:00:28 +02:00
Jiří Klimeš
8257940606 core: (trivial) fix spelling in comments 2015-04-20 09:45:57 +02:00
Thomas Haller
255f30c362 device/logging: downgrade log level of "Activation: Stage x of 5" messages
Only downgrade the <info> levels to <debug>. Leave
warnings unchanged.

https://bugzilla.redhat.com/show_bug.cgi?id=1212196
2015-04-18 21:41:40 +02:00
Thomas Haller
b91b8a035c core/logging: reduce info logging messages for devices
https://bugzilla.redhat.com/show_bug.cgi?id=1212196
2015-04-18 21:41:40 +02:00
Thomas Haller
9983e4eff5 device/logging: log connection UUID when activating connection
It is often hard to understand whether we activate an assumed
connection. Only the UUID is unique.
2015-04-18 21:41:40 +02:00
Thomas Haller
e9b9d9b627 core/logging: adjust log line about loading setting plugins
We have different kinds of plugins (settings, dhcp, dns).
Clearify, that we are about to load "settings" plugins.
2015-04-18 21:41:40 +02:00
Thomas Haller
d8e1d9b469 core/logging: downgrade some <info> loggings to <debug>
These logging statements are compile time dependent and
add little informational value.
2015-04-18 21:41:40 +02:00
Thomas Haller
756b756c2c device: expose nm_device_has_capability() function 2015-04-18 21:41:40 +02:00
Thomas Haller
2117bef864 device: use NMDeviceCapabilities enum for device capabilities 2015-04-18 21:41:40 +02:00
Dan Winship
721e917cb6 wimax: drop WiMAX support (bgo #747846)
Even Fedora is no longer shipping the WiMAX SDK, so it's likely we'll
eventually accidentally break some of the code in src/devices/wimax/
(if we haven't already). Discussion on the list showed a consensus for
dropping support for WiMAX.

So, remove the SDK checks from configure.ac, remove the WiMAX device
plugin and associated manager support, and deprecate all the APIs.

For compatibility reasons, it is still possible to create and save
WiMAX connections, to toggle the software WiMAX rfkill state, and to
change the "WIMAX" log level, although none of these have any effect,
since no NMDeviceWimax will ever be created.

nmcli was only compiling in support for most WiMAX operations when NM
as a whole was built with WiMAX support, so that code has been removed
now as well. (It is still possible to use nmcli to create and edit
WiMAX connections, but those connections will never be activatable.)
2015-04-17 12:42:23 -04:00
Thomas Haller
de9848aa66 core: optimize nm_match_spec_s390_subchannels() to return early
No need to parse the subchannels if the spec list is empty.

This isn't actually an issue, because nm_match_spec_s390_subchannels()
was never called with empty spec list.
2015-04-17 14:26:49 +02:00
Thomas Haller
6b0f84bdda config: fix filename order for config-description
The configuration snippets are loaded in alphabetical order.
Fix the printed description to reflect that order. Otherwise,
NM logs at startup:

  <info>  Read config: /etc/NetworkManager/NetworkManager.conf and conf.d: 20-connectivity-fedora.conf, 10-ibft-plugin.conf
2015-04-17 13:30:30 +02:00
Thomas Haller
2bb44d91d8 platform/trivial: move ethtool code 2015-04-14 13:06:53 +02:00
Thomas Haller
dffb18cb34 platform/trivial: move udev_detect_link_type_from_device() 2015-04-14 13:06:53 +02:00
Thomas Haller
34d82d0df1 platform: split link_type_from_udev()
Also change link_extract_type() to accept NULL as @platform
argument.
2015-04-14 13:06:53 +02:00
Thomas Haller
d695776d48 platform/trivial: move udev code closer to beginning of nm-linux-platform.c 2015-04-14 13:04:13 +02:00
Thomas Haller
7354dc4c58 platform/trivial: remove unused argument from udev_get_driver() 2015-04-14 13:02:04 +02:00
Beniamino Galvani
3e8d828008 wifi: fix memleak in nm_ap_update_from_properties()
Fixes: 59c8192b22
2015-04-13 21:39:21 +02:00
Lubomir Rintel
bcc79cc0eb device: turn off "unmanaged unless IFF_UP externally" for veth
We currently don't manage a veth inside a container despite we should because
it's an externally configured software interface and thus waits for IFF_UP.

Given veths are prevented from being managed outside of a container by an udev
rule anyway it's safe to lift the external IFF_UP requirement for them.
2015-04-13 13:51:27 +02:00
Lubomir Rintel
adb6e9afb1 device: move the decision whether to wait for IFF_UP a virtual function
We'd like to override it for veths.
2015-04-13 13:51:27 +02:00
Dan Williams
62f40bade0 wifi: use the supplicant's CurrentBSS as the current AP (bgo #747424)
Instead of trying to do a bunch of fragile frequency/SSID/security
matching, just use what the supplicant thinks the current AP is.
2015-04-10 15:59:05 -05:00
Thomas Haller
1eaddced10 make use of NM_MORE_ASSERTS, nm_assert() and NM_MORE_LOGGING 2015-04-10 18:09:32 +02:00
Dan Williams
fbf60536f9 wifi: fall back to band matching when frequency matching fails
Some dual-band access points use the same BSSID in both the 5GHz
and 2.4GHz bands, so obviously frequency must be taken into account
when matching.  But no AP should ever use the same SSID/BSSID pair
concurrently in the same band on different frequencies.

Some APs also dynamically channel hop when they detect interference,
or when they restart, they do so on a different channel after finding
the channel with the lowest interference.  To assure that we don't
end up with stale scan list entries when the AP has switched to
another channel in the same band, fall back to band matching
when merging new scan results.
2015-04-10 10:17:45 -05:00
Dan Williams
227de48a91 wifi: remove unused AP 'broadcast' property
Nothing ever read the value.
2015-04-10 10:17:45 -05:00
Dan Williams
85aac315c0 wifi: always strict-match access points when merging
The only reason to allow lazy matching was to update a fake
current AP when its real scan result comes in.  Now that NM
tracks the current AP based on the the supplicant's current
BSS, a fake current AP will be replaced when the real scan
result arrives.  So it's pointless to update the fake one
when it'll just be removed soon.
2015-04-10 10:17:45 -05:00
Dan Williams
f191e204ac wifi: trivial whitespace fixup 2015-04-10 10:17:45 -05:00
Dan Williams
0bdee17402 wifi: update AP properties from supplicant signals 2015-04-10 10:17:45 -05:00
Dan Williams
37760fdc83 wifi: use supplicant's CurrentBSS as the current AP
Instead of keeping track of it internally, and attempting to fuzzy-match
access points and stuff, just use the supplicant's information.  If the
supplicant doesn't know what AP it's talking to, then we've got more
problems than just NM code.

The theory here is that when starting activation, we'll use the given
access point from the scan list that the supplicant already knows about.
If there isn't one yet (adhoc, hidden, or AP mode) then we'll create
a fake AP and add it to the scan list.

Once the supplicant has associated to the AP, it'll notify about the
current BSS which we then look up in the scan list, and set
priv->current AP to that.  If for some reason the given AP isn't yet
in our scan list (which often happens for adhoc/AP) then we'll just
live with the fake AP until we get the scan result, which should happen
very soon.

We don't need to do any fuzzy-matching to find the current AP because
it will either always be one the supplicant knows about, or a fake one
that the supplicant doesn't know about that will be replaced soon anyway.
2015-04-10 10:17:44 -05:00
Dan Williams
6b8df2035e wifi: use a hash table to track access points 2015-04-10 10:17:44 -05:00
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
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