Commit graph

12282 commits

Author SHA1 Message Date
Thomas Haller
aadf202cf2 core: add @merge_flags argument to nm_ip4_config_merge() and nm_ip6_config_merge()
The new flags are not yet used, so there is no change in functionality.

The flags NM_IP_CONFIG_MERGE_NO_ROUTES and NM_IP_CONFIG_MERGE_NO_DNS go
together with the 'ignore-auto-routes' and 'ignore-auto-dns' setting.

Note that for IPv4, NM_IP_CONFIG_MERGE_NO_DNS also ignores NIS, WINS, and dns-options.
This is different from current other places that handle 'ignore-auto-dns'
and only care about nameservers, domains, and searches.

(cherry picked from commit f7a8962dd4)
2015-08-06 18:00:44 +02:00
Lubomir Rintel
dee3dcf9c5 device: lower serverity of MTU adjustment logging
Warn is probably too harsh, but we still need to log the reason for the change.

(cherry picked from commit f7f9e734aa)
2015-08-04 13:46:02 +02:00
Lubomir Rintel
82da29746d device: don't modify the device MTU if it's unset
The MTU of 0 means default, not zero-length packets:

  <warn>  (wlp3s0): Lowering IPv6 MTU (1472) to match device MTU (0)
  <warn>  (wlp3s0): IPv6 MTU (0) smaller than 1280, adjusting
  <warn>  (wlp3s0): Raising device MTU (0) to match IPv6 MTU (1280)
  <error> [1437068831.306733] [platform/nm-linux-platform.c:2440] sysctl_set(): platform-linux: sysctl: failed to set '/proc/sys/net/ipv6/conf/wlp3s0/mtu' to '1472': (22) Invalid argument

Reported-by:  Jan Alexander Steffens <jan.steffens@gmail.com>

https://bugzilla.gnome.org/show_bug.cgi?id=752508
(cherry picked from commit a92d8b0c67)
2015-08-04 13:45:59 +02:00
Beniamino Galvani
375100715f device: set Ethernet MTU for PPPoE connections in stage2/config
Try to set the MTU of the parent Ethernet interface to match the
requested PPP MTU and MRU. This allows the negotiation of a PPP MTU
and MRU greater than 1492.

(cherry picked from commit 1d3eff45d2)
2015-08-04 12:43:17 +02:00
Beniamino Galvani
ecb93850c1 device: set MTU on IP interface
Fixes: 7ba2a058f2
(cherry picked from commit 0a04be41d4)
2015-08-04 12:43:17 +02:00
Lubomir Rintel
6f616d4c4b libnm-core,libnm-util: drag in glib.h for nm-version.h
G_UNAVAILABLE defines need it.

Fix building of the Qt example.
2015-07-23 10:06:41 +02:00
Thomas Haller
82ddd94793 default-route: merge branch 'th/default-route-on-unmanaged-device-rh1244483'
Fix wrongly managing the default-route on unmanaged devices. Also,
improve handling for p2p link with an 0.0.0.0 IPv4 gateway.

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

(cherry picked from commit 7243c9f3d4d0c0d0508c9bed326eea99336196bd)
2015-07-22 14:51:31 +02:00
Thomas Haller
9cfdbf6a06 libnm-core: don't assert against non-NULL @ip argument to canonicalize_ip()
Remove an assertion in canonicalize_ip() to assert that either a
non-NULL @ip is given, or @null_any is TRUE.

The condition of the assert is not easy to understand without context.
Instead the caller should already handle %NULL properly.

All callers that pass @null_any=FALSE to canonicalize_ip(), already assert
that the argument is not %NULL. With the exception of nm_ip_route_new()
which however checks for a valid @dest early on.

(cherry picked from commit 7f129b976c)
2015-07-22 14:50:51 +02:00
Lubomir Rintel
2958b3d1af libnm-core: 0.0.0.0 is a valid gateway too
It makes sense for point-to point links.

https://bugzilla.redhat.com/show_bug.cgi?id=1244483
(cherry picked from commit f14fd048ff)
2015-07-22 14:50:51 +02:00
Thomas Haller
89b630ff32 libnm-core: fix nm-setting-ip-config.c:valid_ip() to handle %NULL argument
We call valid_ip() from nm_ip_route_new() to check whether an untrusted string
is a valid ip address. Properly handle %NULL argument.

Fixes: 21c8a6b20e
(cherry picked from commit 9342568694)
2015-07-22 14:50:51 +02:00
Thomas Haller
fa2b8fdbdf libnm-core: properly handle %NULL @ip in nm_utils_ipaddr_valid()
A is_valid() function should just accept NULL as input and
return "invalid". It certainly should not crash.

Fixes: 21c8a6b20e
(cherry picked from commit 2b55de8560)
2015-07-22 14:50:51 +02:00
Lubomir Rintel
f11e4c31ee ip4-config: 0.0.0.0 is a valid gateway too
It makes sense for point-to point links.

https://bugzilla.redhat.com/show_bug.cgi?id=1244483
(cherry picked from commit 063677101a)
2015-07-22 14:50:49 +02:00
Lubomir Rintel
5e9dd4b267 default-route-manager: pick up platform changes after NMDevice
If a default route is configured externally, we want the device to pick the
change and register it with the default-route-manager first.

https://bugzilla.redhat.com/show_bug.cgi?id=1244483
(cherry picked from commit e67b52ed16)
2015-07-22 14:49:16 +02:00
Thomas Haller
0ab389e15c device: always assume default-route for generate-assumed-connections
Commit d51975e changed, that we treat assumed and non-assumed
connections the same with respect to the default route. This is
certainly wrong, if we have an nm-generated-assumed connection
at hand. In this case, NM just generated a connection based on what
was configured on the system. Looking at that result and re-enforcing
the default-route is wrong.

We want to manage the default-route for assumed, persistent connections.
If the connection was assumed and generated, we do not.

This commit reverts d51975ed for nm-generated-assumed connection and
restores the previous behavior.

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

Fixes: d51975ed92
(cherry picked from commit bebeff69e8)
2015-07-22 14:49:16 +02:00
Thomas Haller
351a645ad6 device: move setting v4_commit_first_time/v6_commit_first_time to the end of merge_and_apply()
(cherry picked from commit cbd246c9b0)
2015-07-22 14:49:16 +02:00
Thomas Haller
83dadca08e device/trivial: rename private field in NMDevicePrivate
Rename "default_route.v4_configure_first_time" to "v4_commit_first_time".

For one, the name "commit" matches better to the @commit variable in ip4_config_merge_and_apply()
and ip6_config_merge_and_apply(). Then, we don't need this information
only for default-routes, so move the variable out of the @default_route
struct.

(cherry picked from commit ad03cdbc73)
2015-07-22 14:49:16 +02:00
Thomas Haller
3308114211 core: fix handling route-metric for nm_ip4_config_merge()
Fixes: bc75cd53a8
(cherry picked from commit 47cc91bef6)
2015-07-22 14:42:40 +02:00
Thomas Haller
9588c4633a core: detect route-metric when creating nm-generated-assumed connection
When generating a connection to assume it, also record the route-metric.
Do that by looking at the metric of the (best) default-route.

This is especially important since d51975ed92.
Now NM would also manage the default-route for assumed connections.
So the generated assumed connection would have a route metric based on
the device type, which might differ from the external configuration.
This caused NM to replace the externally configured default-route.

https://bugzilla.gnome.org/show_bug.cgi?id=750405
(cherry picked from commit bc75cd53a8)
2015-07-22 14:14:18 +02:00
Thomas Haller
1615d8c975 cli: fix metered to string property
nmc_property_connection_get_metered() must return non-localized strings
that can be parsed by nmc_property_connection_set_metered().

Fixes: f0aebfd746
(cherry picked from commit 5eba53cd53)
2015-07-22 13:54:32 +02:00
Beniamino Galvani
586bb2799f merge branch 'bg/metered-connections-bgo741725'
Expose information about whether a connection is metered and use some
heuristics to choose a reasonable default when the value is not
configured.

https://bugzilla.gnome.org/show_bug.cgi?id=741725
https://bugzilla.redhat.com/show_bug.cgi?id=1200452

(cherry picked from commit 7d09debdf0)
2015-07-22 13:53:38 +02:00
Beniamino Galvani
5c11d26a2e nm-manager: add 'metered' property
This introduces a global metered property which makes easier for
clients to obtain the metered status of the current primary
connection.

(cherry picked from commit 04d5804dd5)
2015-07-22 13:52:46 +02:00
Beniamino Galvani
83aba66a85 cli: fix error message localization
Valid values must not be translated in error messages generated in
nmc_string_to_bool() and nmc_string_to_tristate().

(cherry picked from commit bd4e1f37f8)
2015-07-22 13:52:46 +02:00
Beniamino Galvani
975afac6a4 ifcfg-rh: add support for CONNECTION_METERED
(cherry picked from commit 7e5e624daf)
2015-07-22 13:52:46 +02:00
Beniamino Galvani
1ab766b61b ifcfg-rh: change type of svTrueValue() return value and argument
Change type of return value and 'def' argument of svTrueValue() to
gint to make clear that it can be something different from TRUE and
FALSE.

(cherry picked from commit 862fd91df0)
2015-07-22 13:52:46 +02:00
Beniamino Galvani
afd1bf5642 core: update device 'metered' property on connection state change
The metered property of a NMDevice that reaches the activated state is
copied from the active connection and if its value is 'unknown' some
heuristics are used to guess the actual value.

When the connection is torn down the metered property is reset to
'unknown'.

(cherry picked from commit a86255a043)
2015-07-22 13:52:46 +02:00
Beniamino Galvani
c41fe4c659 dhcp: detect NMIP4Config 'metered' flag based on ANDROID_METERED DHCP option
Some versions of Android's DHCP server send option 43 (Vendor specific
information) with value "ANDROID_METERED" in Wi-Fi hotspot mode.

Mark the NMIP4Config as metered when such option is received.

(cherry picked from commit 1e39b2320d)
2015-07-22 13:52:46 +02:00
Beniamino Galvani
75f0c79494 systemd/dhcp: add support for vendor specific DHCP option
This adds support for DHCP option 43 (Vendor Specific Information) to
the internal DHCP client. The option carries an opaque object of n
octets, interpreted by vendor-specific code on the clients and
servers.

(cherry picked from commit 3c2f4a17f9)
2015-07-22 13:52:46 +02:00
Beniamino Galvani
54ebd11026 core: add 'metered' flag to NMIP4Config
Some DHCP servers send specific options to give a hint that clients
should avoid unneeded data usage.

Add a metered flag to NMIP4Config to keep track of this information.

(cherry picked from commit 68db65b727)
2015-07-22 13:52:46 +02:00
Beniamino Galvani
a4cdf4a63c cli: add support for 'metered' connection property
(cherry picked from commit f0aebfd746)
2015-07-22 13:52:46 +02:00
Beniamino Galvani
5496a91575 cli: add nmc_string_to_tristate()
(cherry picked from commit 609f4f37c0)
2015-07-22 13:52:45 +02:00
Beniamino Galvani
4eb05767ee libnm-core: add 'metered' property to NMSettingConnection
Add a 'metered' enum property to NMSettingConnection with possible
values: unknown,yes,no. The value indicates the presence of limitations
in the amount of traffic flowing through the connection.

(cherry picked from commit 6f647fe689)
2015-07-22 13:52:45 +02:00
Beniamino Galvani
e16c068289 cli: add 'metered' property to device
(cherry picked from commit f208e7030f)
2015-07-22 13:52:45 +02:00
Beniamino Galvani
77a7e913a2 core,libnm: add 'metered' property to NMDevice
(cherry picked from commit bbbf522941)
2015-07-22 13:52:45 +02:00
Beniamino Galvani
1fa10e9766 build: add NM_AVAILABLE_IN_1_0_6 define 2015-07-22 13:49:31 +02:00
Tore Anderson
f42d3d9950 device: prefer wifi over wwan by default
This makes wifi preferred to wwan (the modem and bluetooth device types
to be specific) by default, so that users that care about being
connected at all times can keep both enabled with auto-connect. As wifi
is usually unmetered and often faster than wwan, it makes sense to
prefer it. This is also how pretty much every smart-phone in the world
behaves, so it aligns better with user expectations too.

https://bugzilla.gnome.org/show_bug.cgi?id=744754
(cherry picked from commit 3efb6740fc)
2015-07-22 10:52:13 +02:00
Jiří Klimeš
439ff3841d cli: fix verifying flag-based properties (rh #1244048)
Some of the properties changed from GParamSpecUInt to GParamSpecFlags, namely
NM_SETTING_VLAN_FLAGS
NM_SETTING_DCB_APP_FCOE_FLAGS
NM_SETTING_DCB_APP_ISCSI_FLAGS
NM_SETTING_DCB_APP_FIP_FLAGS
NM_SETTING_DCB_PRIORITY_FLOW_CONTROL_FLAGS
NM_SETTING_DCB_PRIORITY_GROUP_FLAGS

(commit fcfb4b40ba)

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

(cherry picked from commit 94b1b53a91)
2015-07-17 11:51:20 +02:00
Jiří Klimeš
3af6be7aa6 docs: fix a copy/paste error in description of VLAN flags
(cherry picked from commit 2af10ef444)
2015-07-17 11:50:42 +02:00
Dan Williams
79e71ee832 merge: vpn: delay quitting when a new secrets request comes in (bgo #752237)
https://bugzilla.gnome.org/show_bug.cgi?id=752237
2015-07-16 16:53:04 -05:00
Dan Williams
774170016b libnm/libnm-glib: don't quit in the middle of asking for secrets (bgo #752237)
If the VPN plugin terminated and the user started it again, then the
quit timer will still be running and it sometimes happens that the
VPN plugin will quit while the UI is asking the user for secrets.
That's not very nice, so don't do that.

Reproducer: while connect to the VPN, suspend your laptop.  Then
resume it, and immediately re-start the VPN connection.  Watch the
secrets dialog disappear within a very short time.

https://bugzilla.gnome.org/show_bug.cgi?id=752237
2015-07-16 16:52:48 -05:00
Dan Williams
d22a2a3165 libnm/libnm-glib: clean up VPN plugin timeouts
Use nm_clear_g_source().
2015-07-16 16:52:48 -05:00
Thomas Haller
1e102bccdd connectivity: log warning when using https:// URI
https://bugzilla.gnome.org/show_bug.cgi?id=747866
(cherry picked from commit eab32a5252)
2015-07-16 17:11:04 +02:00
Dan Williams
171b54b11c connectivity: explicitly check for 511/Network Authentication Required (RFC6585) (bgo #670394)
If the response affirmatively indicates you're behind a portal, we might as well
use that information.

https://bugzilla.gnome.org/show_bug.cgi?id=670394
(cherry picked from commit 6a81daf1cb)
2015-07-16 17:11:02 +02:00
Thomas Haller
5316d4dec7 config/rpm: use plain HTTP URI for connectivity checking
https://bugzilla.gnome.org/show_bug.cgi?id=747866
(cherry picked from commit 2a3a4eb16f)
2015-07-16 16:52:56 +02:00
David Shea
bfb6c78430 libnm: handle illegal characters in nm_utils_ssid_to_utf8() (rh #1243078)
g_convert_with_fallback() will fail if the SSID contains characters that
are not legal in the source encoding, which, if $LANG is not set, will
be ASCII. If this happens, replace all non-ASCII and non-printable
characters with '?'. It is possible that nm_utils_ssid_to_utf8() will
now return an empty string (e.g., the source string is actually
big-endian UTF-16 and g_strcanon() stops on the first byte), but it will
not return NULL.

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

(cherry picked from commit 568b4ad31f)
2015-07-16 14:24:47 +02:00
Lubomir Rintel
a24f089728 build: fix comment for NM_MORE_LOGGING
Reported-by: Michael Biebl <biebl@debian.org>
(cherry picked from commit 924117c144)
2015-07-15 11:04:40 +02:00
Thomas Haller
a51a95b7b3 build/trivial: move declaration of NM_AVAILABLE_IN_0_9_10 macro
Move the declaration of the macro to make it more similar to the
version file on master.
2015-07-15 10:41:27 +02:00
Thomas Haller
c27385b401 build: add NM_VERSION_1_0_6 macro and bump NM_VERSION_CUR_STABLE 2015-07-15 10:36:45 +02:00
Dan Horák
13320ba35c contrib/rpm: WEXT depends on enabled wifi
(cherry picked from commit 97cf6e47dd)
2015-07-14 19:03:10 +02:00
Lubomir Rintel
a54618e722 release: bump version to 1.0.5 (development) 2015-07-14 18:47:18 +02:00
Lubomir Rintel
f27429138f release: bump version to 1.0.4 2015-07-14 18:38:05 +02:00