Commit graph

22057 commits

Author SHA1 Message Date
Beniamino Galvani
797eab2f6b vpn: add route to vpn gw when parent has a default device route
When the parent device has a device default route (i.e. without
gateway) and we establish a VPN on top of it, 'ip route get' for the
VPN gateway returns a device route, which is the same result we get
for an unreachable VPN gateway. However it is necessary to add the
route to the gateway or otherwise it will possibly become unreachable
once the VPN gets activated.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/93
2019-02-04 11:07:02 +01:00
Beniamino Galvani
483dc40047 build: merge branch 'bg/lto'
Fix LTO builds.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/76
https://bugzilla.gnome.org/show_bug.cgi?id=782525#c4
2019-02-04 10:56:25 +01:00
Thomas Haller
9891217a78 contrib/rpm: add option to enable LTO for RPM build 2019-02-04 10:55:25 +01:00
Thomas Haller
c77871e5e9 all: avoid bogus compiler warning about uninitialized variable
With LTO and optimizations, gcc issues several bogus
"maybe-uninitialized" warnings.

Work-around them by initializing the variables.
2019-02-04 10:55:25 +01:00
Thomas Haller
14957e914a tests: use NM_CONST_MAX() macro where a constant expression is required
Otherwise, "nm-utils/nm-test-utils.h" won't work after we
include systemd headers.
2019-02-04 10:55:25 +01:00
Thomas Haller
b52d3e2ad3 shared: add NM_CONST_MAX() macro
There is:

 1) glib's MAX() macro, which evaluates arguments multiple times,
    but yields a constant expression, if the arguments are constant.

 2) NM's NM_MAX() macro, which evaluates arguments exactly once,
    but never yields a constant expression.

 3) systemd's MAX() which is like NM_MAX().

Now, it's sensible to use

    char buf[MAX (A_CONSTANT, ANOTHER_CONSTANT)];

and this works with glib's variant (1).

However, when we include systemd headers, 1) gets redefined to 3), and
above no longer works. That is because we we don't allow VLA and systemd's
macro gives not a constant expression.

Add NM_CONST_MAX() macro which is like systemd's CONST_MAX(). It can
only operate on constant arguments.
2019-02-04 10:55:25 +01:00
Beniamino Galvani
e6cf4213a7 build: fix building with LTO
Building with link-time optimization requires some tricks explained
in [1].

[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=48200#c28
2019-02-04 10:55:25 +01:00
Beniamino Galvani
b114b00f0a shared: convert macro argument to lowercase 2019-02-04 10:55:25 +01:00
Thomas Haller
43a12462e0 platform/tests: increase timeout for platform tests
Seems 180 seconds is still not enough for "/link/create-many-links/1000"
tests on gitlab-CI.
2019-02-04 10:52:19 +01:00
Thomas Haller
027ef98cd4 wifi-p2p: merge branch 'th/wifi-p2p-various' (pt1)
https://github.com/NetworkManager/NetworkManager/pull/290
2019-02-01 17:34:07 +01:00
Thomas Haller
0ec30f8904 clients/trivial: move code in nm-meta-setting-desc around
Sort by name.
2019-02-01 17:02:57 +01:00
Thomas Haller
09090f2669 wifi-p2p: rename Wi-Fi P2P
After renaming the files, also rename all the content
to follow the "Wi-Fi P2P" naming scheme.
2019-02-01 17:02:57 +01:00
Thomas Haller
0420fa1f2c wifi-p2p: rename files for consistent Wi-Fi P2P naming
We named the types inconsistently:

  - "p2p-wireless" ("libnm-core/nm-setting-p2p-wireless.h")

  - "p2p" ("libnm/nm-p2p-peer.h")

  - "p2p-wifi" ("src/devices/wifi/nm-device-p2p-wifi.h")

It seems to me, "libnm/nm-p2p-peer.h" should be qualified with a "Wi-Fi"
specific name. It's not just peer-to-peer, it's Wi-Fi P2P.
Yes, there is an inconsistency now, because there is already
"libnm/nm-access-point.h".

It seems to me (from looking at the internet), that the name "Wi-Fi P2P"
is more common than "P2P Wi-Fi" -- although both are used. There is also
the name "Wi-Fi Direct". But it's not clear which name should be
preferred here, so stick to "Wi-Fi P2P".

In this first commit only rename the files. The following commit will
rename the content.
2019-02-01 17:02:57 +01:00
Thomas Haller
c8204377d6 core/device-p2p-wifi: drop unused code
If this is going to be implemented, revert the patch.
2019-02-01 17:02:57 +01:00
Thomas Haller
37da2d8a06 core/device-p2p-wifi/trival: move code
Have the class_init() function at the bottom.
2019-02-01 17:02:57 +01:00
Thomas Haller
43aa288fd8 core/p2p-wifi: various minor cleanups 2019-02-01 17:02:57 +01:00
Thomas Haller
6e45cd900c libnm/device-p2p-wifi: drop API that still needs consideration
Having synchronous API is wrong, or at least questionable.
Granted, libnm isn't currently very good about the exact order
of things to happen. However synchronous API by design delays events
while waiting for the response and hence messes up the ordering.

Maybe synchronous API should not be added to libnm.

Or at least, if we have synchronous API, we certainly need an asynchrnous
variant as well (which is still missing).

As synchronous API is not preferred, it should also be named
nm_some_thing_sync(), accompanied by nm_some_thing() and
nm_some_thing_finish(). The name for the synchronous method should be the
odd one and we shouldn't have an nm_some_thing_async(). Yes, libnm is not
consistend about that.

I am going to drop this API for the moment.
2019-02-01 17:02:57 +01:00
Thomas Haller
65c4af50c4 libnm-core/setting-p2p-wifi: drop unused code
If this is going to be implemented, revert the patch.
2019-02-01 17:02:57 +01:00
Thomas Haller
4f8852b2f2 libnm/device-p2p-wifi: drop unused code
If this is going to be implemented, revert the patch.
2019-02-01 17:02:57 +01:00
Thomas Haller
c6c41eb17a libnm: various cleanup of NMP2PPeer and NMDeviceP2PWifi
- fix leaking hw_address in finalize().

- reorder code.

- avoid double tabs in GObject property definitions.

- hide struct definitions from header.

- don't use signal slots in class structure.

- use NM_GOBJECT_PROPERTIES_DEFINE_BASE().

- add missing NM_AVAILABLE_IN_1_16 annotations.
2019-02-01 17:02:57 +01:00
Thomas Haller
41b2d8c6c9 libnm/device-p2p-wifi: cleanup peers handling
Don't reallocate peers-array nor set it to %NULL. Instead,
just emit the signal for the peers and take them out one-by-one.

I am slightly surprised, that the peers array does not need to hold
a reference on the NMP2PPeer instances. But that seems intentional.
I think, the libnm code here should be significantly reworked, but
that is for another time.

Also, delay clearing the pointers until finalize() method. For
the most part, it shouldn't make a difference. Still avoid having
the instance in a badly defined state during dispose() (which
theoretically could be called multiple times).
2019-02-01 17:02:57 +01:00
Thomas Haller
efbcac25b8 libnm-core: fix and cleanup validation of WPS-method for Wi-Fi P2P setting
The check for Wi-Fi P2P's wps-method was not correct.

While at it, move the logic to validate WPS-method flags in an utility
function.
2019-02-01 17:02:57 +01:00
Thomas Haller
ab5b6f6f81 libnm-core: minor cleanup of NMSettingP2PWireless 2019-02-01 17:02:57 +01:00
Thomas Haller
4ac6c7fdf1 all/trivial: whitespace 2019-02-01 17:02:57 +01:00
Thomas Haller
2d649305f8 cli/trivial: order code in "nm-meta-setting-desc.c" alphabetically 2019-02-01 17:02:57 +01:00
Thomas Haller
c5c509634a introspection/docs: add missing "Since" comments to Wi-Fi P2P D-Bus API 2019-02-01 17:02:57 +01:00
Thomas Haller
e491cdcf57 connectivity: merge branch 'th/connectivity-empty-response'
https://github.com/NetworkManager/NetworkManager/pull/285
2019-01-31 11:33:45 +01:00
Thomas Haller
930c7d2d22 man: better explain "connectivity.response" in "NetworkManager.conf" manual 2019-01-31 11:33:45 +01:00
Thomas Haller
477e91d753 connectivity: don't cache HTTP response for comparing connectivity response
We don't need to remember (and compare) all the bytes that we received.
We can just compare them right away, and remember how many good bytes
we received.
2019-01-31 11:33:44 +01:00
Thomas Haller
7807ffff83 connectivity: fix handling of no-response for captive portal detection
Since we only compare that the HTTP response starts with the expected
response, we need to handle the empty expected response specially
(because, every response has "" as prefix).

So now if connectivity.response is set to "" (empty) we accept:

- HTTP status code 204. We ignore and accept any extra data that we
  might receive.

- HTTP status code 200 and an empty (or no) body.
2019-01-31 11:33:44 +01:00
Beniamino Galvani
a68b1827ec clients: fix string list setter
Fixes: 5d3736ac65

https://bugzilla.redhat.com/show_bug.cgi?id=1671200
2019-01-31 08:55:19 +01:00
Benjamin Berg
5ae4245be2 manager: Fix GVariant format strings for AddAndActivate2 return value
AddAndActivate2 returns an empty a{sv} dictionary for extensibility. The
format strings to create the methods return value were slightly wrong,
causing assertion failures.

Fixes: fbb038af5e

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/73
2019-01-29 13:30:14 +01:00
Rafael Fontenelle
4cc54941cc po: update Brazilian Portuguese (pt_BR) translation
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/71
2019-01-29 12:44:03 +01:00
Thomas Haller
7d5da12e8e wifi-p2p: don't assert for pending action 'waiting-for-supplicant' in nm_device_p2p_wifi_set_mgmt_iface()
<info>  [1548688998.8282] device (wlan0): supplicant interface state: starting -> ready
 <debug> [1548688998.8282] device[0x55bd55f19f30] (p2p-dev-wlan0): P2P: Releasing WPA supplicant interfaces.
 <debug> [1548688998.8282] device[0x55bd55f19f30] (p2p-dev-wlan0): P2P: WPA supplicant management interface changed to /fi/w1/wpa>
 <warn>  [1548688998.8282] device (p2p-dev-wlan0): remove_pending_action (0): 'waiting-for-supplicant' not pending
 file src/devices/nm-device.c: line 14134 (nm_device_remove_pending_action): should not be reached

   #0  0x00007f2c58dad1e5 n/a (libglib-2.0.so.0)
   #1  0x00007f2c58dae51d g_logv (libglib-2.0.so.0)
   #2  0x00007f2c58dae6f3 g_log (libglib-2.0.so.0)
   #3  0x000055bd55246104 nm_device_remove_pending_action (NetworkManager)
   #4  0x00007f2c487c4864 nm_device_p2p_wifi_set_mgmt_iface (libnm-device-plugin-wifi.so)
   #5  0x00007f2c58e94c73 n/a (libgobject-2.0.so.0)
   #6  0x000055bd55233112 constructor (NetworkManager)
   #7  0x00007f2c58e94e8b n/a (libgobject-2.0.so.0)
   #8  0x00007f2c58e96fde g_object_new_valist (libgobject-2.0.so.0)
   #9  0x00007f2c58e9733d g_object_new (libgobject-2.0.so.0)
   #10 0x00007f2c487c4a65 nm_device_p2p_wifi_new (libnm-device-plugin-wifi.so)
   #11 0x00007f2c487c6655 recheck_p2p_availability (libnm-device-plugin-wifi.so)
   #12 0x00007f2c487c9119 supplicant_iface_state_cb (libnm-device-plugin-wifi.so)
   #13 0x00007f2c58525ace ffi_call_unix64 (libffi.so.6)
   #14 0x00007f2c5852548f ffi_call (libffi.so.6)
   #15 0x00007f2c58e903a6 g_cclosure_marshal_generic_va (libgobject-2.0.so.0)
   #16 0x00007f2c58e8f636 n/a (libgobject-2.0.so.0)
   #17 0x00007f2c58eabb01 g_signal_emit_valist (libgobject-2.0.so.0)

Fixes: 00e64d1332
2019-01-28 16:43:57 +01:00
Thomas Haller
a4f2435d51 NEWS: merge branch 'benzea/news-updates'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/70
2019-01-28 16:42:07 +01:00
Benjamin Berg
3142681bef NEWS: Add an entry for Wi-Fi P2P 2019-01-28 16:16:34 +01:00
Benjamin Berg
6fba839f78 NEWS: Add an entry for NMKeepAlive and DBus client binding 2019-01-28 16:16:30 +01:00
Beniamino Galvani
63b90f0dd1 libnm-core: fix team link-watcher struct layout
As the comment above the union says, structs in the union must have
the same layout of arp_ping. 'vlanid' is in the wrong place and breaks
that.

Fixes: f44c793f6c

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/110
2019-01-28 08:18:09 +01:00
Thomas Haller
ce3f7bf812 wifi-p2p: merge branch 'benzea/p2p-wifi'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/24
2019-01-27 23:46:28 +01:00
Benjamin Berg
d8bc41bb58 libnm: Expose the P2PPeer WfdIEs property 2019-01-27 23:45:12 +01:00
Benjamin Berg
6b74d006e6 libnm: Add routines to start/stop a P2P find operation 2019-01-27 23:45:12 +01:00
Benjamin Berg
dd0c59c468 core/devices: Add DBus methods to start/stop a P2P find
By default the find will run for 30s. This can be increased or decreased
in the range of 1-600s by setting "Timeout" in the options parameter.
2019-01-27 23:45:12 +01:00
Benjamin Berg
6420a2c1fd libnm: Add NMDeviceP2PWifi 2019-01-27 23:45:12 +01:00
Benjamin Berg
adb8338408 libnm: Add class to handle P2P peers
This adds the introspection data and P2P peer handling to libnm. To be
usable the P2P device handling is also needed.
2019-01-27 23:45:12 +01:00
Benjamin Berg
959886892a core/devices: Automatically create P2P device for wifi devices
If a wifi device supports P2P mode, then create a further P2P device for
it automatically.
2019-01-27 23:45:12 +01:00
Benjamin Berg
00e64d1332 core/devices: Add P2P Wifi device and peer tracking
This only adds the new device type and simple peer list handling.
2019-01-27 23:45:12 +01:00
Benjamin Berg
42e60e327f core: Add basic P2P Wi-Fi Settings
The support is rather basic and only allows connecting to a specific
peer. However, this is actually already enough for many usecases.
2019-01-27 23:45:11 +01:00
Lubomir Rintel
c7d6e55ed7 ppp-manager: fix a typo in a debugging statement
Discovered by GCC 9:

  src/ppp/nm-ppp-manager.c: In function ‘_ppp_manager_start’:
  ./src/nm-logging.h:59:9: error: ‘%s’ directive argument is null [-Werror=format-overflow=]

Fixes: 35d9169c3c
2019-01-27 17:24:59 +01:00
Thomas Haller
b707da27d8 gitlab-ci: add test with Fedora:latest image 2019-01-27 15:36:03 +01:00
Beniamino Galvani
76c1b94fe0 clients: update settings doc header file 2019-01-25 11:24:08 +01:00