Commit graph

12272 commits

Author SHA1 Message Date
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
Thomas Haller
eb4f8dd278 route-manager: merge branch 'th/route-full-sync'
Fix route manager not to delete externally added routes
but only routes that were previously added by route manager.

Also, add a test case and refactor the _exists() functions
to have them more useful.

(cherry picked from commit 5cc2eabe5d)
2015-07-14 13:45:27 +02:00
Thomas Haller
3cbc8981d6 route-manager/test: add test for full-sync
(cherry picked from commit ae721e7f0a)
2015-07-14 13:44:57 +02:00
Thomas Haller
ba44a92f52 test: add nmtst_platform_ip4_route() utils
(cherry picked from commit cf4b1a0c3d)
2015-07-14 13:44:57 +02:00
Thomas Haller
642c38b26b platform: replace addr/route exists() functions by get()
Rename exists() functions to get() and return the cached platform
object.

(cherry picked from commit 6f8fcd2f47)
2015-07-14 13:44:57 +02:00
Thomas Haller
cf7529b66c route-manager: align trace logging statement
(cherry picked from commit 7bda970928)
2015-07-14 13:44:57 +02:00
Thomas Haller
150dd2adc6 routes: fix race syncing routes by not doing full-sync
In most cases, when syncing routes, we should only remove routes
that were configured by us previously. Otherwise, there is a race
that we can remove routes added externally.

Now, when applying IP configuration for a device, only do a full-sync
at the first time when we activate the device. Later on, only remove
routes that were added by us.

(cherry picked from commit 8b015826e6)
2015-07-14 13:44:57 +02:00
Thomas Haller
49a7418d33 routes/trival: add argument @routes_full_sync to IP config commit
The argument is still unused, so no behavioral change yet.

(cherry picked from commit 6124f5b94a)
2015-07-14 13:44:56 +02:00
Thomas Haller
b159b668b3 route-manager: add argument to to only remove routes that were added by NMRouteManager
Add an argument @full_sync to the sync method of NMRouteManager.
@full_sync was what we did up to now, meaning, we removed every
route on the interface that was no on our internal list of known
routes.

Now with !@full_sync, only remove routes that were tracked previously.
This means, we will only remove routes that were added by us previously.

Don't make use of the new option yet. So there is no change of behavior
yet.

(cherry picked from commit 65f2090cc2)
2015-07-14 13:44:56 +02:00
Thomas Haller
de0f893c14 route-manager/trivial: fix naming of local variable
(cherry picked from commit b9bc960e97)
2015-07-14 13:44:56 +02:00
Lubomir Rintel
bc82f6f690 vpn-plugin-old,dispatcher: cast unchecked g_variant_lookup() calls to void
This is done to silence coverity. In the dispatcher the existence of the
key is checked before and we're fine with leaving the value untouched
in the vpn-plugin-old.

(cherry picked from commit a9996c4f1d)
2015-07-14 13:19:28 +02:00