Commit Graph

15047 Commits

Author SHA1 Message Date
Dan Winship
42df06e575 platform, devices: add support for vxlan devices
Since vxlan is new-ish, and vxlan IPv6 support in particular has only
been in the kernel since 3.11, we include our own copy of the vxlan
netlink constants rather than depending on the installed headers.
2014-03-06 09:48:15 -05:00
Dan Winship
b1adf22ebb platform: fix some tabs-vs-spaces
The nla_policy struct declarations for GRE, etc, were originally
copied from the kernel sources, where they used tabs to align the "="
columns. Fix them to use spaces instead.
2014-03-06 09:47:09 -05:00
Dan Winship
2bc903aaf1 devices: fix up parent/peer tracking in some virtual devices
NMDeviceGre and NMDeviceMacvlan didn't deal with the possibility that
the virtual device might be created before its parent's NMDevice is
created. Mostly fix this by having them put off the call to
nm_manager_get_device_by_ifindex() until someone actually requests the
device.

This is not perfect; if someone listening to notify::parent checks
right away, they may find that the parent property is still NULL, and
notify::parent will not be emitted again when it gets filled in. But
it's better than what's there now, when parent would remain NULL
forever in this case.

NMDeviceVeth did not have this problem, but it did have another
possible problem because it wasn't cleaning up its weak references
properly.
2014-03-06 09:47:09 -05:00
Dan Winship
18f35ec1d8 libnm-util, libnm-glib: Add master/slave-matching utils (rh #1045203)
Add functions for figuring out what device/connection types can be
slaves of other device/connection types.
2014-03-06 09:41:59 -05:00
Dan Winship
5cd37d250a libnm-glib: add nm_device_get_setting_type()
Add a function mapping NMDevices to their corresponding base NMSetting
types.
2014-03-06 09:38:36 -05:00
Dan Winship
4a5e2ced08 libnm-util: add nm_utils_check_virtual_device_compatibility()
Add a function encoding the logic of what virtual types support what
slave/parent types, so clients don't need to encode it themselves.
2014-03-06 09:37:20 -05:00
Dan Williams
a9c8addc91 core: reenable auto activation for slave connections with a matching UUID master
When activating a master, it reenables the auto activation of slave
connections for this master. Do not only match the device name, but also
check the connection UUID.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-03-05 21:15:20 +01:00
Thomas Haller
b69f624c98 core: implement function nm_active_connection_get_uuid()
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-03-05 21:15:20 +01:00
Thomas Haller
950cb2c44f core: rename function nm_active_connection_get_name() to nm_active_connection_get_id()
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-03-05 21:15:20 +01:00
Dan Winship
4753dff29e core: add some assertions to avoid clang analyzer false positives 2014-03-05 11:20:54 -05:00
Dan Winship
d86a61225d vpn-manager: remove some dead code
f3c2851c (port NMAgentManager, etc, to use NMAuthSubject) made it
unnecessary for callers to nm_settings_connection_get_secrets() to
decide whether to filter agents by UID or not, but NMVPNConnection was
still doing it itself anyway.
2014-03-05 11:20:54 -05:00
Dan Winship
6300ea57ab libnm-glib: fix a double free in NMDeviceVlan 2014-03-05 11:20:54 -05:00
Dan Winship
50dea202a8 libnm-util: fix minor bugs in nm_setting_vlan_remove_priority_str_by_value()
Plug a leak, remove some dead code.
2014-03-05 11:20:54 -05:00
Dan Winship
f43fa7a0ac platform: fix a logging bug
Absence of a "-" meant that a debug-level message got logged as an
error.
2014-03-05 11:20:54 -05:00
Jiří Klimeš
97804f41f1 Merge changes for addition of 'type' and 'id' properties to NMActiveConnection
Related: rh #1061822
2014-03-05 16:25:20 +01:00
Jiří Klimeš
3e44e7a9f8 example: simplify get-active-connections.py by using ID and Type properties 2014-03-05 16:17:13 +01:00
Jiří Klimeš
ee6f684f0a libnm-glib: support 'type', 'id' properties in NMActiveConnection (rh #1061822)
https://bugzilla.redhat.com/show_bug.cgi?id=1061822
2014-03-05 16:17:13 +01:00
Jiří Klimeš
28bd3cab28 core: add 'type' and 'id' property for NMActiveConnection (rh #1061822)
https://bugzilla.redhat.com/show_bug.cgi?id=1061822
2014-03-05 16:17:13 +01:00
Thomas Haller
eca6a49e2d platform: fix converting address flags in nm_platform_ip6_address_to_string()
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-03-05 11:06:37 +01:00
Thomas Haller
d6f6ccef43 core: fix adding gateway route for IPv6
Setting the address flag IFA_F_NOPREFIXROUTE broke adding the device route to
the IPv6 prefix because the check for nm_ip6_config_destination_is_direct()
caused the route to be skipped. This, together with the kernel no
longer adding the prefix route resulted in no device route for autoconf
/64 prefixes.

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

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-03-05 11:00:53 +01:00
Thomas Haller
8cd0de231a tivial/core: move common #defines to header file
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-03-05 10:59:24 +01:00
Thomas Haller
4f7b1cabc0 core: fix adding gateway routes within the own subnet
Before, when adding a gateway route to a destination within the
current subnets, it would be skipped because of the wrong assumption
that we already have a prefix route to that destination.

This assumption is wrong, because we want to reach the more specific
subnet via a gateway and not directly on the link.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-03-05 10:59:23 +01:00
Thomas Haller
bd93117cad trivial/core: remove duplicate #include
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-03-05 10:58:12 +01:00
Dan Winship
ba75ad2d95 rdisc: obey rtr_solicitations and rtr_solicitation_interval
The IPv6 spec say that when performing SLAAC, you should sent at most
3 RSes, at least 4 seconds apart. We were previously continuing to
send RSes forever if we didn't get back a response. Fix that.

(Since the fix involves making nm-lndp-rdisc use NMPlatform, it was
necessary to rewrite the rdisc test program a bit, to not try to
include <net/if.h>, which is incompatible with <linux/if.h>.)
2014-03-04 17:04:01 -05:00
Dan Winship
a10bd9991f core: move NMDevice's ip6_property_path() to NetworkManagerUtils 2014-03-04 17:04:01 -05:00
Dan Williams
3f079f3265 core: remove nm_device_can_interrupt_activation()
No longer used anywhere.
2014-03-04 15:21:58 -06:00
Dan Williams
46abe332b8 core: remove nm_device_ignore_carrier()
No longer used anywhere.
2014-03-04 15:21:58 -06:00
Dan Williams
3a7f07e2f0 core: postpone non-static master IP configuration until carrier
This got broken at some point.  The intent of ignore-carrier was always
to ignore the carrier for IP configuration for static/manual connections,
but never for DHCP/SLAAC where a link is actually required.  Thus
when checking whether to postpone IP configuration for a master interface
that's using DHCP/SLAAC, don't allow ignore-carrier to factor into
the decision.
2014-03-04 15:21:58 -06:00
Dan Williams
1d5847c8a6 core: match IPv4 'disabled' method to 'auto' when device has no link
If IPv4 configuration did not succeed or the device has no IPv4 addresses
when NM restarts, it will detect the existing device configuration as
'disabled'.  This can happen when a bridge has no slaves and thus cannot
perform IPv4 addressing because it has no carrier (since bridge carrier
status depends on slave carriers).  When NM starts or restarts, it
sees the bridge has no IPv4 address and assumes the IPv4 method is
'disabled'.  This creates a new connection, which blocks any slave
connections from activating if they specify their master via UUID
 (since the bridge's active connection is generated).

Fix this by allowing matches from 'disabled' to 'auto' if the device
has no carrier, and there are no other differences between the
original and the candidate connections.
2014-03-04 15:21:58 -06:00
Dan Williams
7b65f8934e core: refactor connection matching and add testcase
Refactor in preparation for some additional matching, and add testcases.
2014-03-04 15:21:58 -06:00
Dan Williams
2fe5ebe21c core: correctly handle pre-activation dependency failure (rh #1069695)
Dependencies may fail before the activation actually starts, like
when a software device gets removed while the activation is
scheduled but before it has started.  In these cases, the
activation request should fail.
2014-03-04 15:21:29 -06:00
Dan Williams
b7598bbb8c core: ensure ActiveConnections stay alive over activation paths
With some upcoming changes, ActiveConnection objects could change to
DEACTIVATED state during activation, for example if the AC's device
was removed while the AC was being authorized.

To ensure the AC stays alive and is not used after being freed,
keep a reference to the AC across authorization operations.
2014-03-04 15:21:29 -06:00
Thomas Haller
3e9ba55c3a platform: move asserts for sysctl_get/set functions to nm-linux-platform
Also assert inside of sysctl_get() that we read the expected file
locations. Especially because now we might log the content of these
files.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-03-04 21:21:35 +01:00
Thomas Haller
087c88f729 platform: add logging when reading and writing sysctl values
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-03-04 21:06:21 +01:00
Thomas Haller
6655d5c949 platform: remove logging about check_cache_items()
We don't thoroughly log the pointer values of our libnl objects,
so the logging in check_cache_items() is not usefull, it only
clutters the logfile.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-03-04 18:21:37 +01:00
Jiří Klimeš
b8915dae3c policy: fix crash caused by calling functions on connection==NULL
Crash appeared in:
nm_settings_connection_set_autoconnect_blocked_reason()
2014-03-04 16:53:35 +01:00
Dan Williams
7bfbd5e52a core: #include <gmodule.h> for G_MODULE_EXPORT
When some configure-time options aren't used, <gmodule.h> is not
included.  Fix that.
2014-03-04 09:11:23 -06:00
Jiří Klimeš
9e0f4179fd devices: fix compilation of nm_device_factory_new_link()
We have to return a value.
2014-03-04 11:07:33 +01:00
Dan Williams
c1a064b9a3 merge: move ATM, Bluetooth, and WWAN into device plugins (bgo #724324)
Enhance the device plugin interface and convert ATM, BT, and WWAN to
use it.  This saves 15% of the binary size of the core NM binary, and
packagers or users can decide which plugins they would like to install,
thereby saving disk space and memory.

https://bugzilla.gnome.org/show_bug.cgi?id=724324
2014-03-03 16:07:53 -06:00
Dan Williams
493bbbeb4a core: consolidate auto-activation recheck signals
Add a generic signal that devices can use to indicate that something
material in the network situation changed, and that auto-activation
may now be possible.  This reduces specific knowledge of device types
in the policy.
2014-03-03 09:32:41 -06:00
Dan Williams
aeb1e103d8 mobile: make WWAN support a plugin
Make WWAN support a plugin using the new device factory interface.
Provides a 5% size reduction in the core NM binary.

     Before    After
NM: 1187224  1125208  (-5%)
MM:       0   100576

(all results from stripped files)
2014-03-03 09:32:41 -06:00
Dan Williams
a9591aecaf bluez: make Bluetooth support a plugin
Make Bluetooth support a plugin using the new device factory interface.
Provides a 5% size reduction in the core NM binary.

     Before   After
NM: 1253016 1187224 (-5%)
BT:       0   85752

(all results from stripped files)
2014-03-03 09:32:41 -06:00
Dan Williams
71a52347f3 atm: make ADSL support a plugin
Make ADSL support a plugin using the new device factory interface.
Provides a 1% size reduction in the core NM binary.

      Before    After
NM:  1265336  1253016  (-1%)
ATM:       0    27360

(all results from stripped files)
2014-03-03 09:32:41 -06:00
Dan Williams
2a04df856b devices: rework device plugin interface to be more flexible
In preparation for making WWAN and Bluetooth plugins, rework
the device plugin interface to meet those plugins' needs and
port WiMAX over in the process.
2014-03-03 09:32:41 -06:00
Dan Williams
8e9b9fe423 mobile: convert to device removed signals
Instead of having NMManager listen directly to the ModemManager
for modem removal signals, have the NMDeviceModem and NMDeviceBt
listen for them (since they obviously have a pointer to the backing
NMModem object) and then re-emit any necessary device removal
signals to the manager.
2014-03-03 09:32:40 -06:00
Dan Williams
ee66964208 core: allow devices to indicate when they should be removed
Devices created by plugins will use this to indicate when their
backing resources have disappeared, at which point the manager
should remove them.
2014-03-03 09:32:40 -06:00
Dan Williams
fd3fe2200c core: add nm_connection_provider_get()
In reality the connection provider (NMSettings) is always the same
object, and some device plugins need access to it.  Instead of
cluttering up the device plugin API by passing the provider into
every plugin regardless of whether the plugin needs it, create
a getter function.
2014-03-03 09:32:40 -06:00
Dan Williams
fe6b86a078 core: don't ref the Manager singleton
The OLPC mesh code did rely on nm_manager_get() referencing the
singleton when returning it, but all other callers of nm_manager_get()
did not.  Thus the manager's refcount would always increase and
almost never decrease.  Fix the refcounting so that the manager
always has only one ref, and it's lifetime is controlled by
main() and nothing else.
2014-03-03 09:32:40 -06:00
Jiří Klimeš
550ce1e631 examples: add a GOI Python example for getting active connections 2014-03-03 15:15:08 +01:00
Jiří Klimeš
f24eee5ee3 examples: also print type of active connections 2014-03-03 14:28:51 +01:00