Commit graph

11758 commits

Author SHA1 Message Date
Thomas Haller
f59cda06ce platform/trivial: remove unused argument from udev_get_driver()
(cherry picked from commit 7354dc4c58)
2015-06-17 13:50:36 +02:00
Thomas Haller
fd61283fb0 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.

(cherry picked from commit 7c5d361c66)
2015-06-17 13:50:36 +02:00
Thomas Haller
fc499ffd14 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.

(cherry picked from commit 850af91f22)
2015-06-17 13:50:36 +02:00
Thomas Haller
7518d9a1ce platform/trivial: add OBJECT_TYPE_MAX enum value
(cherry picked from commit ee64b8585b)
2015-06-17 13:50:36 +02:00
Thomas Haller
87b49c088e 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.

(cherry picked from commit cdd3e1c302)
2015-06-17 13:50:36 +02:00
Thomas Haller
1bbf159cd0 platform/test: fake platform must use nm-logging for reporting errors
Just like linux platform does.

(cherry picked from commit 21b129084f)
2015-06-17 13:50:36 +02:00
Dan Williams
fd40f223bf platform: prevent warning when udev is clueless about a device
udev doesn't know about the device yet when NM creates it internally.

NetworkManager[9275]: <info>  (team0): carrier is OFF
NetworkManager[9275]: <info>  (team0): new Team device (driver: 'team' ifindex: 16)
(NetworkManager:9275): GUdev-CRITICAL **: g_udev_device_get_property: assertion 'G_UDEV_IS_DEVICE (device)' failed
NetworkManager[9275]: <info>  (team0): exported as /org/freedesktop/NetworkManager/Devices/5

(cherry picked from commit 8173f0f9e8)
2015-06-17 13:50:36 +02:00
Lubomir Rintel
caa3628976 platform: merge branch 'lr/udev-unmanaged-fd731014'
https://bugzilla.gnome.org/show_bug.cgi?id=731014

(cherry picked from commit ca9679334c)
2015-06-17 13:40:02 +02:00
Lubomir Rintel
b9a6de480c Revert "core: make veth devices default-unmanaged for now"
This reverts commit ebeaeaed4d.

No need to hardwire these as unmanaged anymore, an udev rule will take care of
it.

(cherry picked from commit 498d45e85f)
2015-06-17 13:39:42 +02:00
Lubomir Rintel
cf1166f27f data: move OLPC MESH udev rules away from callouts
No idea why was it there in the first place.

This also fixes a bug that the rules file was conditionally included in dist
depending on presence of udev dir at configure time.

(cherry picked from commit ceea3c6782)
2015-06-17 13:39:42 +02:00
Lubomir Rintel
5c187b9b1c data: add udev rules to make emulated ethernet devices default unmanaged
There are some out-of-tree drivers that create devices masquerading as
ethernets which are supposed to use their own management tools. Avoid touching
them.

The rules should be run after 80-net-setup-link.rules, so that the
ID_NET_DRIVER is set.

(cherry picked from commit 7ba30cfd26)
2015-06-17 13:39:42 +02:00
Lubomir Rintel
117e62040d platform: give the platform an opportunity to override default-unmanaged
Some out of tree drivers add Ethernet devices that are supposed to be managed
by other their tooling, e.g. VirtualBox or VMWare.

Rather than hardcoding their drivers (at least VirtualBox doesn't even set a
"driver" property in sysfs) or hardcoding a logic that identifies such devices
let's just add a possibility to blacklist them in udev. This makes it possible
for whoever who ships such a driver to ship rules that prevent NetworkManager
from managing the device itself.

Furthermore it makes it possible for the user with special needs leverage the
flexibility of udev rules to override the defaults. In the end the user can
decide to let NetworkManager manage default-unmanaged interfaces such as VEth
or turn on default-unmanaged for devices on a particular bus.

An udev rule for VirtualBox would look like this:

  SUBSYSTEM=="net", ENV{INTERFACE}=="vboxnet[0-9]*", ENV{NM_UNMANAGED}="1"

(cherry picked from commit 85ee1f4a9c)
2015-06-17 13:39:42 +02:00
Lubomir Rintel
3300e10c69 platform: don't wait for udev device initializaton if there's no udev
There's no udev running in containers, it only starts if /sys is writable. If a
hardware device is added to the container's namespace NM would not announce it.

This also removes the software link special case -- the software links will now
wait for udev initialization (in case udev is there) as well. There's no reason
to treat them differently anymore. This makes it possible to use udev properties
of the software links.

https://bugzilla.gnome.org/show_bug.cgi?id=740526
(cherry picked from commit 4a05869557)
2015-06-17 13:39:41 +02:00
Lubomir Rintel
8be448cc9d contrib: ensure udev rules from RPM package are applied
We install udev rules and need to ensure that correct ones are in effect when
the package is installed, updated or removed.

(cherry picked from commit b3667afa22)
2015-06-17 13:39:41 +02:00
Thomas Haller
efb507cf12 merge: backport test fixes and moving of nm_utils_ascii_str_to_int64()
Backport improvements to NMFakePlatform, which is useful anyway.

Also backport the moving of nm_utils_ascii_str_to_int64()
to reduce conflicts for future backports.
2015-06-17 13:31:52 +02:00
Thomas Haller
ba285e319e libnm: move _nm_utils_ascii_str_to_int64() from src/ to libnm-core/
(cherry picked from commit c5d23737fd)
2015-06-17 13:30:39 +02:00
Thomas Haller
a4d11bae29 trivial: rename nm_utils_ascii_str_to_int64() to _nm_utils_ascii_str_to_int64()
(cherry picked from commit 093f6d477b)
2015-06-17 13:30:38 +02:00
Lubomir Rintel
0916861c5c fake-platform: normalize ipv6 route metric before deletion
(cherry picked from commit 72cefd5162)
2015-06-17 13:30:38 +02:00
Lubomir Rintel
63611cb46f fake-platform: reject adding routes without the gateway on the same interface
This mimics Linux behavior.

(cherry picked from commit 4d097829f0)
2015-06-17 13:30:38 +02:00
Lubomir Rintel
7e5981a894 fake-platform: override routes that clash
This is done to more closely mimic what Linux does.

(cherry picked from commit f6c9b4ff83)
2015-06-17 13:30:38 +02:00
Lubomir Rintel
a3ff3fbbc0 fake-platform: move route deletion above addition
No change in behavior.

We'll need it when we'll remove routes that clash upon addition.

(cherry picked from commit 1ee03eeb5a)
2015-06-17 13:30:38 +02:00
Lubomir Rintel
99c2980a65 fake-platform: don't return null routes in place of deleted ones
(cherry picked from commit 72e8c534e0)
2015-06-17 13:30:38 +02:00
Lubomir Rintel
8d91bf5769 platform: merge: branch 'lr/ipv6-tokens' (rh #1104689)
This adds support for tokenised identifier use as specified in
draft-chown-6man-tokenised-ipv6-identifiers-02 Internet Draft,
enabled if there's a support for tokenised identifiers in libnl.

https://bugzilla.redhat.com/show_bug.cgi?id=1104689
https://tools.ietf.org/html/draft-chown-6man-tokenised-ipv6-identifiers-02

(cherry picked from commit 5f50c0480a)
2015-06-17 13:20:10 +02:00
Lubomir Rintel
77daecf1d1 core: Use tokenized identifiers when constructing an address
We trigger a new solicitation upon seeing the new token. Kernel triggers one
too, but that one is of no use to us, since the advertisement might arrive sooner
than we learn about the token change.

(cherry picked from commit 24e7ea7860)
2015-06-17 13:19:16 +02:00
Lubomir Rintel
172f5256a7 platform: Add support for IPv6 tokenized identifiers on Linux
(cherry picked from commit c2f9940470)
2015-06-17 13:19:16 +02:00
Lubomir Rintel
c3c927d1d1 platform: refresh link cache when IPv6 tokenized identifier changes
(cherry picked from commit 954a4b69b8)
2015-06-17 13:19:16 +02:00
Lubomir Rintel
4d7e2a1a68 build: Check for tokenized identifier support in libnl-route-3
(cherry picked from commit b47d55b500)
2015-06-17 13:19:16 +02:00
Lubomir Rintel
3cbd7cdc03 platform: Add support for IPv6 tokenized identifiers
(cherry picked from commit db5603e615)
2015-06-17 13:19:16 +02:00
Lubomir Rintel
06b30ad690 core: Add NMUtilsIPv6IfaceId to nm-types.h
We'd like to use it in nm-platform.h, but it's included by
NetworkManagerUtils.h before the declaration occurs.

(cherry picked from commit 0d59984ce8)
2015-06-17 13:19:16 +02:00
Lubomir Rintel
b318c9cd18 utils: _get_ip_config_method(): don't assert a connection has IP config
nm_utils_get_shared_wifi_permission() that is called for each AddAndActivate
uses this and triggers an assertion failure for InifnibandConnections which
don't have IPv4 configuration:

NetworkManager[54006]: nm_utils_get_ip_config_method: assertion 's_ip4 != NULL' failed

  #2  0x000055555562b833 in nm_utils_get_ip_config_method (connection=connection@entry=0x5555559c3b60, ip_setting_type=93824996202304) at NetworkManagerUtils.c:1329
  #3  0x000055555562b914 in nm_utils_get_shared_wifi_permission (connection=0x5555559c3b60) at NetworkManagerUtils.c:1105
  #4  0x00005555555fc012 in nm_active_connection_authorize (self=0x5555559b30a0, result_func=0x55555561b980 <_add_and_activate_auth_done>, user_data1=0x555555957210, user_data2=0x555555a055f0)
      at nm-active-connection.c:683
  #5  0x0000555555621b21 in impl_manager_add_and_activate_connection (self=0x555555957210, settings=<optimized out>, device_path=<optimized out>, specific_object_path=0x0, context=0x555555a055f0)
      at nm-manager.c:3495

(cherry picked from commit 5e8182279a)
2015-06-17 13:17:54 +02:00
Thomas Haller
948cfd8f5c core: use nm_utils_modprobe()
https://bugzilla.gnome.org/show_bug.cgi?id=740651

(cherry picked from commit 32625f604b)
2015-06-17 12:53:24 +02:00
Thomas Haller
6d052c1350 utils: add nm_utils_modprobe()
https://bugzilla.gnome.org/show_bug.cgi?id=740651
(cherry picked from commit 4ad6099b01)
2015-06-17 12:51:53 +02:00
Lubomir Rintel
b5733c1916 ppp-manager: fix build with Linux 3.2.0 headers
Fixes build with Ubuntu 12.04.

In file included from ppp-manager/nm-ppp-manager.c:42:0:
/usr/include/linux/if_ppp.h:103:16: error: field 'b' has incomplete type
/usr/include/linux/if_ppp.h:108:21: error: field 'b' has incomplete type

(cherry picked from commit 22b99e3bbb)
2015-06-16 15:54:22 +02:00
Thomas Haller
1d6eac884e manager: fix impl_manager_add_and_activate_connection()
Note also the comment "Just make sure we don't expect specific data being
in the connection till then (especially in validate_activation_request())."
in impl_manager_add_and_activate_connection().

Creating a connection caused a failed assertion:

  #0  0x00007ff8da3aa4e9 in g_logv (log_domain=0x7ff8ddf41036 "NetworkManager", log_level=G_LOG_LEVEL_CRITICAL, format=<optimized out>, args=args@entry=0x7ffff5a0a090) at gmessages.c:989
  #1  0x00007ff8da3aa63f in g_log (log_domain=<optimized out>, log_level=<optimized out>, format=<optimized out>) at gmessages.c:1025
  #2  0x00007ff8dde8c47a in nm_utils_get_ip_config_method (connection=0x7ff8def21d20, ip_setting_type=140706868598912) at NetworkManagerUtils.c:1252
  #3  0x00007ff8dde7d654 in validate_activation_request (self=0x7ff8def62150, context=0x7ff8deff5a00, connection=0x7ff8def21d20, device_path=0x7ff8def3f770 "/org/freedesktop/NetworkManager/Devices/2", out_device=0x7ffff5a0a370,
      out_vpn=0x7ffff5a0a36c, error=0x7ffff5a0a378) at nm-manager.c:3061
  #4  0x00007ff8dde7b7a2 in impl_manager_add_and_activate_connection (self=0x7ff8def62150, settings=0x7ff8def95460, device_path=0x7ff8def3f770 "/org/freedesktop/NetworkManager/Devices/2",
      specific_object_path=0x7ff8deeeced0 "/org/freedesktop/NetworkManager/AccessPoint/227", context=0x7ff8deff5a00) at nm-manager.c:3386
  #5  0x00007ff8dde6bd9c in dbus_glib_marshal_nm_manager_VOID__BOXED_BOXED_BOXED_POINTER (closure=0x7ffff5a0a5f0, return_value=0x0, n_param_values=5, param_values=0x7ff8defb9d30, invocation_hint=0x0,
      marshal_data=0x7ff8dde7b660 <impl_manager_add_and_activate_connection>) at ./nm-manager-glue.h:189
  #6  0x00007ff8dc506885 in invoke_object_method (message=0x7ff8def99a00, connection=0x7ff8deeec940, method=0x7ff8de1a6878 <dbus_glib_nm_manager_methods+72>, object_info=0x7ff8de1a2e70 <dbus_glib_nm_manager_object_info>,
      object=0x7ff8def62150) at dbus-gobject.c:1899
  #7  object_registration_message (connection=0x7ff8deeec940, message=message@entry=0x7ff8def99a00, user_data=user_data@entry=0x7ff8def16da0) at dbus-gobject.c:2161
  #8  0x00007ff8dc2cef86 in _dbus_object_tree_dispatch_and_unlock (tree=0x7ff8deeec5e0, message=message@entry=0x7ff8def99a00, found_object=found_object@entry=0x7ffff5a0a814) at dbus-object-tree.c:862
  #9  0x00007ff8dc2c10d9 in dbus_connection_dispatch (connection=connection@entry=0x7ff8deeec940) at dbus-connection.c:4699
  #10 0x00007ff8dc503d65 in message_queue_dispatch (source=source@entry=0x7ff8deeee720, callback=<optimized out>, user_data=<optimized out>) at dbus-gmain.c:90
  #11 0x00007ff8da3a32a6 in g_main_dispatch (context=0x7ff8deebd320) at gmain.c:3066
  #12 g_main_context_dispatch (context=context@entry=0x7ff8deebd320) at gmain.c:3642
  #13 0x00007ff8da3a3628 in g_main_context_iterate (context=0x7ff8deebd320, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at gmain.c:3713
  #14 0x00007ff8da3a3a3a in g_main_loop_run (loop=0x7ff8deebd3e0) at gmain.c:3907
  #15 0x00007ff8dddc0979 in main (argc=1, argv=0x7ffff5a0afd8) at main.c:442

Fixes: 477033b9ef
(cherry picked from commit b3944cfc71)
2015-06-16 14:25:35 +02:00
Jiří Klimeš
759918585e cli: TAB-completion for enum-style property values (rh #1034126)
Valid values for enumeration-style properties are offered in TAB-completion in
the editor. Thus the user has a quick overview of the possible values and can
edit properties more easily.

Example:
$ nmcli con edit type wifi
nmcli> set wifi-sec.group <TAB>
ccmp    tkip    wep104  wep40
nmcli> ...

https://bugzilla.redhat.com/show_bug.cgi?id=1034126
(cherry picked from commit 79bc271685)
2015-06-15 10:32:45 +02:00
Jiří Klimeš
a9c9d6b915 cli: add missing nmc_property_802_1X_allowed_eap() function
(cherry picked from commit bf01da1a08)
2015-06-15 10:31:33 +02:00
Jiří Klimeš
bef07bc62d cli: change function for allowed values to return array of strings
(cherry picked from commit 188d6cbaf3)
2015-06-15 10:31:26 +02:00
Jiří Klimeš
561f9b7203 cli: add @brackets parameter to nmc_util_strv_for_display
(cherry picked from commit 5e1a7ffb39)
2015-06-15 10:31:20 +02:00
Jiří Klimeš
9e65dbd711 cli: print valid-values hint in property menu for empty "set" command
nmcli 802-11-wireless.mode> set
Allowed values for 'mode' property: infrastructure, adhoc, ap
Enter 'mode' value:

(cherry picked from commit db0f5b3b4c)
2015-06-15 10:31:14 +02:00
Jiří Klimeš
1203f224f9 cli: do not stall in 'nmcli connection delete/down' (rh #1168657)
NetworkManager only responds to the last D-Bus call when called delete/down
for the same connection in quick succession. (It should be fixed later).
So do not issue the call multiple times to prevent that. Otherwise nmcli would
stall waiting for the response.

https://bugzilla.redhat.com/show_bug.cgi?id=1168657
(cherry picked from commit f52e6bbdda)
2015-06-15 10:28:27 +02:00
Beniamino Galvani
688183c96c ifnet/tests: fix GCC 5 warning about possible misuse of logical not
With GCC 5, -Wlogical-not-parentheses is enabled by -Wall and warns
about suspicious code like:

  int a;
  ...
  if (!a > 1) { ... }

Fix the following warning:

test_all.c: In function ‘test_is_static’:
test_all.c:114:32: warning: logical not is only applied to the left hand side of comparison [-Wlogical-not-parentheses]
  ASSERT (!is_static_ip6 ("eth0") == TRUE, "is static",
                                  ^

(cherry picked from commit fe765d30da)
2015-06-10 22:09:49 +02:00
Beniamino Galvani
2b621ef5dd device: don't assume by default IPv6LL-only connections
Add the new configuration option 'assume-ipv6ll-only' which specifies
the devices for which NM will try to assume an existing IPv6LL-only
configuration.

The new default behavior is to ignore such configurations since IPv6LL
addresses are automatically assigned by the kernel when the device is
brought up and thus the presence of an IPv6LL address doesn't mean
that the device was configured by the administrator.

The previous behavior was to always assume IPv6LL-only configurations
but this often had the unwanted effect of preventing other on-disk
configurations to be activated. To preserve the old behavior the
option must be set to '*'.

https://bugzilla.redhat.com/show_bug.cgi?id=1138426
(cherry picked from commit 3bc097b084)
2015-06-10 22:09:40 +02:00
Thomas Haller
24c53772d5 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
(cherry picked from commit 8ebb8d0d0f)
2015-06-10 18:46:22 +02:00
Thomas Haller
8acd78d1fa 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
(cherry picked from commit 2d333a1769)
2015-06-10 18:44:57 +02:00
Beniamino Galvani
00ee848db8 core: merge branch 'th/spec-match-bgo743411'
https://bugzilla.gnome.org/show_bug.cgi?id=743411
2015-06-10 18:37:49 +02:00
Thomas Haller
18e29c5e7a man: explain the format for device specifier in manual page NetworkManager.conf
(cherry picked from commit b0f9e9bdfb)
2015-06-10 18:33:09 +02:00
Thomas Haller
2be628334c core: unify parsing of device specs using nm_match_spec_split()
There are three configuration options that contain device specs:
'main.ignore-carrier', 'main.no-auto-default', and
'keyfile.unmanaged-devices'.

Unify the parsing of them by splitting the device spec with
nm_match_spec_split(). This changes behavior for parsing of these
properties.

Also get rid of logging warnings when parsing 'keyfile.unmanaged-devices'.

(cherry picked from commit c6778ad1b7)
2015-06-10 18:33:07 +02:00
Thomas Haller
832023fe1c core: add nm_match_spec_split() function
There are currently three device spec properties: 'main.ignore-carrier',
'main.no-auto-default' and 'keyfile.unmanaged-devices'.

The first two, called g_key_file_parse_value_as_string() to split
the string into individual device specs. This uses ',' as separator
and supports escaping using '\\'.

'keyfile.unmanaged-devices' is split using ',' or ';' as separator
without supporting escaping.

Add a new function nm_match_spec_split(), to unify these two behaviors
and support both formats. That is, both previous formats are mostly
supported, but obviously there are some behavioral changes if the string
contains one of '\\', ',', or ';'.

nm_match_spec_split() is copied from glibs g_key_file_parse_value_as_string()
and adjusted.

(cherry picked from commit 3bcc5e4bd0)
2015-06-10 18:33:05 +02:00
Thomas Haller
aaca52b261 core: support "except:" spec to negate match
Extend nm_match_spec_*() to support an "except:" prefix to negate
the result of a match. "except:" only works when followed by
an exact match type, for example "except:interface-name:vboxnet0",
but not "except:vboxnet0".

A matching "except:" spec always wins, regardless of other positive
matchings.

(cherry picked from commit 5c2e1afd1b)
2015-06-10 18:33:02 +02:00
Thomas Haller
3de7acc37a core: remove nm_match_spec_string()
It was only used to match against "*", in a case-insensitive
way.

(cherry picked from commit 2051944333)
2015-06-10 18:33:00 +02:00