summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* dhcp6: don't require a hardware addressbg/pppoe-pdBeniamino Galvani2020-07-294-49/+24
| | | | | | | | | | | | | | | | | | | The systemd DHCPv6 client requires a hardware address only to determine the IAID; NM always overrides the IAID with its own and therefore the hwaddr is not used. Removing such requirement allows DHCPv6 to run over PPP, which is useful with DHCPv6-PD to get a prefix from the ISP. To test this, I set up a server with pppoe-server, radvd and the Wide DHCPv6 server providing an address and a prefix. On the client, NM was able to obtain a prefix using both dhcp=dhclient and dhcp=systemd. Note that if there is no hardware address and you specify ipv6.dhcp-duid=ll or ipv6.dhcp-iaid=mac, a warning will be emitted and NM will use a random DUID/IAID. https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/478
* device: fix emitting unnecessary PROP_IFINDEX notification in NMDeviceThomas Haller2020-07-291-1/+3
| | | | Fixes: ea1f0fc0a635 ('device: let NMDevice track a NML3Cfg instance for each ifindex')
* cloud-setup: add tool for automatic IP configuration in cloudSayed Shah2020-07-296-0/+600
| | | | | | | | | | | | | | | | | | | | | | | | | This is a tool for automatically configuring networking in azure cloud environment. This add a provider implementation for Azure that when detected fetches the private ip addressess and the subnet prefix of configured internal load balancers. Once this information is fetched from the metadata server, it instructs NetworkManager to add private ip addressess and subnet prefix for each interface detected. It is inspired by SuSE's cloud-netconfig ([1], [2]) and Azure Instance Metadata service [3]. [1] https://www.suse.com/c/multi-nic-cloud-netconfig-ec2-azure/ [2] https://github.com/SUSE-Enceladus/cloud-netconfig [3] https://docs.microsoft.com/en-us/azure/virtual-machines/linux/instance-metadata-service It is also intended to work without configuration. The main point is that you boot an image with NetworkManager and nm-cloud-setup enabled, and it just works. https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/572
* l3cfg: merge branch 'th/l3cfg-2'Thomas Haller2020-07-2817-386/+1613
|\ | | | | | | https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/588
| * l3cfg: add flags for NML3ConfigDataThomas Haller2020-07-282-0/+57
| | | | | | | | | | Add a flags parameter. That is useful to bundle multiple simple boolean properties, without need to implement individual accessors.
| * l3cfg: make NML3ConfigData ref/unref functions constThomas Haller2020-07-242-36/+50
| | | | | | | | | | | | | | | | | | NML3ConfigData is supposed to be used as immutable, ref-counted type. You create it once, initialize it, seal it, and pass (immutable) references around. In such a scheme, having ref/unref functions not operate on const pointers is a major inconvenience.
| * l3cfg: add more API to NML3ConfigDataThomas Haller2020-07-243-119/+372
| |
| * l3cfg: tie NML3ConfigData to an ifindexThomas Haller2020-07-242-32/+45
| | | | | | | | | | | | | | | | | | | | | | NML3ConfigData tracks IP addresses and routes. In their current form, these types (NMPObject) always have an ifindex and there is no sensible way to have an NMPObject (for routes or addresses) that have a wildcard ifindex. Honor that by also tying NML3ConfigData to an ifindex. In most cases, the user knows the ifindex before and can create it. On the unlikely case where the user doesn't know the ifindex, we should add a new nm_l3_config_data_clone() function, which allows migrating the setting from one ifindex to another.
| * l3cfg: add nm_l3_config_data_new_from_platform() for capturing settingsThomas Haller2020-07-242-3/+113
| | | | | | | | | | It basically does what nm_ip4_config_capture() and nm_ip6_config_capture() does.
| * core: add nm_platform_dedup_multi_iter_next_*() helpers to "nmp-object.h"Thomas Haller2020-07-245-56/+58
| | | | | | | | | | | | This code is not specific to "nm-ip4-config.h"/"nm-ip6-config.h". It applies to everybody who wants to iterate over a dedup-multi-index of certain NMPObjects. Move it.
| * core: use nm_platform_ip[46]_address_pretty_sort_cmp() in "nm-ip[46]-config.c"Thomas Haller2020-07-245-165/+8
| |
| * platform: use NM_CMP_*() macros in nm_platform_ip[46]_address_pretty_sort_cmp()Thomas Haller2020-07-242-46/+29
| | | | | | | | | | | | | | | | | | They ensure to consistently return -1, 0, 1. Also, I think they are easier to understand. What is in general hard to understand, whether a comparison sorts ascending or descending. The macros maybe make that easier too, but it's still confusing. That's why we have a test.
| * platform: add nm_platform_ip[46]_address_pretty_sort_cmp()Thomas Haller2020-07-247-0/+824
| | | | | | | | | | This is the code from _addresses_sort_cmp() in "nm-ip[46]-config.h" and will replace it soon.
| * core: read "disable_ipv6" sysctl before nm_ip6_config_create_setting()Thomas Haller2020-07-243-26/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | First of all, the entire nm_device_generate_connection() and nm_ip._config_create_setting() approach is fundamentally flawed. You cannot generate sensible configuration by reading IP addresses from an interface. Anyway, that's what we still sometimes do, and we possibly should do it less and less. It's ugly that nm_ip6_config_capture() would read the "disable_ipv6" sysctl value and cache it in NMIP6Config. Only so that it can be use much later during nm_ip6_config_create_setting(). Instead, read the sysctl value shortly before it's needed.
| * core: move nm_utils_ip4_address_is_link_local() to header fileThomas Haller2020-07-242-12/+12
| | | | | | | | It's so simple, let's move it so it can be inlined.
| * shared/tests: add nmtst_stable_rand()Thomas Haller2020-07-241-0/+44
| | | | | | | | | | Generate a list of pseudo random numbers, the important part here is that the result is stable and independent of endianness.
| * shared: add nm_strv_ptrarray_clone() helperThomas Haller2020-07-241-0/+10
| |
| * shared: add nm_copy_func_g_strdup() helperThomas Haller2020-07-241-0/+8
| |
| * shared: add compat function nm_g_ptr_array_copy() for older glibThomas Haller2020-07-242-0/+58
| | | | | | | | | | | | | | | | | | This is not in "nm-glib.h", because it's not a complete replacement. In glib before 2.62, it's not possible to implement g_ptr_array_copy() as glib provides it, because the element_free_func is not accessible. So, instead add our own implemented, which follows glib's version as much as it can.
| * shared: add nm_assert_unreachable_val() macroThomas Haller2020-07-241-0/+6
|/
* device: downgrade warning about IPv6 MTU if IPv6 is disabledBeniamino Galvani2020-07-241-6/+17
| | | | | | | | | | | | | | If IPv6 is disabled, changing the IPv6 MTU fails and NM complains with a warning. Since this error is expected and doesn't do any harm, downgrade the logging level to DEBUG. Since IPv6 kernel support can be built as a module, we have to check the existence of /proc/sys/net/ipv6 every time. Instead of checking it and then setting the MTU (adding one /proc access for everyone), just try to set the MTU; in case of failure, determine the reason for the error. https://bugzilla.redhat.com/show_bug.cgi?id=1840989 https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/585
* libnm-core: avoid compiler warning in nm_connection_to_dbus_full()tk9063282020-07-241-1/+1
| | | | | | | | Deal with compiling warning about variable not initialized before use. [thaller@redhat.com: reworded original commit message] https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/587
* core: merge branch 'th/l3cfg-1'Thomas Haller2020-07-2322-268/+2002
|\ | | | | | | https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/583
| * l3cfg: add NML3ConfigDatath/l3cfg-1Thomas Haller2020-07-234-0/+934
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently NMIP4Config and NMIP6Config both track the data to be configured, they expose properties on D-Bus, and they have logic for capturing and applying settings to platform. We will split that. - NMIP4Config and NMIP6Config will expose data on D-Bus. - NML3Cfg will have the logic for handling IP configuration. - NML3ConfigData will track data to be configured. NML3ConfigData mirrors NMIP4Config/NMIP6Config in many aspects. For now, this duplicates a lot of code. More will be done later. Eventually, NMIP4Config/NMIP6Config will drop the duplicated functionality.
| * l3cfg: add nm_l3cfg_property_emit_register() APIThomas Haller2020-07-233-1/+167
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The NML3Cfg instance tracks and prepares the IP configuration. However, that is also partly exposed on other objects, like NMIP4Config's "route-data" property. Add an API, so that NMIP4Config can register itself to be notified when something relevant changes. This is an alternative to standard GObject properties and signals. They often seem more effort than worth. That is, because in this case, NMIP4Config.route-data has no other task then to re-emit the signal. So, to implement that with GObject properties/signals, we would have to add a property/signal to NML3Cfg, subscribe to it from NMIP4Config, and remit the signal. An alternative is to bind properties, but that would still be quite some extra code, and unclear that it would be simpler. Not to mention the overhead, as bindings are themself full GObject instances, that register to and emit signals by name.
| * l3cfg: add NML3CfgPrivate dataThomas Haller2020-07-232-0/+14
| | | | | | | | | | We have several fields in the header file, so that the frequently used accessors can be inlined. However, we also want some private data. Add a structure for that.
| * l3cfg: track ifname in NML3CfgThomas Haller2020-07-232-0/+50
| |
| * l3cfg: notify NML3Cfg about NMPlatform changes in an idle handlerThomas Haller2020-07-234-2/+92
| | | | | | | | | | | | | | | | | | | | We need to react to platform changes. Also, we usually want to delay the reaction to an idle handler. Instead of subscribing each NML3Cfg instance itself to platform changes, let only NMNetns do that. The goal is of course that each platform event only needs to notify the NML3Cfg instance, which collects the events and schedules them on the idle handler.
| * device: let NMDevice track a NML3Cfg instance for each ifindexThomas Haller2020-07-231-21/+63
| |
| * core: add "nm-l3cfg.[hc]"Thomas Haller2020-07-237-0/+293
| |
| * device: simplify device_ip_link_changed() for setting ip_ifaceThomas Haller2020-07-231-33/+22
| | | | | | | | | | | | | | | | _ip_iface_update() only had one caller. The code is simpler to understand by inlining it. Also, it is relevant where and how we set ip_iface_ and ip_ifindex_ fields. Keep the places few and easily understandable.
| * core: use nm_utils_parse_inaddr_prefix_bin() in ↵Thomas Haller2020-07-231-13/+10
| | | | | | | | | | | | | | nm_utils_ip_route_attribute_to_platform() We already have an implementation for parsing an address/plen string. Use it.
| * core: move _nm_ip_config_merge_route_attributes() to "NetworkManagerUtils.c"Thomas Haller2020-07-235-118/+120
| | | | | | | | | | | | and rename to nm_utils_ip_route_attribute_to_platform(). The function is independent from NMIP4Config. We also will use it outside of NMIP4Config. Also, "NetworkManagerUtils.c" already has similar functions that parse libnm structures to internal structures.
| * core: use nmp_object_ip_route_is_best_defaut_route() in NMIP4ConfigThomas Haller2020-07-232-20/+2
| |
| * core: use nmp_object_ref_set() instead of _nm_ip_config_best_default_route_set()Thomas Haller2020-07-233-26/+14
| | | | | | | | | | | | | | | | _nm_ip_config_best_default_route_set() doesn't really do anything special. Use the generic helper function for the same job. Also because NMIP4Config in the current form will be replaced by something else, and this code needs to change.
| * platform: add nmp_object_ip_route_is_best_defaut_route() helperThomas Haller2020-07-231-0/+18
| |
| * platform: add nmp_object_ref_set() helperThomas Haller2020-07-231-0/+19
| |
| * platform: add NMP_OBJECT_GET_ADDR_FAMILY() helperThomas Haller2020-07-231-0/+15
| |
| * platform: add nmp_object_link_get_ifname() helperThomas Haller2020-07-231-0/+10
| |
| * shared: add nm_g_array_append_new() helperThomas Haller2020-07-231-0/+12
| |
| * shared: add nm_strv_ptrarray_ensure() and nm_strv_ptrarray_find_first() helpersThomas Haller2020-07-231-0/+27
| |
| * shared: add NM_IS_IPv4() macroThomas Haller2020-07-231-0/+9
| | | | | | | | | | | | | | This is of course trivial. However, we use this macro at several places as and index into an array of length 2, to lookup either the IPv4 or IPv6 element. As such, this MUST return 0 or 1. This promise is what the macro should convey.
| * shared: move addr-family helpers to "nm-std-aux.h"Thomas Haller2020-07-233-36/+55
| | | | | | | | | | Handling address families is something we do all over the place. Move some simple helper code to "nm-std-aux.h".
| * shared: add nm_g_object_ref_set_take() helper macroThomas Haller2020-07-231-0/+20
| |
| * shared: add nm_hash_obfuscated_ptr_str() helperThomas Haller2020-07-231-0/+13
| |
| * shared: avoid heap allocation for temporary string in ↵Thomas Haller2020-07-231-3/+6
| | | | | | | | nm_utils_parse_inaddr_prefix_bin()
| * device: emit rx-bytes/tx-bytes change notification togetherThomas Haller2020-07-231-2/+8
| | | | | | | | This also groups the PropertiesChanged signal on D-Bus.
| * shared: don't freeze in nm_gobject_notify_together() unless necessaryThomas Haller2020-07-231-9/+25
|/ | | | | | | | | | | | | | | nm_gobject_notify_together() is supposed to emit one or more property changed notifications, but with freezing (and thawing) the notifications. Also, we want to allow the user to pass PROP_0, for skipping emitions. The point is code like nm_gobject_notify_together (obj, PROP_FOO, bar_changed ? PROP_BAR : PROP_0); Optimize the code to only freeze/thaw the notifications, if we are actually notifying more than one properties.
* libnm-core: support 'clsact' qdiscBeniamino Galvani2020-07-232-2/+10
| | | | | | | | | | | | | | | | | | | | | | | | The 'clsact' qdisc is similar to 'ingress' but supports both ingress and egress [1]. It uses the same handle as 'ingress' and has two child classes :fff2 (ingress) and :fff3 (egress) on which filters can be attached. With clsact, for example, it becomes possible to do port mirroring with a single qdisc: nmcli connection modify mirror +tc.qdisc "clsact" nmcli connection modify mirror +tc.tfilter "parent ffff:fff3 matchall action mirred egress mirror dev dummy1" nmcli connection modify mirror +tc.tfilter "parent ffff:fff2 matchall action mirred egress mirror dev dummy1" instead of two (ingress + i.e. prio). We don't support yet the symbolic names 'ingress' and 'egress' for :fff2 and :fff3 in the filter. See-also: https://bugzilla.redhat.com/show_bug.cgi?id=1436535 [1] https://lwn.net/Articles/671458/
* core: fix selecting of best-default-route to consider only unicast routesThomas Haller2020-07-211-1/+2
| | | | Fixes: 5d0d13f57010 ('platform: add support for local routes')