summaryrefslogtreecommitdiff
path: root/src/platform/nm-fake-platform.c
Commit message (Collapse)AuthorAgeFilesLines
* platform: give the platform an opportunity to override default-unmanagedLubomir Rintel2015-01-221-0/+7
| | | | | | | | | | | | | | | | | | | | Some out of tree drivers add Ethernet devices that are supposed to be managed by other their tooling, e.g. VirtualBox or VMWare. Rather than hardcoding their drivers (at least VirtualBox doesn't even set a "driver" property in sysfs) or hardcoding a logic that identifies such devices let's just add a possibility to blacklist them in udev. This makes it possible for whoever who ships such a driver to ship rules that prevent NetworkManager from managing the device itself. Furthermore it makes it possible for the user with special needs leverage the flexibility of udev rules to override the defaults. In the ent the user can decide to let NetworkManager manage default-unmanaged interfaces such as VEth or turn on default-unmanaged for devices on a particular bus. An udev rule for VirtualBox would look like this: SUBSYSTEM=="net", ENV{INTERFACE}=="vboxnet[0-9]*", ENV{NM_UNMANAGED}="1"
* platform/tests: fix errors in fake platform handling route metricsThomas Haller2015-01-121-0/+8
|
* platform: avoid conflicts when reinstalling the device-routeThomas Haller2014-12-111-0/+8
| | | | | | | | | | | | | | | | | | | Since f32075d2fc11252e5661166b2f46c18c017929e9, we remove the kernel added IPv4 device route, and re-add it with appropriate metric. This could potentially replace existing, conflicting routes. Be more careful and only take any action when we don't have a conflicting route and when we add the address for the first time. The motivation for this was libreswan which might install a VPN route for a subnet that we also have configured on an interface. But the route conflict could happen easily for other reasons, for example if you configure a conflicting route manually. Don't replace the device route if we have any indication that a conflict could arise. https://bugzilla.gnome.org/show_bug.cgi?id=723178
* platform: add paramter to ip4_route_add to set src (RTA_PREFSRC)Thomas Haller2014-11-251-1/+1
| | | | Signed-off-by: Thomas Haller <thaller@redhat.com>
* all: consistently include config.hDan Winship2014-11-131-0/+2
| | | | | | | | | | | config.h should be included from every .c file, and it should be included before any other include. Fix that. (As a side effect of how I did this, this also changes us to consistently use "config.h" rather than <config.h>. To the extent that it matters [which is not much], quotes are more correct anyway, since we're talking about a file in our own build tree, not a system include.)
* platform: support route_get_all() to return route for every ifindexThomas Haller2014-11-071-20/+6
| | | | | | | By passing an ifindex of 0, the search is not limited to a certain ifindex. Signed-off-by: Thomas Haller <thaller@redhat.com>
* platform: extend nm_platform_ipX_route_get_all() to return default-routes onlyThomas Haller2014-11-071-6/+20
| | | | | | | | Add a new enum NMPlatformGetRouteMode. This extends the existing functions nm_platform_ip4_route_get_all() and nm_platform_ip6_route_get_all() to return default routes only. Signed-off-by: Thomas Haller <thaller@redhat.com>
* core: cleanup type of route metric to ensure guint32Thomas Haller2014-11-071-8/+8
| | | | | | | Kernel, netlink an NMPlatformRoute treat route metrics as uint32. Fix several places to use the exact type. Signed-off-by: Thomas Haller <thaller@redhat.com>
* platform: don't include gsystem-local-alloc.h in nm-platform.hThomas Haller2014-11-071-0/+1
| | | | Signed-off-by: Thomas Haller <thaller@redhat.com>
* core: Move NMPlatformSource to nm-types.hLubomir Rintel2014-10-201-6/+6
| | | | | ...and rename it while at it. It's going to be useful outside nm-platform, to weight MTU options from various sources.
* platform: add @peer_address argument to nm_platform_ip4_address_delete()Thomas Haller2014-09-241-2/+3
| | | | | | | Deleting an IPv4 address using libnl requires the proper peer address. Pass the address of the peer on to nm_platform_ip4_address_delete(). Signed-off-by: Thomas Haller <thaller@redhat.com>
* libnm-core: change DBUS_TYPE_G_UCHAR_ARRAY properties to G_TYPE_BYTESDan Winship2014-09-041-1/+1
| | | | | | | | | | Change all DBUS_TYPE_G_UCHAR_ARRAY properties to G_TYPE_BYTES, and update corresponding APIs. Notably, this means they are now refcounted rather than being copied. Update the rest of NM for the changes. The daemon still converts SSIDs to GByteArrays internally, because changing it to use GBytes has lots of trickle-down effects. It can possibly be changed later.
* trivial: don't shadown link(3) in NMFakePlatformDan Williams2014-08-201-2/+2
|
* all: remove use of struct ether_addr / ether_aton()Dan Winship2014-08-071-1/+1
| | | | | | | | | | | | | Lots of old code used struct ether_addr to store hardware addresses, and ether_aton() to parse them, but more recent code generally uses guint8 arrays, and the nm_utils_hwaddr_* methods, to be able to share code between ETH_ALEN and INFINIBAND_ALEN cases. So update the old code to match the new. (In many places, this ends up getting rid of casts between struct ether_addr and guint8* anyway.) (Also, in some places, variables were switched from struct ether_addr to guint8[] a while back, but some code still used "&" when referring to them even though that's unnecessary now. Clean that up.)
* platform: use gs_free (instead of own define auto_g_free)Thomas Haller2014-07-151-4/+4
| | | | Signed-off-by: Thomas Haller <thaller@redhat.com>
* platform: improve tracking of route sourcesDan Winship2014-06-061-2/+4
| | | | | | | | | | | NMIP[46]Route had a "source" field, but it was always set to KERNEL for routes read from the kernel (even if they were originally added by NM). Fix things a bit by translating between our "source" field and the kernel's "protocol" field. https://bugzilla.gnome.org/show_bug.cgi?id=729203
* trivial: route-related whitespace/indentation fixesDan Winship2014-06-061-4/+6
|
* platform/test: fix expecting NM_PLATFORM_SOURCE_KERNEL in platform testsThomas Haller2014-06-051-0/+4
| | | | | | | | | | In this case, the fake platform implementation was wrong in that it did not set the source property of the route/address objects like linux platform does. Fix the test and the fake platform. https://bugzilla.gnome.org/show_bug.cgi?id=706293 Signed-off-by: Thomas Haller <thaller@redhat.com>
* platform/test: fix fake platform to emit signals synchronously (analog to ↵Pavel Šimerda2014-06-051-40/+2
| | | | | | | | | | | | | | | | | Linux platform) When adding a link, the Linux platform implementation raises the link-changed signal synchronously. Fix the fake platform to behave identically and also fix all the tests. This also fixes the Linux platform tests for the most part because now the test functions (and fake platform) behave like the Linux system implementation. https://bugzilla.gnome.org/show_bug.cgi?id=706293 Co-Authored-By: Thomas Haller <thaller@redhat.com> Signed-off-by: Thomas Haller <thaller@redhat.com>
* platform: add nm_platform_link_get()Thomas Haller2014-06-051-0/+11
| | | | Signed-off-by: Thomas Haller <thaller@redhat.com>
* platform: allow setting address when adding software link (bridge)Thomas Haller2014-05-301-8/+8
| | | | | | | | | Add an additional address parameter to link_add/bridge_add, to set the MAC address of software devices. https://bugzilla.gnome.org/show_bug.cgi?id=729844 Signed-off-by: Thomas Haller <thaller@redhat.com>
* platform: refactor signals by combining added/changed/removedThomas Haller2014-05-031-15/+15
| | | | | | | | Before platform raised 3 signals for each object type. Combine them into one and add a new parameter @change_type to distinguish between the change type. Signed-off-by: Thomas Haller <thaller@redhat.com>
* platform: add link_get_wake_on_lan()Dan Winship2014-04-171-0/+10
|
* wifi: move wifi-utils into platformDan Winship2014-04-171-0/+110
| | | | | Move wifi-utils into NMPlatform, and update callers to use the new NMPlatform wrappers
* platform: support address labels for IPv4 addressesDan Winship2014-03-261-1/+4
|
* platform, devices: add support for vxlan devicesDan Winship2014-03-061-0/+7
| | | | | | 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.
* platform: change sysctl_get/set error loggingDan Winship2014-02-271-3/+3
| | | | | | | | | Remove the "silent_on_error" flag from nm_platform_sysctl_get(), and make both get() and set() log at debug level on ENOENT and error level on all other errors, always. Also ensure that we don't sometimes write "failed to set 'x' to 'y': Success" when a partial write occurs.
* platform: do not check for _exists() before deleting addresses and routesThomas Haller2014-02-141-12/+12
| | | | | | | | | | | | | | | | | | Before, nm_platform_ip4_address_exists(), et al. look into the cache to see whether the address/route already exists and returned an error if it did. Change the semantic of the delete functions, to return success in case of "nothing to delete". Also always try to delete the object in the kernel. The reason is, that the cache might be out of date and the caller really wants to delete it. So, to be sure, we always delete. In most cases the object is actually in the cache (because that is how the caller came to know that such an object might exist). In those cases, the lookup was not useful either, because the object was actually cached. Signed-off-by: Thomas Haller <thaller@redhat.com>
* core: use nm_utils_get_monotonic_timestamp_s for timestamp of ↵Thomas Haller2014-01-301-12/+3
| | | | | | | | NMPlatformIP[46]Address https://bugzilla.gnome.org/show_bug.cgi?id=720833 Signed-off-by: Thomas Haller <thaller@redhat.com>
* platform: add parameter to nm_platform_sysctl_get() to suppress logging errorThomas Haller2014-01-301-3/+3
| | | | | | | In some cases, an error when reading the sysctl value can be expected. In this case, we want to suppress the error message Signed-off-by: Thomas Haller <thaller@redhat.com>
* platform/core: add back support for PtP/peer addresses (rh #1018317)Dan Winship2013-12-021-2/+8
| | | | | | | | | | | | | In the migration to NMPlatform, support for ptp/peer addresses was accidentally dropped. This broke OpenVPN configurations using 'p2p' topology, which send a different peer address than the local address for tunX, plus the server may also push routes that use the peer address as the next hop. NetworkManager was unable to add these routes, because the kernel had no idea how to talk to the peer, because the peer's address was not assigned to any interface or reachable over any routes. Partly based on a patch from Dan Williams.
* core: add ifa_flags to NMPlatformIP6Address structureThomas Haller2013-11-081-1/+2
| | | | | | | Add a field 'flags' to NMPlatformIP6Address that holds the IFA_F_* flags as reported over netlink. Signed-off-by: Thomas Haller <thaller@redhat.com>
* core: improve handling of NPAR/SR-IOV devices (rh #804527)Dan Winship2013-11-061-0/+11
| | | | | | Use the new kernel physical_port_id interface property to recognize when two devices are just virtual devices sharing the same physical port, and refuse to bond/team multiple slaves on the same port.
* core: minor code cleanup to use preprocessor constantsThomas Haller2013-08-121-1/+1
| | | | | | | Use preprocessor constants for signal names NM_PLATFORM_LINK_* instead of hard coded values. Signed-off-by: Thomas Haller <thaller@redhat.com>
* platform: simplify getting routes and ignoring the default routeDan Williams2013-08-031-6/+10
| | | | | | Most places except the tests don't want the default route when asking the platform for all routes, so make that simpler by just adding a parameter for including the default route or not.
* platform: add reason attribute to all signalsPavel Šimerda2013-08-021-15/+15
|
* platform: don't check for route existencePavel Šimerda2013-08-011-2/+32
| | | | | | This is the same we already did for nm-platform addresses in commit 68c3e1153c415111e9254c1086c82360c069bc92. It will help to avoid various issues and is also a step towards support for route lifetimes.
* platform: update all address lifetimesPavel Šimerda2013-07-301-2/+32
| | | | | | | | | | | | | 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
* platform: add support for address lifetimesPavel Šimerda2013-07-261-2/+18
|
* platform: remove cached addresses and routes for deleted devicesPavel Šimerda2013-06-211-0/+28
|
* platform: specify link-added signal as asynchronousDan Williams2013-06-201-2/+40
| | | | | | | | | | With the move of udev logic into the Linux platform class, the link-added signals are asynchronous, that is they are not emitted during the call to nm_platform_*_add(), but after that call has returned. The Fake implementation still emitted them synchronously, which broke the testcases. Convert the Fake implementation to emit link-added signals asynchronously and update the testcases to handle this.
* platform: add support for creating InfiniBand subdevicesDan Winship2013-06-131-0/+19
|
* platform: add NMPlatformLink.parent, sort link_get_all() outputDan Winship2013-06-051-3/+2
| | | | | | | | | | | | | 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.
* platform: merge remaining NMUdevManager functionality into NMLinuxPlatformDan Winship2013-06-051-0/+4
| | | | | | | | | 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.
* Revert "platform, devices: add support for vxlan devices"Dan Winship2013-06-041-7/+0
| | | | | | | | 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 7f0f04d1067ff05527007e03af591a2bfecadafb.
* platform, devices: add support for gre and gretap devicesDan Winship2013-06-041-0/+7
|
* platform, devices: add support for vxlan devicesDan Winship2013-06-041-0/+7
|
* platform, devices: add support for macvlan and macvtap devicesDan Winship2013-06-041-0/+7
|
* platform, devices: add support for tun and tap devicesDan Winship2013-06-041-0/+7
|
* platform: merge NM_LINK_TYPE_GENERIC into NM_LINK_TYPE_UNKNOWNPavel Šimerda2013-05-271-3/+0
|