Commit Graph

7207 Commits

Author SHA1 Message Date
Thomas Haller
a05b04c0fd dhcp/trivial: remove shaddowed '#if 0 /* NM_IGNORED */' block
Remove '#if 0' inside another '#if 0' block.
2015-03-02 14:22:08 +01:00
Thomas Haller
f3ad60b434 route-manager: define singelton using NM_DEFINE_SINGLETON_GETTER()
Fixes: 874e4a7595
2015-02-27 21:40:44 +01:00
Thomas Haller
ea0d0b3086 route-manager/build: fix out-of-tree builds for route-manager tests
Fixes: 0659a67c8f
2015-02-27 19:36:43 +01:00
Dan Williams
79aac22148 build: order ADSL plugin build after core files
Build it right before the other plugins.
2015-02-27 10:36:23 -06:00
Dan Williams
677cee0f23 dhclient: use fqdn.fqdn for server DDNS updates
dhclient only supports fqdn.fqdn for server DDNS updates with
DHCPv6.  And even though the underlying DHCP options that fqdn.fqdn
controls allow non-qualified hostnames on the wire, dhclient does
not.  So we must require a fully-qualified name for DHCPv6.

Second, while no-client-updates seems like it should be "off", doing
that apparently makes dhclient set the "O" flag to 1 which appears to
be a bug, and results in the server not doing the DDNS update.  So
we must stop setting that option too.

Found by: Alexander Groß
2015-02-27 10:05:56 -06:00
Lubomir Rintel
f981407a02 core: pass ifindex as parameter to nm_ip6_config_new() 2015-02-27 16:50:09 +01:00
Dan Williams
84f54f0a5f core: pass ifindex as parameter to nm_ip4_config_new() 2015-02-27 16:50:09 +01:00
Lubomir Rintel
0659a67c8f route-manager: add test 2015-02-27 16:48:28 +01:00
Lubomir Rintel
4c3ba29b40 route-manager: remember routes that should be active
Kernel likes to remove a route in case an equivalent route is added to another
interface. Avoid this situation and only apply the new routes in case the ones
that would cause a conflict are removed.

https://bugzilla.redhat.com/show_bug.cgi?id=1164441
https://bugzilla.gnome.org/show_bug.cgi?id=740064
2015-02-27 16:48:28 +01:00
Lubomir Rintel
7c52d094ed route-manager: normalize ipv6 route metrics during comparison
IPv6 metric of zero is equal to 1024.
2015-02-27 16:48:28 +01:00
Lubomir Rintel
72cefd5162 fake-platform: normalize ipv6 route metric before deletion 2015-02-27 16:48:28 +01:00
Lubomir Rintel
4d097829f0 fake-platform: reject adding routes without the gateway on the same interface
This mimics Linux behavior.
2015-02-27 16:48:28 +01:00
Lubomir Rintel
f6c9b4ff83 fake-platform: override routes that clash
This is done to more closely mimic what Linux does.
2015-02-27 16:48:28 +01:00
Lubomir Rintel
1ee03eeb5a fake-platform: move route deletion above addition
No change in behavior.

We'll need it when we'll remove routes that clash upon addition.
2015-02-27 16:48:27 +01:00
Lubomir Rintel
72e8c534e0 fake-platform: don't return null routes in place of deleted ones 2015-02-27 16:48:27 +01:00
Lubomir Rintel
52711b5d89 ip6-config: keep track of ifindex
No functional change, a cosmetic thing for now.

We want it set before any routes are added and ensure routes have a valid
ifindex before we pass it to the platform.

In a future NMRouteManager will need to look up the route for a device in
its cache thus we'll need to make sure routes passed to the it have an
appropriate ifindex set.
2015-02-27 16:48:27 +01:00
Lubomir Rintel
747292a4c3 ip4-config: keep track of ifindex
No functional change, a cosmetic thing for now.

We want it set before any routes are added and ensure routes have a valid
ifindex before we pass it to the platform.

In a future NMRouteManager will need to look up the route for a device in
its cache thus we'll need to make sure routes passed to the it have an
appropriate ifindex set.
2015-02-27 16:48:27 +01:00
Lubomir Rintel
874e4a7595 core: split route management code out from platform
Create a NMRouteManager singleton.

Refactor, no functional changes apart from change of log domain from
LOGD_PLATFORM to LOGD_CORE.

Subsequent commit will keep track of the conflicting routes, avoid overwriting
older ones with newer ones and apply the new ones when the old ones go away.
2015-02-27 16:48:27 +01:00
Lubomir Rintel
47167cab4f platform: fix route addition ordering 2015-02-27 16:48:27 +01:00
Jiří Klimeš
dead766c3b keyfile: update testcase for multicast-snooping property 2015-02-26 09:08:13 +01:00
Jiří Klimeš
b9c79de295 ifcfg-rh: read/write multicast-snooping property 2015-02-26 09:08:13 +01:00
Jiří Klimeš
1252386940 device: add multicast-snooping option support 2015-02-26 09:08:13 +01:00
Lubomir Rintel
73e8aeadba dns-manager: react to dns management mode changes
Load a different plugin when the configuration changes.
2015-02-25 18:25:04 +01:00
Lubomir Rintel
aa672b2dc2 config: move dns mode configuration to NMConfigData
This will make is possible for the NMDnsManager to watch for
configuration changes.
2015-02-25 18:25:04 +01:00
Aleksander Morgado
a84744324f wwan: indentation & alignment fixes 2015-02-24 16:04:45 -06:00
Aleksander Morgado
85d9132464 wwan: new retry logic when ipv4=auto and ipv6=auto
When ipv4=auto and ipv6=auto, we'll first try with the IPv4v6 PDP type, and if
that fails (e.g. if either the modem or the operator doesn't support it), we'll
fallback to trying with IPv4 or IPv6 PDP types (only if may-fail configuration
allows it).

Patch based on a previous implementation by Dan Williams <dcbw@redhat.com>

https://bugzilla.gnome.org/show_bug.cgi?id=733696
2015-02-24 16:04:37 -06:00
Lubomir Rintel
600489003f device: set the reason for when deactivating for another activation
It's always user requested -- auto activation never happens on already active
devices. nm_device_release_one_slave() rightly asserts teardown with
(un)configuration does not happen for no reason at all.

https://bugzilla.gnome.org/show_bug.cgi?id=744812
2015-02-24 18:43:00 +01:00
Lubomir Rintel
d37f2280b7 manager: don't re-assume generated connections
They're being torn down as their device is being deactivated.

https://bugzilla.gnome.org/show_bug.cgi?id=744812
2015-02-24 18:42:52 +01:00
Thomas Haller
6cdcf36a3d device: skip generating enums for internal flags with glib-mkenums 2015-02-24 18:01:22 +01:00
Thomas Haller
0bfe635119 device: accept user activation request while waiting for carrier
https://bugzilla.redhat.com/show_bug.cgi?id=1079353
2015-02-24 11:49:04 +01:00
Thomas Haller
d80f1bf4f0 device: eliminate direct calls to check_connection_available() in favor of nm_device_check_connection_available()
It was confusing to understand the difference between calling nm_device_connection_is_available()
and check_connection_available(), they behaved similar, but not really
the same. Especially nm_device_connection_is_available() would look
first into @available_connetions, and might call check_connection_available()
itself. Whereas @available_connetions was also populated by testing
check_connection_available(). This interrelation makes it hard to
understand when nm_device_connection_is_available() returned true.

Rename nm_device_connection_is_available() to nm_device_check_connection_available()
and remove all direct calls of check_connection_available() in favor of
the wrapper nm_device_check_connection_available().

Now we only call nm_device_check_connection_available() with different
parameters (@flags and @specific_object). We also have the additional
guarantee that specifying more @flags will widen the result and making
a connection "more" available, while specifying a @specific_object will
restrict it.

This also changes behavior in several cases. For example before
nm_device_connection_is_available() for user-requests would always
declare matching connections available on Wi-Fi devices (only)
regardless of the device state. Now the device state gets consistently
considered.

For default-unmanaged devices it also changes behavior in complicated
ways, because before we would put connections into @available_connetions
for every device-state, but nm_device_connection_is_available() had a
special over-ride only for unmanaged-state.

This also fixes a bug, that user can activate an unavailable Wi-Fi
device:
  nmcli radio wifi off
  nmcli connection up wlan0
2015-02-24 11:49:04 +01:00
Thomas Haller
e524be2c34 device: remove debug logging from is_available()
Having logging statements in a simple getter (or is_*()) means
you cannot call these functions without cluttering the log.

Another approach would be to add an @out_reason argument, and
callers who actually care log the reason. For now, just get rid
of the messages.
2015-02-24 11:49:04 +01:00
Thomas Haller
37ebeccaa7 device: implement flag NM_DEVICE_CHECK_DEV_AVAILABLE_IGNORE_CARRIER for is_available() 2015-02-24 11:49:04 +01:00
Thomas Haller
52dbb2398a device: add flags to nm_device_is_available() 2015-02-24 11:49:04 +01:00
Thomas Haller
e96af59444 device: add flags argument to check_connection_available() 2015-02-24 11:49:03 +01:00
Thomas Haller
5a04273715 device: merge check_connection_available_wifi_hidden() into check_connection_available()
Only refactoring, no behavioral change.
2015-02-24 11:49:03 +01:00
Thomas Haller
364c4476e3 device: refactor nm_device_connection_is_available()
No functional change, but refactor the function to
return early.
2015-02-24 11:49:03 +01:00
Thomas Haller
a7e0a038bf device/trivial: rename argument in nm_device_connection_is_available()
The argument name should express what the caller wants
(he wants to know, whether the connection can be activated
for an internal or external activation request).

Whether that involves checking device-specific overrides, is
not the point -- nm_device_check_connection_compatible() is
also a virtual function with device-specific overrides.
2015-02-24 11:49:03 +01:00
Thomas Haller
b9da094da9 device: fix leaking queued NMActiveConnection
The queued activation request must transition state to
DEACTIVATED, otherwise it is not removed from the list
of active_connections in NMManager.
2015-02-24 11:47:35 +01:00
Thomas Haller
aefd269308 device: add special NM_UNMANAGED_ALL flag 2015-02-24 11:35:22 +01:00
Thomas Haller
dba5e8e731 device: don't remove and re-add pending action in nm_device_bring_up() 2015-02-24 11:35:22 +01:00
Thomas Haller
3cb5d20c34 device: don't add dummy value to @available_connections hash
GHashTable is optimized for usage of a set, where the key equals
the value. Don't add a dummy value.
2015-02-24 11:35:22 +01:00
Thomas Haller
c6778ad1b7 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'.
2015-02-24 10:35:24 +01:00
Thomas Haller
3bcc5e4bd0 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.
2015-02-24 10:35:24 +01:00
Thomas Haller
5c2e1afd1b 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.
2015-02-24 10:35:24 +01:00
Thomas Haller
2051944333 core: remove nm_match_spec_string()
It was only used to match against "*", in a case-insensitive
way.
2015-02-24 10:35:24 +01:00
Thomas Haller
2b518538be 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*"
2015-02-24 10:35:24 +01:00
Thomas Haller
9080ad696d core/test: add test for nm_match_spec() 2015-02-24 09:26:50 +01:00
Pavel Šimerda
091732e13b keyfile: ignore all dot files (bgo#735824)
https://bugzilla.gnome.org/show_bug.cgi?id=735824
2015-02-23 14:44:19 +01:00
Thomas Haller
a823217b1f keyfile: add nm_keyfile_plugin_utils_escape_filename() function
We have nm_keyfile_plugin_utils_should_ignore_file() to ignore certain
files based on patterns. We also need a matching escape function to
avoid saving connections with a name we would ignore later.

https://bugzilla.gnome.org/show_bug.cgi?id=735824
2015-02-23 14:44:19 +01:00