Commit Graph

21088 Commits

Author SHA1 Message Date
Thomas Haller
7087956870 supplicant/tests: work-around coverify false-positive in test
NetworkManager-1.8.0/src/supplicant/tests/test-supplicant-config.c:528: check_return: Calling "nm_setting_802_1x_set_ca_cert" without checking return value (as is done elsewhere 13 out of 16 times).
2017-06-02 19:51:11 +02:00
Thomas Haller
f1eb1619f1 connectivity: fix scheduling periodic connectivity checks
commit a955639 (connectivity: don't do periodic checks on interval=0)
broke scheduling connectivity checks.

That is because the timer is on only scheduled if
nm_connectivity_check_enabled(), which in turn only returns TRUE
if curl_mhandle is set. However, nm_connectivity_init() would only
initialize curl_mhandle after update_config(), missing to schedule
the periodic task.

https://mail.gnome.org/archives/networkmanager-list/2017-May/msg00076.html

Fixes: a95563996f
2017-06-02 19:15:30 +02:00
Thomas Haller
ea6648cea1 all: replace uses of inet_aton() and friends
rpmdiff complains about uses of inet_aton, inet_makeaddr, inet_netof,
inet_ntoa under the IPv6 section:

   usr/sbin/NetworkManager on aarch64 i686 x86_64 ppc ppc64 ppc64le s390 s390x uses function inet_aton, which may impact IPv6 support

I think the warning is bogus, but refactor our code to avoid it.

Note that systemd code still uses them, so it don't avoid the rpmdiff
warning. But let's not diverge our systemd import from upstream for this.

- for NMSettingBond:validate_ip() also avoid g_strsplit_set() which
  allocates a full strv. Instead, we can do with one g_strdup().

- for test-resolvconf-capture.c, replace the functions with macros.
  Macros should be avoided usually, but for test asserts they are
  more convenient as they preserved the __FILE__:__LINE__ of where
  the assertion fails.
2017-06-02 14:07:10 +02:00
Lubomir Rintel
c0419257e7 all: reject duplicate keys in JSON
Teamd is not happy about them and would fail anyway. Worse even, if we
json_loads() such a JSON, which is precisely what happens when we inject the
"hwaddr" key, we turn bad JSON into a good one in a lossy matter. Not good.

https://bugzilla.redhat.com/show_bug.cgi?id=1455130
2017-06-01 13:30:21 +02:00
Thomas Haller
484d666485 build: fix nm binutils tool when building with LTO
When building with -flto, we need to use linker plugins.
In case of binutils' nm, it means to prefer gcc-nm if
available.

Like for ranlib and ar, prefer gcc-nm.

- replace AC_PATH_TOOL() by AC_CHECK_TOOLS(). That is consistent
  with what we do for ar,ranlib and suggested on bgo#783311.
- instead of using the variable $BINUTILS_NM, replace it by
  $NM, which is more common according to bgo#783311.
- Keep recognizing $BINUTILS_NM environment, which was introduced
  by commit 8bc88bcc7c. This is purely to keep previous build
  scripts working. Originally I named it "$BINUTILS_NM" because
  using $NM in NetworkManager seemed confusing. But well...

https://bugs.gentoo.org/show_bug.cgi?id=620052
https://bugzilla.gnome.org/show_bug.cgi?id=782525
https://bugzilla.gnome.org/show_bug.cgi?id=783311
2017-06-01 12:51:31 +02:00
Lubomir Rintel
afebdc795d build: add a missing test artifact to dist
Fixes: ba05819c89
2017-06-01 12:47:43 +02:00
Lubomir Rintel
f9b1bc16e9 merge: branch 'lr/bluetooth-nap'
https://bugzilla.gnome.org/show_bug.cgi?id=783013
2017-06-01 12:37:02 +02:00
Lubomir Rintel
bf7e86128c bridge: move the Bluetooth NAP logic to bridge device
The Bluetooth NAP functionality seems only useful for the bridges. Move
it away from NMDevice.
2017-06-01 11:57:42 +02:00
Thomas Haller
b0f9571d3d libnm: add _nm_connection_get_setting_bluetooth_for_nap()
If there is value in such a helper function (there is), then
it should go alongside the other nm_connection_get_setting*()
helpers. NMDevice is already large enough.
2017-06-01 11:28:57 +02:00
Thomas Haller
1be01bd51f device: don't include header of bluetooth plugin in nm-device.h
The plugins may use stuff from core, but not the other way around.
Including "bluetooth/nm-bluez-common.h" is wrong.

The UUID argument is always "nap" in the NAP case. We don't need
the flexibility that it might be anything else. Just drop it.

As far as NMDevice is concerned, it anyway wouldn't (or shouldn't
know what the uuid is. It says register, and NMBluez5Manager should
figure out the details.
2017-06-01 11:28:57 +02:00
Lubomir Rintel
29a0876db6 bluetooth: emit component-added when a network server is added 2017-06-01 11:28:57 +02:00
Lubomir Rintel
d6f2a2e73c bluetooth: expose known HCI adapters to devices
They may register the Bluetooth NAP enabled bridges for Bluez to enslave their
BNEP links to.
2017-06-01 11:28:57 +02:00
Lubomir Rintel
53482c38e2 device: register a bridge for Bluetooth NAP with Bluez
Bluez needs to know about then so that it can eventually enslave the BNEP links
for PANU client connections to it.
2017-05-31 20:18:24 +02:00
Lubomir Rintel
b866a12667 device: retry autoactivation upon a component addition
It might have changed circumstances that were blocking the autoactivation.
2017-05-31 20:18:12 +02:00
Lubomir Rintel
805d3240f9 devices/factory: allow announcing a NULL component
We'll use this to let the devices know they can retry autoactivation
because some component became available without actually having any
data that would be useful for that device.

Adjust the comment.
2017-05-31 20:17:54 +02:00
Lubomir Rintel
aedeb3cbf4 clients: add support for Bluetooth NAP type 2017-05-31 20:17:42 +02:00
Lubomir Rintel
ab46c9c70c clients: allow bridge settings for Bluetooth devices
Will be useful for Bluetooth NAP.
2017-05-31 20:17:39 +02:00
Lubomir Rintel
63292b5c41 core/connection: normalize bridge settings into bluetooth NAP connections
For the Bluetooth NAP we need a Bridge link for the BlueZ to assign the BNEP
links for PANU client connections into.

Let's disable STP by default -- it adds extra delay for the Bridge when the
BNEP link is assigned and is likely not useful for a typical client.
2017-05-31 20:17:16 +02:00
Lubomir Rintel
7c5a2be966 core/bluetooth: add NAP type 2017-05-31 20:15:52 +02:00
Lubomir Rintel
2c1a178f5b core: negotiate the best base setting
When the two base settings are present, use one of higher priority.

This will pick the "bridge" setting when both "bridge" and "bluetooth" are
present for a Bluetooth NAP connection.
2017-05-31 20:15:24 +02:00
Lubomir Rintel
7b5712acd2 core: allow two priorities of base settings
We'll need two "base" settings for Bluetooth NAP connections: bridge to set up
the actual link and bluetooth to identify the HCI to register the network
server with.

Let's use two priorities for base setting, with "1" marking one of higher
priority and "2" of lower priority when both are present.
2017-05-31 20:15:01 +02:00
Lubomir Rintel
02e527f644 core/connections: pick base setting from settings the connection actually has
We will need multiple base settings for Bluetooth NAP servers: bluetooth and
bridge. We want to identify the device as "bluetooth" to the user, but leave
the Bridge factory handle it.

The "connection.type" is somewhat redundant -- let's keep it for what the user
sees. And identify the actual base setting to pick the right factory by the
actually present setting.
2017-05-31 20:14:17 +02:00
Lubomir Rintel
15daf29220 bluez5: avoid leaking the interface dictionary 2017-05-31 20:11:46 +02:00
Lubomir Rintel
1bb751b9d1 bluez5: use _NMLOG 2017-05-31 20:11:15 +02:00
Lubomir Rintel
28505ae92b build: don't drop the test suite log on failure
Fixes: 2198f73b0e
2017-05-31 20:11:11 +02:00
Lubomir Rintel
1a20611f66 bluetooth/trivial: rename the defines 2017-05-31 20:10:30 +02:00
Lubomir Rintel
43c43d5e3a bluetooth: streamline NMBluez5Manager teardown a bit 2017-05-31 20:05:53 +02:00
Lubomir Rintel
c22672b383 libnm-core: fix verify() implementations to allow connection=NULL 2017-05-31 20:05:53 +02:00
Lubomir Rintel
0d71c0569f ifcfg: drop an unused variable 2017-05-31 19:50:58 +02:00
Thomas Haller
b8707cba3c platform/tests: minor fix in _wait_for_ipv6_addr_non_tentative()
For better or worse, there is a platform argument. Use it instead
of the singleton.
2017-05-31 11:01:52 +02:00
Thomas Haller
902085c879 platform/tests: merge minor refactoring of route-tests 2017-05-31 10:53:32 +02:00
Thomas Haller
d6aae6af72 platform/tests: reorder wait-loop in test_ip6_route_options()
- no need to call nm_platform_process_events() after
  nmtstp_wait_for_signal(). The latter processes all events
  that are pending.
- with addr_n number of addresses, we still only want to wait
  a maximum time, not for each addresss individually. Basically,
  the for-loop must be inside NMTST_WAIT(), not the other way around.
2017-05-31 10:46:43 +02:00
Thomas Haller
07751b444b platform/tests: make timeout_ms argument for nmtstp_wait_for_signal() signed
Having an unsigned "guint timeout_ms" argument is very inconvenient, because

    nmtstp_wait_for_signal (NM_PLATFORM_GET (), end_time - now_time);

might easily be negative. In such a case, the correct behavior
is to wait not at all.
2017-05-31 10:46:43 +02:00
Thomas Haller
af9c474844 platform/tests: change nmtstp_wait_for_signal() to wait with zero timeout
The previous behavior, of treating timeout_ms as *no timeout*, makes
no sense. At least not for unit tests. If you have a really long timeout,
then set it. "0" should really mean to schedule a zero timeout.
2017-05-31 10:46:43 +02:00
Thomas Haller
75f3c026eb shared/tests: expose end-time from NMTST_WAIT() macro 2017-05-31 10:46:43 +02:00
Thomas Haller
5235b1740f shared/tests: document how to disable slow tests at compile-time 2017-05-31 10:46:43 +02:00
Francesco Giudici
21a941d40b platform/tests: fix test_ip6_route_options
when adding a route with RTA_PREFSRC some kernel versions will reject
the request if the specified source address is still tentative: be sure
that the just added addresses are no more tentative before adding the
routes.
2017-05-30 19:00:54 +02:00
Thomas Haller
84f2d226b5 ifcfg-rh: fix build failure in write_wired_setting()
Fixes: f80d0eb29e
2017-05-30 18:27:37 +02:00
Thomas Haller
159cd4836f libnm: fix rejecting NMSettingVlan with id >= 4095
Without it, clients can wrongly create VLan settings with
ID 4095, which triggers assertions in NetworkManager.

Fixes: 8715d61437
2017-05-30 18:12:57 +02:00
Thomas Haller
f80d0eb29e ifcfg-rh: use svSetValueInt64_cond() to write MTU value 2017-05-30 16:37:28 +02:00
Thomas Haller
80c0a37b47 ifcfg-rh: add svSetValueInt64_cond()
There are a lot of places where we want to either write a number,
or conditionally clear it. Like:

    mtu = nm_setting_wireless_get_mtu (s_wireless);
    if (mtu)
        svSetValueInt64 (ifcfg, "MTU", mtu);
    else
        svUnsetValue (ifcfg, "MTU");
2017-05-30 16:35:13 +02:00
Thomas Haller
3443f25001 tui: use nm_streq0() in nmt_connect_connection_list_get_connection() 2017-05-30 14:33:23 +02:00
Arnaud Lefebvre
1fcbb69ae2 nmtui connect: avoid segfault when iface is not found
https://github.com/NetworkManager/NetworkManager/pull/21
2017-05-30 14:30:30 +02:00
Thomas Haller
70c0f7965d ifcfg-rh: merge branch 'th/ifcfg-netmask-legacy-rh1445414'
https://bugzilla.redhat.com/show_bug.cgi?id=1445414
2017-05-30 13:40:51 +02:00
Thomas Haller
263c5b9207 ifcfg-rh: cleanup writer by using numbered_tag() helper 2017-05-30 13:40:34 +02:00
Thomas Haller
afc76d78ed ifcfg-rh: move numbered_tag() util to "nms-ifcfg-rh-utils.h" header 2017-05-30 13:40:34 +02:00
Thomas Haller
844bf3d1a2 ifcfg-rh: fix preserving NETMASK key in write_ip4_setting()
To support legacy scripts, we want to write out the NETMASK
key whenever the ifcfg file has a NETMASK key previously.
Note, that we anyway always write the relevant PREFIX key.
The NETMASK is redundant, only there to help legacy scripts.

That was broken, because we would svUnsetValue("NETMASK") before
checking whether the NETMASK key is present.

Also, when saving a connection to ifcfg-rh file that was created
by other tools, we might mix up the numbering. E.g. we never
write out IPADDR0. Hence, turn on legacy mode whenever the ifcfg-rh
file has any key starting with "NETMASK".
2017-05-30 13:39:15 +02:00
Thomas Haller
ba05819c89 ifcfg-rh/tests: add test for reading NETMASK property 2017-05-30 11:10:19 +02:00
Thomas Haller
371b761680 build: sort filenames in Makefile.am alphabetically 2017-05-30 11:10:19 +02:00
Thomas Haller
e9d960740a ifcfg-rh: add svFindFirstKeyWithPrefix() function 2017-05-30 11:10:19 +02:00