summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* platform: adding onlink gateway route for manual addressesth/ipv6-ll-reapply-rh1552069-pt2Thomas Haller2018-03-304-18/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Kernel does not all allow to configure a route via a gateway, if the gateway is not directly reachable. For non-manually added routes (e.g. from DHCP), we ignore them as a server configuration errors. For manually added routes, we try to work around them. Note that if the user adds a manual route that references a gateway, maybe he should be required to also add a matching onlink route for the gateway (or an address that results in a device-route), otherwise the configuration could be considered invalid. That was however not done historically, and also, it seems a rather unhelpful behavior. NetworkManage should just make it work, not not assume anything is wrong with the configuration. Similarly, for IPv4, the user could configure the route as onlink, however, that still requires extra configuration of which the user might not be aware. This would apply for example, when a connection has method=auto, and would obtain the routes automatically. It seems sensible to allow the user to add a route via the gateway, if he ~knows~ that this particular network will provide such a configuration via DHCP. In the past however, we tried not to automatically add a device route, but instead see whether we will get a suitable route via DHCP. If we wouldn't get such a route, we would however fail the connection. However, this is really very hard to get right. We call ip_config_merge_and_apply() possibly before receiving automatic IP configuration (commit 7070d17cedd09d07f12ce977dd1e16cecf8d4b45, "device: reset @con_ip6_config on failure before RA"). In this case, we could not yet configure the route. Instead, we also cannot fail (yet), because we should wait whether we will receive a route that makes this configuration feasable. That is hard to get right. How long should we wait? If we get a DHCP lease and still cannot add the route, should we fail the IP configuration or wait longer for another lease? Worse, if we decide to fail the IP configuration, it might not fail the entire activation. Instead, we would only mark the current address family as failed. If we later get a DHCP lease, should we retry to add the route again? -- probably yes. If we still fail, we would need to keep the IP configuration in failed state, regardless that DHCP succeeded. Part of the problem is, that we are bad at tracking the failed state per IP method. So, if manual configuration fails but DHCP succeeds, we get the state wrong. That should be fixed separately, but it just shows how hard it is to have this route that we currently cannot add, and wanting to wait for something that might never come, but still fail at some point. Instead, if we cannot add a route due to a missing onlink gateway, just retry and add the /32 or /128 direct route ourself. Note that for IPv6 routes that have a "src" address which is still TENTATIVE, we also cannot currently add the route and retry later. However, that is fundamentally different, because: - the configuration here is correct, it's only that the address didn't yet pass IPv6 DAD and kernel is being unhelpful (rh#1457196). - we only have to wait a few seconds for DAD to complete or fail. So, it's easy to implement this sensibly.
* device: add IPv6 link local address via merge-and-applyThomas Haller2018-03-301-36/+90
| | | | | | | | | | The device must not directly add addresses or routes. Instead, it must track the addresses/routes it wants to add in the NMIP6Config. Otherwise, during reapply, the information is lost and the next sync will remove them. Fixes-test: @ipv6_preserve_cached_routes
* platform: add NM_IP_CONFIG_SOURCE_IP6LL source typeThomas Haller2018-03-302-0/+4
| | | | | | | | | | | We already have IP4LL and maybe should re-use that also for IPv6. However, when adding the prefix route for IPv6 link local addresses, we want to add it with protocol "kernel", unlike "user" for IPv4. There is no strong reason for this. I don't think the protocol matters much. But up to now kernel automatically adds this prefix route, so as we are going to change that and let NetworkManager add it, keep the protocol at "kernel".
* libnm: don't use GTK-Doc comment in nm-autoptr.hBeniamino Galvani2018-03-281-2/+2
| | | | | | | | | It generates the following warning: libnm/nm-autoptr.h:25: Error: NM: identifier not found on the first line: * Note that you might use this header with older versions of libnm Fixes: ff8e56336574a168d427a993d666d9e038aacbaf
* contrib/nm-live-vm: remove nm-live-vm scriptsThomas Haller2018-03-276-317/+0
| | | | | | | | | | | | | | They were not (notably) touched in more than 3 years. I doubt anybody is using them. Also, nowadays we have contrib/rpm to build NetworkManager packages for Fedora/RPM. We have copr, we have automated CI in CentOS CI and beaker. Also, nowadays it should be easy to spawn a a fedora image in a container or tools like vagrant. I think there are better alternatives. Drop the scripts.
* shared/nm-glib: add compat implementation for g_autofreeThomas Haller2018-03-271-0/+8
| | | | | | | | Eventually, we should replace our uses of libgsystem's gsystem-local-alloc.h by glib's g_auto*. As a first tiny step, add a compat implementation for g_autofree, so that we could at least go ahead and use it instead of gs_free. https://bugzilla.gnome.org/show_bug.cgi?id=794294
* libnm: add nm-autoptr.h headerThomas Haller2018-03-273-0/+88
| | | | | | | | | | | | | | | | | | | "nm-autoptr.h" is done in a way that allows you to copy the header in your source tree to support older versions of libnm, that didn't contain the header yet. For example, we might want to use it in network-manager-applet, but we don't want to bump the libnm dependency to 1.11.2+ only to get this functionality. Note that G_DEFINE_AUTOPTR_CLEANUP_FUNC() was added in glib 2.43.4, and requires compiler support for the cleanup attribute. The compiler support is taken as given, because we rely on it already. However, NetworkManager and network-manager-applet still don't depend on a glib version recent enough to provide these macros. To actually use them (*inside*) NetworkManager/network-manager-applet, we either would have to bump the glib minimal dependency, or reimplement g_autoptr in /shared/nm-utils/nm-glib.h compat header. https://bugzilla.gnome.org/show_bug.cgi?id=794294
* core: merge branch 'th/dbus-cache-properties'Thomas Haller2018-03-2732-764/+775
|\ | | | | | | https://github.com/NetworkManager/NetworkManager/pull/82
| * all: use nm_utils_hash_keys_to_array()Thomas Haller2018-03-276-58/+39
| |
| * config: cleanup fields in NMGlobalDnsConfigThomas Haller2018-03-273-84/+132
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - consistently set options, searches, domains fields to %NULL, if there are no values. - in nm_global_dns_config_update_checksum(), ensure that we uniquely hash values. E.g. a config with "searches[a], options=[b]" should hash differently from "searches=[ab], options=[]". - in nm_global_dns_config_to_dbus(), reuse the sorted domain list. We already have it, and it guarantees a consistent ordering of fields. - in global_dns_domain_from_dbus(), fix memleaks if D-Bus strdict contains duplicate entries.
| * config/trivial: rename dns_config local variableThomas Haller2018-03-272-75/+75
| | | | | | | | | | The variable serves a similar purpose, but is called "dns", "conf", and "dns_config". Choose one name: "dns_config".
| * shared: add nm_utils_hash_keys_to_array() helperThomas Haller2018-03-272-21/+36
| |
| * wifi: rework tracking of wifi-aps to use CListThomas Haller2018-03-278-289/+219
| | | | | | | | | | | | | | | | | | | | | | - no longer track APs in a hash table with their exported path as key. The exported path is already tracked by NMDBusManager's lookup index, so we can reuse that for fast lookup by path. Otherwise, track the APs in a CList per device. - as we now track APs in a CList, their order is well defined. We no longer need to sort APs and obsoletes nm_wifi_aps_get_sorted() and simplifies nm_wifi_aps_find_first_compatible().
| * core: rework lookup for exported objects by path to use indexThomas Haller2018-03-271-14/+20
| | | | | | | | | | | | We already track an index of exported objects in NMDBusManager. Actually, that index was unused previously. We either could drop it, or use it. Let's use it.
| * manager: convert hwaddr to binary once in find_device_by_permanent_hw_addr()Thomas Haller2018-03-271-2/+4
| | | | | | | | | | | | | | For comparing MAC addresses, they anyway have to be normalized to binary. Convert it once outside the loop and pass the binary form to nm_utils_hwaddr_matches(). Otherwise, we need to re-convert it every time.
| * core: track devices in manager via embedded CListThomas Haller2018-03-279-203/+205
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of using a GSList for tracking the devices, use a CList. I think a CList is in most cases the more suitable data structure then GSList: - you can find out in O(1) whether the object is linked. That is nice, for example to assert in NMDevice's destructor that the object was unlinked, and we will use that later in nm_manager_get_device_by_path(). - you can unlink the element in O(1) and you can unlink the element without having access to the link's head - Contrary to GSList, this does not require an extra slice allocation for the link node. It quite possibliy consumes slightly less memory because the CList structure is embedded in a struct that we already allocate. Even if slice allocation would be perfect to only consume 2*sizeof(gpointer) for the link note, it would at most be as-good as CList. Quite possibly, there is an overhead though. - CList possibly has better memory locality, because the link structure and the data are close to each other. Something which could be seen as disavantage, is that with CList one device can only be tracked in one NMManager instance at a time. But that is fine. There exists only one NMManager instance for now, and even if we would ever introduce multiple managers, we probably would not associate one NMDevice instance with multiple managers. The advantages are arguably not huge, but CList is IMHO clearly the more suited data structure. No need to stick to a suboptimal data structure for the job. Refactor it.
| * core/dbus: manually inline helper function to emit InterfacesAdded signalThomas Haller2018-03-261-26/+12
| |
| * core/dbus: cache variants for D-Bus exported propertiesThomas Haller2018-03-263-24/+65
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | GVariant is immutable and can nicely be shared and cached. Cache the property variants. This makes getting the properties faster, at the expense of using some extra memory. Tested with https://tratt.net/laurie/src/multitime/ $ multitime -n 200 -s 0 bash -c 'echo -n .; exec busctl call org.freedesktop.NetworkManager /org/freedesktop org.freedesktop.DBus.ObjectManager GetManagedObjects &>/dev/null' # Mean Std.Dev. Min Median Max # real(before) 0.013+/-0.0000 0.001 0.012 0.013 0.019 # real(after) 0.013+/-0.0000 0.002 0.011 0.012 0.034 $ multitime -n 100 -s 0 bash -c 'for i in {1..5}; do busctl call org.freedesktop.NetworkManager /org/freedesktop org.freedesktop.DBus.ObjectManager GetManagedObjects &>/dev/null & done; wait; echo -n .' # Mean Std.Dev. Min Median Max # real(before) 0.040+/-0.0000 0.002 0.037 0.040 0.049 # real(after) 0.037+/-0.0000 0.002 0.034 0.036 0.045 $ multitime -n 30 -s 0 bash -c 'for i in {1..100}; do busctl call org.freedesktop.NetworkManager /org/freedesktop org.freedesktop.DBus.ObjectManager GetManagedObjects &>/dev/null & done; wait; echo -n .' # Mean Std.Dev. Min Median Max # real(before) 0.704+/-0.0000 0.016 0.687 0.701 0.766 # real(after) 0.639+/-0.0000 0.013 0.622 0.637 0.687 $ multitime -n 200 -s 0 bash -c 'echo -n .; exec nmcli &>/dev/null' # Mean Std.Dev. Min Median Max # real(before) 0.092+/-0.0000 0.005 0.081 0.092 0.119 # real(after) 0.092+/-0.0000 0.005 0.080 0.091 0.123 $ multitime -n 100 -s 0 bash -c 'for i in {1..5}; do nmcli &>/dev/null & done; wait; echo -n .' # Mean Std.Dev. Min Median Max # real(before) 0.436+/-0.0000 0.043 0.375 0.424 0.600 # real(after) 0.413+/-0.0000 0.022 0.380 0.410 0.558 $ multitime -n 20 -s 0 bash -c 'for i in {1..100}; do nmcli &>/dev/null & done; wait; echo -n .' # Mean Std.Dev. Min Median Max # real(before) 8.796+/-0.1070 0.291 8.073 8.818 9.247 # real(after) 8.736+/-0.0893 0.243 8.017 8.780 9.101 The time savings are small, but that is because caching mostly speeds up the GetManagedObjects calls, and that is only a small part of the entire nmcli call from client side.
* libnm-core: trivial: fix indentationFrancesco Giudici2018-03-261-7/+7
|
* platform: reorder failure checks in nm_platform_ip_route_sync()Thomas Haller2018-03-261-5/+5
| | | | | | | | | Move handling non-NM_IP_CONFIG_SOURCE_USER routes first. These are routes that were added manually by the user in the connection. Note that there is no change in behavior, because of how _err_inval_due_to_ipv6_tentative_pref_src() would only accept user routes already.
* ndisc/trivial: indentation and add "const" to auto variableThomas Haller2018-03-261-24/+24
|
* libnm: don't use deprecated tags for GOobject introspectionThomas Haller2018-03-269-31/+14
|\ | | | | | | | | https://bugzilla.gnome.org/show_bug.cgi?id=744250 https://bugzilla.gnome.org/show_bug.cgi?id=794658
| * libnm-glib: do not use deprecated Gtk-Doc Type: and Virtual: tagsJiří Klimeš2018-03-264-17/+6
| | | | | | | | | | | | Signed-off-by: Jiří Klimeš <jklimes@redhat.com> https://bugzilla.gnome.org/show_bug.cgi?id=744250
| * libnm: don't use deprecated tags for GOobject introspectionJiří Klimeš2018-03-265-24/+8
| | | | | | | | | | | | | | | | | | | | Top level tags are deprecated in favour of identifier annotations. https://mail.gnome.org/archives/commits-list/2013-October/msg03220.html https://wiki.gnome.org/action/show/Projects/GObjectIntrospection/Annotations?action=show&redirect=GObjectIntrospection%2FAnnotations#Type_signature Signed-off-by: Jiří Klimeš <jklimes@redhat.com> https://bugzilla.gnome.org/show_bug.cgi?id=744250
* | gobject-introspection: made several fixes to the annotationsCorentin Noël2018-03-2624-100/+46
|/ | | | https://bugzilla.gnome.org/show_bug.cgi?id=794658
* platform: improve logging message for failure to add routeThomas Haller2018-03-221-4/+6
| | | | | The errno for this particular failure differs between IPv4 and IPv6. Of course it does.
* platform: assert for valid argument in nmp_object_unref()Thomas Haller2018-03-221-0/+2
|
* manager: retry activating devices when the parent becomes managedBeniamino Galvani2018-03-221-0/+4
| | | | | | | | | | | | | Since commit ed640f857a1a ("manager: ignore unmanaged devices when looking for parent by UUID"), unmanaged devices are ignored when looking for potential parent connection matches. Therefore, a software device can fail autoactivation because the parent is not managed yet and NM never tries to reactivate it. Ensure that we retry other devices when a parent device becomes managed. Fixes: ed640f857a1a1eae45d92cce35ea8dcfd8aba08d https://bugzilla.redhat.com/show_bug.cgi?id=1553595
* core: merge branch 'th/ipv6-ll-reapply-rh1552069' (#75)Thomas Haller2018-03-2132-1997/+817
|\ | | | | | | | | | | | | A larger branch of refactoring and cleanups. This was a spin-off of pr#75, as the branch grew too large. https://github.com/NetworkManager/NetworkManager/pull/75
| * device: merge IPv4 and IPv6 versions of _cleanup_ip_pre()th/ipv6-ll-reapply-rh1552069Thomas Haller2018-03-201-32/+26
| |
| * device: merge IPv4 and IPv6 versions of queued_ip_config_change()Thomas Haller2018-03-201-102/+92
| |
| * device: merge IPv4 and IPv6 versions of nm_device_set_ip_config() (pt2)Thomas Haller2018-03-201-174/+104
| |
| * device: merge IPv4 and IPv6 versions of nm_device_set_ip_config() (pt1)Thomas Haller2018-03-201-208/+208
| | | | | | | | | | Almost on change, just merge the functions in one, with a top-level if/else.
| * device/trivial: rename IPv4/IPv6 related fields in NMDevicePrivate structThomas Haller2018-03-201-168/+173
| | | | | | | | | | | | | | | | These fields have the same purpose for IPv4 and IPv6. Also, they have an alias with name _x, that can be indexed by an IS_IPv4 1/0 value. Rename the fields so that the distinguisher 4/6/x is at the end. The point is to make the name more similar.
| * device: merge IPv4 and IPv6 versions of ip_config_merge_and_apply() (pt3)Thomas Haller2018-03-201-95/+81
| |
| * device: merge IPv4 and IPv6 versions of ip_config_merge_and_apply() (pt2)Thomas Haller2018-03-201-170/+156
| |
| * core: add ip-config implementation for NMIP4Config vs. NMIP6ConfigThomas Haller2018-03-201-17/+53
| |
| * device: merge IPv4 and IPv6 versions of ip_config_merge_and_apply() (pt1)Thomas Haller2018-03-201-238/+235
| | | | | | | | | | | | | | | | | | | | | | Functions like these are conceptually very similar. Commonly, what we want to do for one address family we also want to do for the other. Merge the two functions. This moves the similar parts closer to each other and stand beside it. This is only the first part of the merge, which is pretty trivial without larger changes (to keep the diff simple). More next.
| * dhcp: remove unused nm_utils_resolve_conf_parse() functionThomas Haller2018-03-206-415/+1
| |
| * dhcp: remove unused nm_dhcp_dhclient_read_lease_ip_configs() functionThomas Haller2018-03-208-490/+0
| |
| * dns: remove unused nm_dns_manager_get_resolv_conf_explicit() functionThomas Haller2018-03-202-19/+0
| |
| * dhcp: remove unused nm_dhcp_manager_get_lease_ip_configs() functionThomas Haller2018-03-207-101/+0
| |
| * device: in nm_device_capture_initial_config() only update config onceThomas Haller2018-03-201-2/+17
| | | | | | | | | | | | | | | | | | Now that there is no difference between initial capturing of the configuration, and a later update_ip_config() call during a signal from platform, we only need to make sure that the IP config instances are initialized at least once. In case we are called multiple times, there is nothing to do.
| * device: don't capture resolve.conf for initial device configThomas Haller2018-03-206-62/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was called by via ... - manager:recheck_assume_connection() - manager:get_existing_connection() - nm_device_capture_initial_config() - update_ext_ip_config(initial=TRUE) and would parse resolv.conf, and try to fill the device IP config with nameservers and dns-options. But why? It would only have effect if NM was started with nm_dns_manager_get_resolv_conf_explicit(), but is that really sensible? And it would only take effect on devices that have a default route. And for what is this information even used? Let's not do it this way. If we need this information for assuming or external sys-iface mode, then it should be explicitly loaded at the appropriate moment. For now, drop it and see what breaks. Then we can fix it properly. If it even matters.
| * device: drop capture_lease_config() during connection assumptionThomas Haller2018-03-201-118/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Drop capture_lease_config(). It was added by commit 0321073b3cb9060817c7743e1c203c6b72659dfe. Note that it was only called by ... - manager:recheck_assume_connection() - manager:get_existing_connection() - nm_device_capture_initial_config() - update_ext_ip_config(addr_family=AF_INET, initial=TRUE) - capture_lease_config() It had only effect when the device had IPv4 permanent addresses. But then, capture_lease_config() would go on and iterate over all connections (sorted by last-connect timestamp). It would consider connection candidates that are compatible with the device, and try to read the lease information from disk It's really unclear what this means. For assuming (graceful take over), do we need the lease information in the device? I don't think so, because we will match an existing connection. The lease information shall be read while activating (if necessary). For external connections, we don't even have a matching connection and we always generate a new one. It doesn't seem right to consider leases from disk, for a different connection. Just drop this. It's really ugly. If this causes an issue, it must be fixed differently. We want to behave determinstically and well defined. I don't even comprehend all the implications of what this had. Also note that update_ext_ip_config() no longer clears priv->dev_ip4_config.
| * device: fix assertion in queued_ip6_config_change()Thomas Haller2018-03-201-1/+1
| | | | | | | | Fixes: 31ca7962f8f7d1993f0a363b9677c7cee89e7ee3
| * device: also export NMIPxConfig on error in nm_device_set_ipx_config()Thomas Haller2018-03-201-2/+2
| | | | | | | | | | | | | | A failure to configure an address family does not mean that the connection is going to fail. It depends, for example on ipvx.may-fail. Always export the NMIPxConfig instance in that case.
| * device: cleanup completing wait for linklocal6Thomas Haller2018-03-201-21/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | linklocal6_complete() had only one caller. The caller would check whether the conditions for linklocal6_complete() are satisfied, and then call it. Note that linklocal6_complete() would again assert that these conditions hold. Don't do this. Just move the check inside linklocal6_complete(), and rename to linklocal6_check_complete(). Also, linklocal6_complete() was called by update_ip_config(), which was called by nm_device_capture_initial_config() and queued_ip6_config_change(). It doesn't make sense to call linklocal6_complete() during nm_device_capture_initial_config(). Move the call to queued_ip6_config_change().
| * device: fix check for existing addresses to ignore DADFAILEDThomas Haller2018-03-201-10/+8
| | | | | | | | | | | | | | Likewise, in ndisc_ra_timeout() we also want to include tentative addresses. Looking into priv->ip6_config to determine whether an other IP configuration is active, is anyway odd, and likely a bug.
| * device: use nm_ip6_config_find_first_address() in check_and_add_ipv6ll_addr()Thomas Haller2018-03-201-11/+7
| |