Commit graph

11715 commits

Author SHA1 Message Date
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
Thomas Haller
a01da5f95e core: rework matching of nm_match_spec()
This includes several changes how to match device specs:

- matching the interface name is no longer case-insenstive as
  interface names themselves are case-sensitive.

- Now we skip patterns that start with "mac:" or "s390-subchannels:"
  for comparing interface names. Previously a spec "mac:1" would have
  matched an interface named "mac:1", now it doesn't.
  To match such an interface, you would have to specify
  "interface-name:mac:1".

- previously, a pattern "a" would have matched an interface
  named "interface-name:a", now it doesn't. Since valid interface
  name (in the kernel) can be at most 15 characters long, this is
  however no problem.

- if the spec has the prefix "interface-name:", we support
  simple globbing using GPatternSpec. Globbing without exact
  spec type will still not match "vboxnet*" -- with the exception
  of "*".
  You can disable globbing by putting an '=' immediately
  after the ':'.
     (a) "interface-name:em1"  | matches "em1"
     (b) "interface-name:em*"  | matches "em", "em1", "em2", etc.
     (c) "interface-name:em\*" | matches "em\", "em\1", etc.
     (d) "interface-name:=em*" | matches "em*"
     (e) "em*"                 | matches "em*"

(cherry picked from commit 2b518538be)
2015-06-10 18:32:58 +02:00
Thomas Haller
c2e4e2f1fd core/test: add test for nm_match_spec()
(cherry picked from commit 9080ad696d)
2015-06-10 18:32:56 +02:00
Lubomir Rintel
ade0c9e05e manager: don't attempt to activate ipv6.method=shared connections
It would be nice if we supported IPv6 network sharing (maybe RFC 7278?),
but we don't. Let's not attempt to bring it up, it would fail in stage3.

https://bugzilla.redhat.com/show_bug.cgi?id=1183015
(cherry picked from commit 477033b9ef)
2015-06-09 19:02:50 +02:00
Lubomir Rintel
1bf060bf93 cli: don't look up a device for activation request unless we have to
Let the server decide which device to use if the user didn't explicitly
specify the interface, wireless access point or a wimax nsp.

The server will just reuse the device for an already active connection
or potentially do a better guess.

https://bugzilla.gnome.org/show_bug.cgi?id=730492
(cherry picked from commit 0e8a14cc5f)
2015-06-09 18:57:25 +02:00
Lubomir Rintel
33eca4b43c manager: remove a connection from device if we're activating it on another device
The connection now might be being activated on another device. Defer the
removal until we're sure the activation request will proceed and only add the
active connection afterwards.

https://bugzilla.gnome.org/show_bug.cgi?id=730492
(cherry picked from commit 4cb97cf66f)
2015-06-09 18:57:12 +02:00
Lubomir Rintel
ad81316f18 manager: pick an available device if none was specified upon connection activation
This offloads some complexity from the client.

https://bugzilla.gnome.org/show_bug.cgi?id=730492
(cherry picked from commit 6fc3736c7a)
2015-06-09 18:57:06 +02:00
Lubomir Rintel
f20910516d manager: reuse a device connection is active on if none was given upon activation
If a connection is already active let's keep it on the same device. This makes
it possible to reactivate a connection without client knowing which device is
it active on.

https://bugzilla.gnome.org/show_bug.cgi?id=730492
(cherry picked from commit 6e94f302b2)
2015-06-09 18:56:57 +02:00
Lubomir Rintel
93409da4dc core: don't assume the loopback interface is called "lo"
I did a "ip link set lo name yolo" and now my NetworkManager triggers an
assertion failure. :( Nevertheless, the loopback interface is always ifindex=1.

(cherry picked from commit 36f7669a4c)
2015-06-04 14:40:22 +02:00
Lubomir Rintel
9ce3e5e76e platform-linux: allow netlink messages from non-privileged user namespaces
Just check they're from kernel.

(cherry picked from commit ef295ddeef)
2015-06-04 14:39:49 +02:00
Thomas Haller
6099378bc6 libnm: fix take ownership of floating argument in NMSecretAgentOld:get_secrets_cb()
The previous patch 9ffcecf86a was
completely wrong.

It tried to fix callers that provided a floating GVariant reference.
We require the caller to unref @secrets, so the correct fix it to
ensure that the reference is not floating.

Fixes: 6793a32a8c

(cherry picked from commit 9ffcecf86a)
(cherry picked from commit 2071e4794f)
2015-06-03 19:45:08 +02:00
Jiří Klimeš
e9e032bd51 merge: increase 'max_replies_per_connection' limit in D-Bus configuration
The limit seems to be too low and causes problems in libnm-glib. We increase
the limit and warn in libnm-glib if it was exceeded.

(cherry picked from commit 242fe0bfb0)
2015-05-29 08:29:31 +02:00
Jiří Klimeš
84b3cb25b5 libnm-glib: print a bold warning about reaching a D-Bus limit
This causes incorrect application behaviour, so libnm-glib should warn
at least.
2015-05-29 08:29:04 +02:00
Jiří Klimeš
cf059e4513 dbus: increase 'max_replies_per_connection' limit in D-Bus configuration
D-Bus default limit of replies per connection has been lowered to 128 due to
CVE-2014-3638, see:
http://cgit.freedesktop.org/dbus/dbus/commit/?id=5bc7f9519ebc6117ba300c704794b36b87c2194b
https://bugs.freedesktop.org/show_bug.cgi?id=81053

The limit seems to be too low and causes problems in libnm-glib, that will not
return all NetworkManager connection profiles if there are too many of them
(roughly more than the limit). As a consequence, libnm-glib based clients will
not work properly.

Lets increase the limit in our D-Bus org.freedesktop.NetworkManager.conf
configuration as we had it before.

See also older commit d5b31d55fa that did the
opposite thing (removing the limit because the default D-Bus limit was 8192 at
that time).
2015-05-29 08:29:04 +02:00
Dan Williams
19acc4987e Partially revert "dhcp: gracefully recover from failed DHCP BOUND state transitions (bgo #743700)"
This reverts commit 7daf63461d.

Turns out the removal of the second set of [] in configure.ac causes the command
to be wrong in 'configure' and the test to be incorrect.
2015-05-26 18:22:52 -05:00
Jiří Klimeš
394a867e69 libnm-glib: do not access NULL GError variable (rh #1224819)
dbus_g_proxy_call() should set GError if returning FALSE. But apparently there
is a bug in dbus-glib and the error can be NULL.

https://bugzilla.redhat.com/show_bug.cgi?id=1224819

(cherry picked from commit f46eb1fc20)
2015-05-26 16:06:02 +02:00
Dan Williams
a0ec4bf521 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.

(cherry picked from commit 5b1cde1bfc)
2015-05-20 14:26:48 -05:00
Dan Williams
aaf6e6b1cf systemd: fix build with toolchains not exporting CLOCK_BOOTTIME
See 123322c6d6 for the NM-side fix.  We
need this too for the systemd code.

(cherry picked from commit e47eca8761)
2015-05-19 16:04:23 -05:00
Thomas Haller
928494af2b connectivity: use default on missing connectivity.interval config
Manual page claims that a missing configuration option for connectivity
interval means "300". That was not the case for a long time (never?).

https://bugzilla.gnome.org/show_bug.cgi?id=723350

Based-on-patch-by: Mathieu Trudel-Lapierre <mathieu.trudel-lapierre@canonical.com>
(cherry picked from commit 652853e0d0)

Conflicts:
	src/nm-config-data.c
2015-05-19 15:37:14 +02:00
Thomas Haller
68582b5eff config: return internal field directly in nm_config_data_get_connectivity_interval()
We already initialize connectivity.interval apprepriately in constructor().
No need to MAX() it again.

(cherry picked from commit 5b04fde302)
2015-05-19 15:35:28 +02:00
Thomas Haller
9fbd4c17fa config: minor fix in read_entire_config()
Calling read_entire_config() without passing a @cli argument would
always have caused an assert due to unset @o_config_main_file.
That is not a real problem as that situation didn't arise. Still
fix it.

(cherry picked from commit ae0608eef5)
2015-05-19 15:35:24 +02:00
Beniamino Galvani
79c80f00cc dns: don't override DHCP-supplied search order with domain
NM always prepends the list of DNS domains received through DHCP to
the search list in /etc/resolv.conf, overriding the DHCP-supplied DNS
domain search order. This behavior is not entirely correct since it
changes the search order provided by system administrators.

We cannot simply avoid adding the DNS domain list to the search list
because this would break some configurations that rely on the 'domain'
option to deliver the search list.

This patch modifies the behavior of DNS manager to:
 - insert the DHCP-provided 'domain' at the end of 'searches' option
   so that 'searches' is always preferred
 - ignore 'domain' if 'searches' option exists and 'domain' is a
   single domain

https://bugzilla.gnome.org/show_bug.cgi?id=748900
(cherry picked from commit 6edc737173)
2015-05-17 19:25:17 +02:00
Thomas Haller
474848c238 core: merge branch 'th/reduce-info-logging-rh1212196'
https://bugzilla.redhat.com/show_bug.cgi?id=1212196

(cherry picked from commit c47b9624e2d2fc9ccb09ced96c5b7e720def563)
2015-05-13 18:45:18 +02:00
Thomas Haller
c531edc002 device/logging: downgrade log level of "Activation: Stage x of 5" messages
Only downgrade the <info> levels to <debug>. Leave
warnings unchanged.

https://bugzilla.redhat.com/show_bug.cgi?id=1212196
(cherry picked from commit 255f30c362)
2015-05-13 18:44:20 +02:00
Thomas Haller
c593be5c49 core/logging: reduce info logging messages for devices
https://bugzilla.redhat.com/show_bug.cgi?id=1212196
(cherry picked from commit b91b8a035c)
2015-05-13 18:44:15 +02:00
Thomas Haller
8da0a8104a device/logging: log connection UUID when activating connection
It is often hard to understand whether we activate an assumed
connection. Only the UUID is unique.

(cherry picked from commit 9983e4eff5)
2015-05-13 18:44:07 +02:00
Thomas Haller
3d17c73576 core/logging: adjust log line about loading setting plugins
We have different kinds of plugins (settings, dhcp, dns).
Clearify, that we are about to load "settings" plugins.

(cherry picked from commit e9b9d9b627)
2015-05-13 18:44:02 +02:00
Thomas Haller
bd83000816 core/logging: downgrade some <info> loggings to <debug>
These logging statements are compile time dependent and
add little informational value.

(cherry picked from commit d8e1d9b469)
2015-05-13 18:43:57 +02:00
Thomas Haller
80aaf076cf device: expose nm_device_has_capability() function
(cherry picked from commit 756b756c2c)
2015-05-13 18:43:51 +02:00
Thomas Haller
0c227e6b62 device: use NMDeviceCapabilities enum for device capabilities
(cherry picked from commit 2117bef864)
2015-05-13 18:43:40 +02:00
Thomas Haller
8be0592107 merge branch 'backport' into nm-1-0
Backport a few bug fixes from master.

Also backport the valgrind suppression file and changes to platform's
'test-common.c'.
2015-05-13 16:09:28 +02:00
Thomas Haller
b67d017619 platform/test: include call location in signal assertions
Hard to debug failures, if we don't print where the failure
happens.

(cherry picked from commit 500cbcba21)

Conflicts:
	src/platform/tests/test-common.c
2015-05-13 16:07:36 +02:00
Thomas Haller
adc145f537 platform/test: make asserting signals more flexible
Support accepting more then one signal at a time.
It is to be expected, that one change in platform raises
several signals. Extend the assertion helpers to express
that.

(cherry picked from commit 050c644cce)
2015-05-13 16:07:36 +02:00
Thomas Haller
5b068e82e5 test: fix wrong use of memcmp() in nmtst_platform_ip4_routes_equal()
And nmtst_platform_ip6_routes_equal().

As already indicated by the comment, using memcmp() doesn't really work
here. It worked up to now, because the NMPlatformIP4Route structure has no
padding at the end.

If we would have a last 'guint8' member (as we will add later),
initializing an arry of routes on the stack would not clear the bytes
from the padding and the comparison using memcmp() would fail.

(cherry picked from commit d8d0c481b8)
2015-05-13 16:07:36 +02:00
Thomas Haller
495209c145 platform: fix nm_platform_link_cmp() to consider ifindex
(cherry picked from commit f167346534)
2015-05-13 16:07:36 +02:00
Thomas Haller
2a8e698b76 valgrind: disable suppression for libnl
Not sure why (and whether!) this is really needed. Disable
it for now, resurrect it later if need be.

(cherry picked from commit bde42e78db)
2015-05-13 16:07:36 +02:00
Thomas Haller
7234352fd7 platform: fix memleak in link_delete()
Turns out, the valgrind suppression was hiding a memleak

(cherry picked from commit 0c258402c7)
2015-05-13 16:07:36 +02:00
Thomas Haller
c40e32c275 config: fix memleak of keyfile in finalize() of NMConfigData
Fixes: 9809eb4da1
2015-05-13 16:07:35 +02:00
Thomas Haller
272d2c83f1 valgrind: add libnl suppression
Add a comment about the upstream bug that fixes
the suppressed memleak in libnl.

Also, add a different backtrace for the same bug.
It currently doesn't hit easily, because we don't
call nl_msg_parse() often. In the future we will
though.

(cherry picked from commit 8e2ad8a3bd)
2015-05-13 16:07:35 +02:00
Thomas Haller
4ffc6f85c7 trivial: add comment to valgrind suppression file
(cherry picked from commit 815b436c0a)
2015-05-13 16:07:35 +02:00
Thomas Haller
f9ef0914b5 valgrind: add libnl suppression
Got this on F21, libnl 3.2.25-5.fc21

(cherry picked from commit 0731da16fa)
2015-05-13 16:07:35 +02:00
Thomas Haller
0f90e60df9 platform/test: refactor detection of root-test
(cherry picked from commit 313af401d3)
2015-05-13 16:07:35 +02:00
Piotr Drąg
c0917a075b po: update Polish (pl) translation (bgo #749164)
https://bugzilla.gnome.org/show_bug.cgi?id=749164
(cherry picked from commit 10d03ed5f5)
2015-05-12 13:06:51 +02:00
Dan Williams
5e7e59b040 build: correct help message about missing readline + termcap libraries
(cherry picked from commit 21fef6a357)
2015-05-11 10:33:51 -05:00