Commit Graph

18368 Commits

Author SHA1 Message Date
Lubomir Rintel
43012156a3 m4: disable -Wmissing-braces for newer clang
src/NetworkManagerUtils.c:347:18: error: suggest braces around initialization of subobject [-Werror,-Wmissing-braces]
          NMIPAddr a1 = { 0 }, a2 = { 0 };
                          ^
                          {}

Should we initialize unions this way? I think it's all right -- the initializer
works well and { { { 0 } } } is probably not what we'd like to see.
2017-04-15 12:29:59 +02:00
Lubomir Rintel
c76ee5883d platform: fix a typo 2017-04-15 12:29:57 +02:00
Beniamino Galvani
03c2949a2c wifi: merge branch 'bg/wifi-pmf-bgo748367'
Support for 802.11w (Protected Management Frames).

https://bugzilla.gnome.org/show_bug.cgi?id=748367
2017-04-15 10:38:39 +02:00
Beniamino Galvani
72cfa1f458 supplicant: enable stronger AKMs when PMF is enabled 2017-04-15 10:37:33 +02:00
Beniamino Galvani
a72ffe230b supplicant: enable PMF only when wpa_supplicant supports it 2017-04-15 10:37:33 +02:00
Beniamino Galvani
d38eadd990 supplicant: enable PMF based on driver type
Instead of adding a new flag to configuration based on connection
type, use the driver-type field directly in the supplicant-interface.
2017-04-15 10:36:55 +02:00
Michael Cronenworth
8b051bb35e supplicant: Initial pmf support (a.k.a. MFP, a.k.a. 802.11w)
https://bugzilla.gnome.org/show_bug.cgi?id=748367

Signed-off-by: Michael Cronenworth <mike@cchtml.com>
2017-04-15 10:24:53 +02:00
Thomas Haller
acdf3d10cb core: merge branch 'th/route-zero-host-part-rh1439376'
https://bugzilla.redhat.com/show_bug.cgi?id=1439376

(cherry picked from commit fff918ec5a)
2017-04-15 00:37:40 +02:00
Thomas Haller
be19ec0739 core: ignore host part when comparing routes for route-manager
(cherry picked from commit b78562570a)
2017-04-15 00:37:22 +02:00
Thomas Haller
674b224bc1 route-manager: normalize host part of tracked routes in _vx_route_sync()
The input list of routes is allowed to contain non-normalized routes,
that is, routes which host part is non-zero. Such routes are rejected
by kernel, but NM should transparently allow them (by normalizing
the host part).

The ID comparison function route_id_cmp() already properly ignored
the (possibly non-zero) host part. However, in the internal list we
also should make sure not to track such routes. We achive that by
normalizing the host part to zero.

Note that below we check whether the tracked route is idential to
the route configured at platform. If we don't normalize the host part,
the comparison will always indicate that the route is not yet
configured, and thus we will re-sync the route every time.

(cherry picked from commit 5c54b7a31e)
2017-04-15 00:37:22 +02:00
Thomas Haller
b32bb36c61 src: only compare network parts of routes in nm_utils_match_connection()
Kernel requires that routes have a host part of zero. For NetworkManager
configuration we allow non-zero host parts (but ignore them). Fix
route_compare() to ignore the host part.

This has only effect during assuming connections. That means, on
restart NM would fail to match a connection with static routes
if it has a non-zero host part. So, the impact is rather small.

(cherry picked from commit 034b7fb51c)
2017-04-15 00:37:22 +02:00
Thomas Haller
ae8d98391a platform: only consider net part of routes for route cache's ID
Routes with a non-zero host part are not allowed by kernel and
don't really exist. We didn't reject such routes in users configuration,
so various part of NM allow such routes. NM should silently strip
the host part.

Extend the cache's route ID to clear the host part too.

Note that NM's handling of routes is fundamentally flawed, as
for kernels routes don't have an "id" (or rather: all properties
of a route are part of it's ID, not only the family,ifindex,
network/plen and metric tuple (see related bug rh#1337855).

(cherry picked from commit 57b0dce083)
2017-04-15 00:37:22 +02:00
Thomas Haller
514d79fc85 platform: cleanup possibly non-zero host part for route operations
Platform's add/remove operations accept a "network" argument.
Kernel requires that the host part (based on plen) is all zero.
For NetworkManager we are more resilient to user configuration.

Cleanup the input argument already before calling _nl_msg_new_route().
Note that we use the same "network" argument to construct a obj_id
instance and to find the route in the cache (do_add_addrroute()).
Without cleaning the host part, the added object cannot be found
and the add-route command seemingly fails.

(cherry picked from commit 11d8c41898)
2017-04-15 00:37:22 +02:00
Thomas Haller
fff918ec5a core: merge branch 'th/route-zero-host-part-rh1439376'
https://bugzilla.redhat.com/show_bug.cgi?id=1439376
2017-04-15 00:35:46 +02:00
Thomas Haller
b78562570a core: ignore host part when comparing routes for route-manager 2017-04-15 00:35:25 +02:00
Thomas Haller
5c54b7a31e route-manager: normalize host part of tracked routes in _vx_route_sync()
The input list of routes is allowed to contain non-normalized routes,
that is, routes which host part is non-zero. Such routes are rejected
by kernel, but NM should transparently allow them (by normalizing
the host part).

The ID comparison function route_id_cmp() already properly ignored
the (possibly non-zero) host part. However, in the internal list we
also should make sure not to track such routes. We achive that by
normalizing the host part to zero.

Note that below we check whether the tracked route is idential to
the route configured at platform. If we don't normalize the host part,
the comparison will always indicate that the route is not yet
configured, and thus we will re-sync the route every time.
2017-04-15 00:35:25 +02:00
Thomas Haller
034b7fb51c src: only compare network parts of routes in nm_utils_match_connection()
Kernel requires that routes have a host part of zero. For NetworkManager
configuration we allow non-zero host parts (but ignore them). Fix
route_compare() to ignore the host part.

This has only effect during assuming connections. That means, on
restart NM would fail to match a connection with static routes
if it has a non-zero host part. So, the impact is rather small.
2017-04-15 00:35:25 +02:00
Thomas Haller
57b0dce083 platform: only consider net part of routes for route cache's ID
Routes with a non-zero host part are not allowed by kernel and
don't really exist. We didn't reject such routes in users configuration,
so various part of NM allow such routes. NM should silently strip
the host part.

Extend the cache's route ID to clear the host part too.

Note that NM's handling of routes is fundamentally flawed, as
for kernels routes don't have an "id" (or rather: all properties
of a route are part of it's ID, not only the family,ifindex,
network/plen and metric tuple (see related bug rh#1337855).
2017-04-15 00:35:25 +02:00
Thomas Haller
11d8c41898 platform: cleanup possibly non-zero host part for route operations
Platform's add/remove operations accept a "network" argument.
Kernel requires that the host part (based on plen) is all zero.
For NetworkManager we are more resilient to user configuration.

Cleanup the input argument already before calling _nl_msg_new_route().
Note that we use the same "network" argument to construct a obj_id
instance and to find the route in the cache (do_add_addrroute()).
Without cleaning the host part, the added object cannot be found
and the add-route command seemingly fails.
2017-04-15 00:35:25 +02:00
Thomas Haller
0a3fdf6604 vpn: merge branch 'th/vpn-disconnect-rh1442064'
https://bugzilla.redhat.com/show_bug.cgi?id=1442064

(cherry picked from commit 6e67f7f30b)
2017-04-15 00:32:52 +02:00
Thomas Haller
6bfd9b4e85 vpn: inline call_plugin_disconnect()
There is only one caller. Don't bother moving the logic to a separate
function.

(cherry picked from commit b23484be72)
2017-04-15 00:32:23 +02:00
Thomas Haller
e6b1a31106 vpn: avoid calling call_plugin_disconnect() without proxy
Got an assertion due to priv-proxy unset.
  NMDevice:
    - _platform_link_cb_idle()
     - nm_device_unrealize() [NMDeviceTun]
      - nm_device_state_changed()
       - _set_state_full()
         NMVpnConnection:
           - _set_vpn_state()
            - call_plugin_disconnect()

It seam to me, that can only happen if the NMVpnConnection never
completed on_proxy_acquired() and is still in preparing state when
being disconnected.

Avoid that be checking whether we have a proxy.

https://bugzilla.redhat.com/show_bug.cgi?id=1442064
(cherry picked from commit bc1d1c9df4)
2017-04-15 00:32:22 +02:00
Thomas Haller
6e67f7f30b vpn: merge branch 'th/vpn-disconnect-rh1442064'
https://bugzilla.redhat.com/show_bug.cgi?id=1442064
2017-04-15 00:31:34 +02:00
Thomas Haller
b23484be72 vpn: inline call_plugin_disconnect()
There is only one caller. Don't bother moving the logic to a separate
function.
2017-04-15 00:31:23 +02:00
Thomas Haller
bc1d1c9df4 vpn: avoid calling call_plugin_disconnect() without proxy
Got an assertion due to priv-proxy unset.
  NMDevice:
    - _platform_link_cb_idle()
     - nm_device_unrealize() [NMDeviceTun]
      - nm_device_state_changed()
       - _set_state_full()
         NMVpnConnection:
           - _set_vpn_state()
            - call_plugin_disconnect()

It seam to me, that can only happen if the NMVpnConnection never
completed on_proxy_acquired() and is still in preparing state when
being disconnected.

Avoid that be checking whether we have a proxy.

https://bugzilla.redhat.com/show_bug.cgi?id=1442064
2017-04-15 00:31:23 +02:00
Beniamino Galvani
9029dabb87 cli: check for deactivation failures
If the D-Bus call to DeactivateConnection() fails, don't wait for the
connection to change state because this is not going to
happen. Instead, notify the user of the error and, if necessary, wait
for remaining connections to be deactivated.

https://bugzilla.redhat.com/show_bug.cgi?id=1422786
(cherry picked from commit 67d144dd1e)
2017-04-13 17:19:40 +02:00
Beniamino Galvani
67d144dd1e cli: check for deactivation failures
If the D-Bus call to DeactivateConnection() fails, don't wait for the
connection to change state because this is not going to
happen. Instead, notify the user of the error and, if necessary, wait
for remaining connections to be deactivated.

https://bugzilla.redhat.com/show_bug.cgi?id=1422786
2017-04-13 17:18:34 +02:00
Beniamino Galvani
45bef0ad17 cli: fix evaluation of supported settings for *-slave connections
To determine the valid settings we must consider the actual connection
type, not the user-supplied one because, for example, "bridge-slave"
is in fact an ethernet connection.

Fixes: fb8fe1d8cb

https://bugzilla.redhat.com/show_bug.cgi?id=1440957
2017-04-13 15:35:37 +02:00
Lubomir Rintel
55ad538cfb libnm-glib/secret-agent: don't error out on missing out_connection
It's perfectly valid to call the function with out_connection == NULL
when connection_hash == NULL too, as cancel_get_secrets() does.

Fixes: fbb1662269
(cherry picked from commit c4a0002f05)
2017-04-13 14:45:58 +02:00
Lubomir Rintel
c4a0002f05 libnm-glib/secret-agent: don't error out on missing out_connection
It's perfectly valid to call the function with out_connection == NULL
when connection_hash == NULL too, as cancel_get_secrets() does.

Fixes: fbb1662269
2017-04-13 14:43:17 +02:00
Thomas Haller
ecec03c8b7 cli: merge branch 'th/cli-meta-3' 2017-04-13 10:10:58 +02:00
Thomas Haller
275ab5fb8f cli: make properties list a list of pointers
That allows for the property list to contain derived
property types. Also, the list can be directly passed
off as a "const NMMetaAbstractInfo *const*" list.
2017-04-13 10:10:12 +02:00
Thomas Haller
f2b5a42c7c cli: let NMMetaNestedPropertyInfo derive NMMetaPropertyInfo 2017-04-13 10:10:12 +02:00
Thomas Haller
886dad49d4 cli: move parsing of meta data fields 2017-04-13 10:10:12 +02:00
Thomas Haller
39bc8dbdf9 cli/trivial: rename NmcOutputSelectionItem type 2017-04-13 10:10:12 +02:00
Thomas Haller
2026d52f11 cli: use virtual get_nested method in _output_selection_select_one() 2017-04-13 10:10:12 +02:00
Beniamino Galvani
8b52e506a7 cli: fix addition of slave connection types
$ nmcli connection add type bond-slave ifname aoeu master aoeu
 Error: bad connection type: 'bond-slave' not among [802-1x, adsl,
 bluetooth, bond, bridge, bridge-port, cdma, connection, dcb, dummy,
 generic, gsm, infiniband, ipv4, ipv6, ip-tunnel, macsec, macvlan,
 802-11-olpc-mesh (olpc-mesh), ppp, pppoe, proxy, serial, team,
 team-port, tun, user, vlan, vpn, vxlan, wimax, 802-3-ethernet
 (ethernet), 802-11-wireless (wifi), 802-11-wireless-security
 (wifi-sec)].

Fixes: d32817999c
2017-04-13 08:43:17 +02:00
Thomas Haller
8acb2b1151 cli: merge branch 'th/cli-meta-2' 2017-04-12 14:15:27 +02:00
Thomas Haller
6d12d2f3a0 cli: move setting creation to meta data 2017-04-12 14:12:20 +02:00
Thomas Haller
b629b98687 cli: move completion for connection type to meta data 2017-04-12 14:12:20 +02:00
Thomas Haller
2a760897f2 cli: move completion for master connections to meta data
This change (improves) behavior.

Before, we would only complete
  if (g_strcmp0 (con_type, nmc_tab_completion.con_type) != 0)
which doesn't really make sense as it depends on the slave-type,
not nmc_tab_completion.con_type.
2017-04-12 14:12:20 +02:00
Thomas Haller
1e4bc51a4a cli: move completion for devices names to meta data 2017-04-12 14:12:20 +02:00
Thomas Haller
d32817999c cli: move information about valid connection settings to common 2017-04-12 14:12:20 +02:00
Thomas Haller
3ed0fc1b45 cli: move setting alias to meta data 2017-04-12 14:12:20 +02:00
Thomas Haller
6c2727af14 cli: add meta data for NMSettingGeneric 2017-04-12 14:12:20 +02:00
Thomas Haller
88f100e176 cli: move completing static-value types to meta data 2017-04-12 14:12:19 +02:00
Thomas Haller
0fa5fc3f51 cli: move completing VPN service types to meta data 2017-04-12 14:12:19 +02:00
Thomas Haller
7ef23e5c0a cli: move prompting for enum values to meta data 2017-04-12 14:12:19 +02:00
Thomas Haller
218f46ebcc cli: use meta data's completion in nmcli_con_add_tab_completion() 2017-04-12 14:12:19 +02:00
Thomas Haller
0b7e9c3bef cli: move prompting for boolean values to meta data
This changes behavior, in that yes|no prompt and answer is no longer
localized.

For command line arguments, I think it is always wrong for nmcli to
behave differently based on the localization. That is, input properties
on command line should not be translated.

One could make an argument, that in interactive mode that is different
and the user can be prompted in the his language.

But I think for consistency, it is wrong to ask for localized nmcli input.
2017-04-12 14:12:19 +02:00