Commit Graph

360 Commits

Author SHA1 Message Date
Pavel Šimerda
2167e4376b Revert "platform: work around missing kernel netlink notifications of default route changes"
This reverts commit 42b4323902.
2013-08-02 22:17:06 +02:00
Dan Williams
42b4323902 platform: work around missing kernel netlink notifications of default route changes
It appears the kernel does not send notifications via netlink if the
default route is removed in some cases.  This causes the platform
route cache to become stale, and thus when the default route is
reset by NM the platform thinks the route already exists, and does
not add it.  But the route doesn't exist, becuase the kernel silently
removed it without telling anyone.

Fix that with a big hammer by flushing/refilling the route cache when
devices are deactivated (deletion of their addresses causes the default
route to be removed by the kernel) and when the default route is
updated by NM itself.

Pavel: if we find a more granular method, we should probably revert
this as the cache refill can be expensive.
2013-07-31 12:14:52 -05:00
Pavel Šimerda
b502b6cd58 platform: ignore kernel-generated routes
This is necessary to avoid tinkering with IPv4 prefix routes
automatically inserted by the kernel for each IPv4 address.

https://bugzilla.gnome.org/show_bug.cgi?id=705102
2013-07-30 11:40:19 +02:00
Pavel Šimerda
68c3e1153c platform: update all address lifetimes
The nm_platform_ip[46]_address_sync() functions no longer use
nm_platform_ip[46]_address_exists() to avoid adding already
existing addresses. That means nm_platform_ip[46]_address_add()
is now called for *all* commited addresses and the lifetimes
are thus always updated.

Because of that, nm_platform_ip[46]_address_add() had to be modified to
accept existing addresses and update their lifetimes when appropriate.

https://bugzilla.gnome.org/show_bug.cgi?id=705102
2013-07-30 11:40:19 +02:00
Pavel Šimerda
afc3c2617a platform: cosmetic changes 2013-07-27 00:47:04 +02:00
Pavel Šimerda
2ef7110f37 platform: fix memory leaks 2013-07-27 00:47:04 +02:00
Pavel Šimerda
f121995fad platform: add support for address lifetimes 2013-07-26 22:45:15 +02:00
Pavel Šimerda
aca9b9b570 platform: fix udev/kernel interface race conditions
A network interface is only exposed if it's recognized by both netlink
cache and udev.
2013-07-26 21:14:08 +02:00
Pavel Šimerda
6d688f9c87 trivial: simplify a condition 2013-07-26 18:16:18 +02:00
Pavel Šimerda
7cc7a38288 platform: handle address/route deletion upon link actions (bgo #704770)
When link goes !IFF_UP by internal or external action, we need to delete
related routes from the route cache. The same is done for both addresses
and routes upon link removal.

https://bugzilla.gnome.org/show_bug.cgi?id=704770
2013-07-24 09:49:03 -05:00
Pavel Šimerda
38a57b3497 platform: listen for route changes properly 2013-07-24 10:05:41 +02:00
Pavel Šimerda
f625d6a269 platform: handle netlink failures properly 2013-06-21 04:03:41 +02:00
Pavel Šimerda
40cb2f4c29 platform: remove cached addresses and routes for deleted devices 2013-06-21 04:02:32 +02:00
Pavel Šimerda
67731a088e platform: workaround a libnl bug affecting default routes
Current versions of libnl3 use nl_addr_get_len() instead of
nl_addr_get_prefixlen() to determine the default route. Therefore we're
employing a workaround that sets the address length to zero for default
routes.

Unfortunately this workaround causes nl_addr to have wrong address size,
which in turn requires another workaround in init_ip4_route() as well as
init_ip6_route() to cope with the inconsistency.

Even though this solution is very very ugly, we didn't find a better
one. Not calling rtnl_route_set_dst() didn't solve the problem. Thomas
Graf promised to fix the libnl problem upstream. When bumping dependency
to a version that does this correctly, the workarounds can be removed.
2013-06-21 01:28:26 +02:00
Dan Williams
7c5bd0c64d platform: fix return value for no-firmware case
The function returns 'gboolean' so it shouldn't be returning an
enum, but it should instead set the platform error and return FALSE.
2013-06-19 12:28:48 -05:00
Pavel Šimerda
ed37ceeb91 trivial: platform: add_kernel_object now returns int, not gboolean 2013-06-19 13:28:00 +02:00
Dan Winship
c19da3c71f platform: add support for creating InfiniBand subdevices 2013-06-13 15:56:14 -03:00
Dan Winship
bc1a764e1a platform: fix recognition of InfiniBand devices 2013-06-13 15:52:50 -03:00
Dan Winship
8a93c83161 platform: fix type_name of unknown devices
The whole point of having type_name separate from type was so that
unknown devices could still have known device types. But I wrote it
wrong and then didn't notice until explicitly vxlan support got
removed and vxlans started showing up as "unknown".
2013-06-07 11:07:40 -03:00
Dan Williams
bc60d37050 platform: fix enumeration of devices at startup to use udev after 2fe8019a
nm_platform_query_devices() was just looking in the link_cache,
completely ignoring udev, which means that the link list wasn't
filtered for things NM wants to ignore.
2013-06-06 11:41:30 -05:00
Dan Winship
05216f67d6 platform: add NMPlatformLink.parent, sort link_get_all() output
Add a "parent" field to NMPlatformLink, giving the parent device
ifindex for devices that have a parent.

Make nm_platform_link_get_all() sort the links before returning them,
so that masters appear after all of their slaves, and parent devices
appear before their children.

Remove the second call to nm_platform_query_devices() from NMManager
since it is now guaranteed that an NMDeviceVLAN's parent NMDevice will
have been created before the NMDeviceVLAN.
2013-06-05 17:49:25 -03:00
Dan Winship
2fe8019a79 platform: merge remaining NMUdevManager functionality into NMLinuxPlatform
Merge the net-subsystem-monitoring functionality of NMUdevManager into
NMLinuxPlatform (and kill NMUdevManager). NMLinuxPlatform now only
emits link-added signals after udev processes the device, and uses
udev attributes to further identify the device. NMManager now
identifies devices solely based on the NMLinkType provided by the
platform.
2013-06-05 17:49:25 -03:00
Dan Winship
f3db2ae95c platform: add some ifdefs to support kernel 3.6 2013-06-04 12:01:38 -03:00
Dan Winship
a7068f48c5 Revert "platform, devices: add support for vxlan devices"
This requires a very recent kernel to even compile, and the kernel
code is still rapidly changing (eg, adding IPv6 support). So take it
out for now, until it stabilizes.

This reverts commit 7f0f04d106.
2013-06-04 10:30:30 -03:00
Dan Winship
d9e0a7cbd6 platform, devices: add support for gre and gretap devices 2013-06-04 10:01:14 -03:00
Dan Winship
7f0f04d106 platform, devices: add support for vxlan devices 2013-06-04 10:01:14 -03:00
Dan Winship
e9f364548a platform, devices: add support for macvlan and macvtap devices 2013-06-04 10:01:13 -03:00
Dan Winship
add316a403 platform, devices: add support for tun and tap devices 2013-06-04 10:01:13 -03:00
Dan Winship
329960bc18 platform: add support for ifb devices
(ifb devices have no device-type-specific properties, so they are
fully handled by NMDeviceGeneric without needing their own subclass).
2013-06-04 09:57:37 -03:00
Pavel Šimerda
ae8f2fdf8a platform: merge NM_LINK_TYPE_GENERIC into NM_LINK_TYPE_UNKNOWN 2013-05-27 18:10:20 +02:00
Dan Winship
4416155bea platform, devices: add support for veth devices
https://bugzilla.gnome.org/show_bug.cgi?id=687254
2013-05-24 16:10:03 -03:00
Dan Winship
0d6f2faefa core: use NMPlatform to figure out device types, where possible
Rather than having a bunch of udev-based tests, use
nm_platform_link_get_type() to categorize devices.

Incomplete, as NMPlatform still categorizes most hardware types as
"ETHERNET", so we still need udev-based tests for those.

https://bugzilla.gnome.org/show_bug.cgi?id=687254
2013-05-24 16:04:19 -03:00
Pavel Šimerda
f7fe685b69 platform: detect missing firmware on IFF_UP change 2013-05-24 11:41:54 +02:00
Pavel Šimerda
3f57ee53bc Revert "platform: detect missing firmware on IFF_UP change"
This reverts commit 01b95ef293.
2013-05-24 00:56:48 +02:00
Pavel Šimerda
01b95ef293 platform: detect missing firmware on IFF_UP change 2013-05-24 00:42:40 +02:00
Dan Winship
2bb5178897 devices, platform: fix up carrier-detection detection
Some devices aren't expected to support carrier detection, so there's
no reason to have NMDevice log about it. Move that message into
NMDeviceEthernet, where failure to support carrier-detect really is
worth mentioning.

Also, make NMDeviceEthernet use NMPlatform for carrier-detection
detection (and move the MII carrier-detect-support check from
NMDeviceEthernet into NMLinuxPlatform).

Finally, have NMDeviceGeneric actually check whether the device
supports carrier detect, rather than just always assuming it doesn't.
2013-05-20 16:38:34 -03:00
Pavel Šimerda
f63c7f8ee6 platform: link mtu setting 2013-05-18 04:38:17 +02:00
Pavel Šimerda
6c55e5a1c6 platform: link address setting 2013-05-18 04:38:17 +02:00
Pavel Šimerda
a28a880214 platform: vlan support 2013-05-18 04:38:17 +02:00
Pavel Šimerda
aa943f3115 platform: cleanup: use link_get, not rtnl_link_get
It sets up the correct error value for free and is more consistent.
2013-05-18 04:38:17 +02:00
Pavel Šimerda
342134179c platform: return NULL type_name on failure 2013-05-10 21:41:27 +02:00
Dan Williams
6850dccd39 build: silence compiler warning about unused return value 2013-05-09 10:51:27 -05:00
Dan Winship
6dc7f85ed9 platform: fix ethtool code
Need to initialize auto_g_free variables to NULL, in case we error out
before setting them to real values.
2013-05-08 11:24:50 -04:00
Dan Winship
7aefd5b5f4 platform: fix use of ethtool
The bits in the result of ETHTOOL_GFEATURES are not in any defined
order; you need to use ETHTOOL_GSTRINGS to get the names associated
with each bit to find what each one does. Fix
NMPlatformLinux:link_supports_vlans() to do this.

https://bugzilla.gnome.org/show_bug.cgi?id=699649
2013-05-07 16:47:34 -04:00
Dan Winship
be5ef71ab0 platform: add nm_platform_link_get_type_name()
Add a platform method to return the name of the link type. (Eg,
"ethernet", "loopback", "tun")
2013-05-07 12:46:56 -04:00
Pavel Šimerda
2c656e37dd platform: add mss attribute to NMPlatformIP*Route 2013-05-03 19:50:17 +02:00
Pavel Šimerda
e2009e3fe3 platform: don't use gateway as key attribute for routes
On Linux, the gateway attribute is not a key attribute and therefore is
not necessary for functions that just need to identify a route. This may
be revisited when porting to other platforms but for now I want to keep
things simple.
2013-05-03 15:38:57 +02:00
Dan Winship
283b8fb7d0 platform: add ifindex arg to NMPlatform signals
In some cases, callers don't need to distinguish, eg,
ip4-address-added from ip6-address-added, but just need to know what
device the event occurred on. Make this simpler by including the
ifindex as a separate explicit argument, allowing callers to just
ignore the struct part.
2013-05-03 08:39:00 -04:00
Pavel Šimerda
a313da882a platform: suppress kernel's automatic creation of bond0 (rh #953466)
Which it does whenever the 'bonding' module gets loaded no matter
what name the user wants to give the new bond interface.

Ported nm-system fix from commit 7cc95d8, using system() to avoid
dependency on NM libs.

Automatic test included. You have to run 'rmmod bonding' before testing
to ensure that the module is not already inserted. Second run without
rmmod always succeeds.
2013-04-29 14:05:01 +02:00
Pavel Šimerda
f5507633f8 platform: bridging and bonding options 2013-04-20 03:43:25 +02:00