Commit Graph

12256 Commits

Author SHA1 Message Date
Dan Williams
e482f853f6 wifi: remove supplicant-forgotten current AP from list on disconnect
NM never removes the current AP from the AP list, to prevent NM from
indicating that it's connected, but to nothing.  But the supplicant
can remove that AP from its list at any time (out of range, turned off,
etc), leading to a priv->current_ap that is no longer known to the
supplicant but still exists in the NM AP list.  Since the supplicant
has forgotten it, NM will never receive a removal signal for it.

To ensure that a supplicant-forgotten priv->current_ap is removed
from the NM AP list when priv->current_ap is cleared or changed, mark
any AP removed by the supplicant as 'fake'.  It will then always be
removed in set_current_ap() and not linger in the AP list forever like
a zombie.
2015-05-06 15:14:06 -05:00
Dan Williams
910c62d8c7 wifi: follow supplicant's scan list instead of managing AP lifetime internally
Instead of tricky logic to merge APs and age them, just tell the
supplicant what our aging parameters are, and rely on it to handle
removal from the list.  Notable behavioral changes are:

* APs will now be removed when they haven't been seen for two
consecutive scans in which they would have been included.  This
means that when the scan interval is short, out-of-range APs will
be removed much more quickly than the previous 360 seconds.

* APs now live at most 250 seconds (twice our longest scan interval)
instead of the previous 360 seconds.

* The problem with wpa_supplicant < 2.3 not notifying that a BSS has
been seen in the scan if none of its properties actually changed is
now avoided, because an AP is only removed when the supplicant removes it

In general these changes should make the scan list more responsive, at
the cost of slightly more instability in the list due to the unreliability
of WiFi scanning.  But it also removes a layer of complexity and
abstraction from NetworkManager, pushing the scan results list closer
to that which the hardware reports.
2015-05-06 15:14:06 -05:00
Dan Williams
be370859ef wifi: condense AP list dump log message
Remove the trailing message, and indicate when the last scan
took place and when the next one will happen.
2015-05-06 15:14:06 -05:00
Dan Williams
6ee7e22acb wifi: make nm_ap_dump() print on one line 2015-05-06 15:14:04 -05:00
Dan Williams
f575c6a5cb dns: clear error before updating resolv.conf
If the resolv.conf method failed, don't trigger a warning by overwriting
an already-set error.
2015-05-06 14:55:46 -05:00
Thomas Haller
113a4bcb21 test: move some old tests to nm-test-utils.h 2015-05-06 17:23:33 +02:00
Dan Williams
5b1cde1bfc vpn: don't fail if no system secrets exist
The VPN connection requests secrets a few times; first it retrieves
only system-owned secrets to see if they are sufficient (and thus
doesn't need to bother the user), then it retrieves existing agent
owned secrets (so the user doesn't get a popup), then finally if
those aren't sufficient it asks the user interactively.

But if there was some error retrieving system secrets, or if there
weren't any system secrets at all, don't fail the VPN connection.
Just go on and ask the user for the secrets.
2015-05-05 15:51:25 -05:00
Thomas Haller
9847ab7147 core: merge branch 'th/reload-ignore-carrier-bgo748050'
Make the main.ignore-carrier configuration option reloadable
via our usual SIGHUP mechanism.

https://bugzilla.gnome.org/show_bug.cgi?id=748050
2015-05-05 16:57:25 +02:00
Thomas Haller
8ebb8d0d0f device: allow reloading of the ignore-carrier flag
Now on SIGHUP, when reloading NetworkManager configuration, also reload
the ignore-carrier flag.

While a device is activated, the reload is ignored until the device
deactivates.

Maybe it would be simpler just not to cache ignore_carrer and let it
take effect immediately. But not caching ignore_carrer has the
additional downside that every call to is_available must check the
specs -- which in sum is potentially expensive for something that
almost never changes.

https://bugzilla.gnome.org/show_bug.cgi?id=748050
2015-05-05 16:53:51 +02:00
Thomas Haller
2d333a1769 config: make ignore-carrier option reloadable
Only move the ignore-carrier option from NMConfig to
NMConfigData. The ignore-carrier option is still
immutable after startup.

https://bugzilla.gnome.org/show_bug.cgi?id=748050
2015-05-05 16:51:19 +02:00
Thomas Haller
4d4f5fff5c core: merge branch 'th/waitpid-bgo748885'
https://bugzilla.gnome.org/show_bug.cgi?id=748885
2015-05-05 16:39:27 +02:00
Thomas Haller
22bfe2feb2 dispatcher: repeat waitpid() call on EINTR
Also, no use of first trying to kill() with signal zero. Just
send SIGKILL right away.
2015-05-05 16:39:18 +02:00
Thomas Haller
5f0c23f106 dns-manager: fail dns config if netconfig exits with non-zero status
If netconfig does not exit with zero status signal, assume
configuration failed and signal an error.
2015-05-05 16:39:18 +02:00
Thomas Haller
6b646a1e37 dns-manager: use nm_utils_kill_child_sync() to wait for netconfig to exit 2015-05-05 16:39:18 +02:00
Thomas Haller
ca4361bd53 utils: preserve errno in nm_utils_kill_child_sync() 2015-05-05 16:39:17 +02:00
Lubomir Rintel
aa5cfdd7e1 build: don't drop libnm-util/nm-version.h on clean
Same behavior as for libnm-core/nm-version.h. It's created by configure,
not built with make. Removing it breaks 'make clean; make'
2015-05-05 13:34:19 +02:00
Lubomir Rintel
66c3b673e3 build: work around automake-1.15 & intltool complaining about translations in build dir
make distcheck runs a build in dist directory subtirs and then runs intltool -m
which in turn complains about translations in a built file:

  The following files contain translations and are currently not in use. Please
  consider adding these to the POTFILES.in file, located in the po/ directory.

  sub/policy/org.freedesktop.NetworkManager.policy.in

The issue is reported to intltool upstream already:
https://bugs.launchpad.net/intltool/+bug/1117944
2015-05-05 13:34:19 +02:00
Jiří Klimeš
85afd9a69d cli: (trivial) move DEFINE_SETTER_STR_LIST_MULTI to the right place 2015-05-05 10:08:09 +02:00
Thomas Haller
76ba548959 platform: fix memleak in build_rtnl_addr() using wrong put() method
'struct nl_addr' and 'struct nl_object' have non-compatible put()
functions.
2015-05-05 04:19:00 +02:00
Yuri Chornoivan
e397553acc po: updated Ukranian translation (bgo #748905)
https://bugzilla.gnome.org/show_bug.cgi?id=748905
2015-05-04 18:44:39 +02:00
Thomas Haller
0731da16fa valgrind: add libnl suppression
Got this on F21, libnl 3.2.25-5.fc21
2015-05-04 18:41:15 +02:00
Thomas Haller
f614ebe6f5 platform: re-enable the platform link test
The link test was disabled in commit 67ad3fcb5b.

The previous issues are not fixed, but apparently disabling the test doesn't
help to get it fixed.

Re-enable it and if it fails we have a better reason to fix it.
Or maybe it works now (?). Didn't fail for me...
2015-05-04 18:41:15 +02:00
Thomas Haller
b22bf15c1d platform: fix root-tests after adding link detection without udev
Co-Authored-By: Lubomir Rintel <lkundrak@v3.sk>

Fixes: 388b7830f3
2015-05-04 18:41:15 +02:00
Thomas Haller
7572837375 platform: keep udev-device in udev_device_added() even if there is no netlink object
Throwing away the udev_device instance is wrong. There are two cases:

- the udev-device appears, and the netlink object will never appear
  (or is already gone). In this case, keeping the udev-device is ok
  because we will eventually get a signal from UDev to cleanup the
  device instance.

- the udev-device appears before the netlink object. In this case we
  want to keep the udev instance to have it ready.

Fixes: 388b7830f3
2015-05-04 18:41:15 +02:00
Yuri Chornoivan
f851a741a6 fix typo and do not translate an empty string
https://bugzilla.gnome.org/show_bug.cgi?id=748906
2015-05-04 18:36:54 +02:00
Thomas Haller
575d8186e4 test/trivial: use new EXIT_SKIP return value instead of 77 2015-05-04 13:51:12 +02:00
Thomas Haller
a8c158dbec dns-manager: fix missing include
dns-manager must include <gio/gio.h> itself. Otherwise
compilation only works with WITH_LIBSOUP, which includes
<gio/gio.h> via <libsoup/soup.h>.

This is an old error, but unnoticed until ad6dbc504b
which makes use of gio.h also without NETCONFIG_PATH.
2015-05-04 11:44:13 +02:00
Beniamino Galvani
ad6dbc504b dns: merge branch 'bg/resolv-conf-bgo747821'
https://bugzilla.gnome.org/show_bug.cgi?id=747821
2015-05-04 09:47:15 +02:00
Beniamino Galvani
b1a81e5165 man: document 'rc-manager' option 2015-05-04 09:42:25 +02:00
Beniamino Galvani
e573977b80 dns: allow runtime selection of resolv.conf manager
Add a new 'rc-manager' configuration parameter that allows to select
the strategy used to write resolv.conf; currently supported values
are: none|resolvconf|netconfig, 'none' meaning that NM directly writes
the file.

The default value of the parameter is 'none'; however if a
RESOLVCONF_PATH (or NETCONFIG_PATH) is specified at build time, the
default value will be 'resolvconf' (or 'netconfig').
2015-05-04 09:42:25 +02:00
Beniamino Galvani
de0d623680 dns: don't fall back to other methods when resolvconf or netconfig fail 2015-05-04 09:42:25 +02:00
Beniamino Galvani
5f9d348c20 dns: always write a private resolv.conf to runtime directory
https://bugzilla.gnome.org/show_bug.cgi?id=747821
2015-05-04 09:42:25 +02:00
Thomas Haller
f529fedd17 test: fix parsing of command line arguments for setting nmtst_test_quick()
glib interprets the options either as "-m arg" or "-m=arg". Fix parsing
to check for both cases.

Also, g_test_init() removes the parsed options from argv, hence we must
check our original copy in __nmtst_internal.orig_argv.

Now the following all have the same outcome:

  $ NMTST_DEBUG=no-debug,quick ./src/rdisc/tests/test-rdisc-fake
  $ ./src/rdisc/tests/test-rdisc-fake -m quick
  $ ./src/rdisc/tests/test-rdisc-fake -m=quick

Fixes: a2edd6445f
2015-05-04 09:16:31 +02:00
Dan Williams
e52dac9887 trivial: update .gitignore for new rdisc tests 2015-05-01 16:48:53 -05:00
Dan Williams
624c1c52ac merge: fix continuous router solicitation loop issue with DNS expiry (rh #1207730) (bgo #748085) 2015-05-01 16:38:17 -05:00
Dan Williams
19fa547d5d rdisc: prevent solicitation loop for expiring DNS information (rh #1207730) (rh #1151665)
A solicitation loop could result for two cases:

1) a router sent DNS information, then removed that information without
sending it with lifetime=0
2) two routers exist, one sending DNS information and the other not, and
the first router which sends DNS information disappears

In these cases a solicitation would be generated when the DNS information
reached 1/2 its lifetime.  A router would then reply to the solicitation
without DNS information, which would then trigger another lifetime check,
which finds that the DNS info is still 1/2 lifetime.  Which triggers
another solicitation, etc.

Fix this by ensuring that a solicitation is never sent less than
rtr_solicitation_interval seconds after the last one.
2015-05-01 16:35:47 -05:00
Dan Williams
b324b970bc rdisc: fix double-addition of gateways & routes if priority increases
If a route or gateway's priority increased, the item would be added
to the array again without removing the older entry.  At the same time
don't bother adding an item with a zero lifetime, since it will just
be removed again by the clean_* functions.
2015-05-01 16:35:47 -05:00
Dan Williams
32058d1928 rdisc: split fake & linux test code; add testcases 2015-05-01 16:35:45 -05:00
Dan Williams
527eeb6d68 rdisc: fix leak of DNS domains 2015-05-01 16:30:33 -05:00
Dan Williams
8d9ee6d8e8 rdisc: move most RA processing logic into base class
Instead of having it all in the Linux implementation, move all the
timeout logic and most of the processing logic into the NMRDisc
base class so that it can be used by NMFakeRDisc as well. This
will help increase testability since now we can test the timeout
and expiry logic from the fake plugin too.
2015-05-01 16:30:32 -05:00
Dan Williams
67033ddab1 rdisc: add missing chain up to parent finalize/dispose 2015-05-01 16:27:24 -05:00
Thomas Haller
a2edd6445f test: add nmtst_test_quick()
Utility function for long-running tests to check whether
they should run. It has the same use as g_test_quick(),
but it can also be set via NMTST_DEBUG environment variable.

You can set the compile time default via

  CFLAGS='-DNMTST_TEST_QUICK=FALSE' ./configure

and overwrite it at runtime via

  NMTST_DEBUG=no-default,quick ./tests/test-my
2015-05-01 16:27:23 -05:00
Thomas Haller
7c705325a4 test: add EXIT_SKIP define 2015-05-01 16:27:23 -05:00
Thomas Haller
f53fda9fd6 Revert "core: treat ECHILD as child already terminated"
This reverts commit 268da271cc.

This breaks the test, but it is not clear that this is the
right fix. Revert for now, needs still investigation.
2015-05-01 23:14:38 +02:00
Dan Williams
4f05261af8 merge: don't wait for udev before announcing links; other cleanups (bgo #747628) (bgo #743209) 2015-05-01 14:30:58 -05:00
Thomas Haller
3171b543dc platform: intern driver string for NMPlatformLink
Always intern string from udev_get_driver().

We use the result of udev_get_driver() for setting NMPlatformLink.driver.
In all other cases, we already set that value to an interned string,
which simplifies memory handling.

As it was, the lifetime of that string was tied to the lifetime of the
GUdevDevice.

This is not a stelar solution, but we assume that the overall numbers
of different drivers is limited so we don't leak large amounts of
memory.
2015-05-01 14:26:40 -05:00
Thomas Haller
e2c742c77b platform: refactor extraction of type-name for link
link_extract_type() would return the NMLinkType and a
@type_name string. If the type was unknown, this string
was rtnl_link_get_type() (IFLA_INFO_KIND).

Split up this behavior and treat those values independently.
link_extract_type() now only detects the NMLinkType. Most users
don't care about unknown types and can just use nm_link_type_to_string()
to get a string represenation.

Only nm_platform_link_get_type_name() (and NMDeviceGeneric:type_description)
cared about a more descriptive type. For that, modify link_get_type_name()
to return nm_link_type_to_string() if NMLinkType could be detected.
As fallback, return rtnl_link_get_type().

Also, rename the field NMPlatformLink:link_type to "kind". For now this
field is mostly unused. It will be used later when refactoring platform
caching.
2015-05-01 14:26:39 -05:00
Thomas Haller
b538adf123 platform: expose nm_link_type_to_string() function
Given the name nm_link_type_to_string(), we would not expect
to find it in nm-linux-platform.c. It either should be named
nm_platform_link_type_to_string() and be put in a new
nm-platform-utils.c file, or it should be named
nm_utils_link_type_to_string() and be put in NetworkManagerUtils.h.

For now, just leave it here.
2015-05-01 14:25:59 -05:00
Dan Williams
268da271cc core: treat ECHILD as child already terminated
prevents:

NetworkManager[2775]: <error> [1429889302.113450] [NetworkManagerUtils.c:576]
   nm_utils_kill_child_async(): kill child process 'teamd' (3025): failed due
   to unexpected return value -1 by waitpid (No child processes, 10) after
   sending SIGTERM (15)
2015-05-01 14:25:59 -05:00
Thomas Haller
18d611d5d2 platform: detect TUN/TAP device in link_extract_type() independently of platform cache
link_extract_type() would call tun_get_properties() to determine whether
the link if a TAP or TUN device. The previous implementation would
receive the ifindex, and resolve the ifname via lookup in the platform
cache.
This means, the call on link_extract_type() will only succeed to detect
the TUN/TAP properties, if the libnl object is already in the cache.
Currently that is always the case and there is no problem.

It is desireable, that we can resolve the link type of an object without
consulting the platform cache first.
2015-05-01 14:25:59 -05:00