summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* dhcp: drop "event_id" parameter from NM_DHCP_CLIENT_SIGNAL_STATE_CHANGED signalth/l3cfg-8Thomas Haller2020-09-116-23/+42
| | | | | | It is solely computed from the lease information (the GHashTable). No need to pass it along as separate argument in NM_DHCP_CLIENT_SIGNAL_STATE_CHANGED, especially since it only applies to IPv6.
* device: mark NMDevicePrivate.sys_iface_state as constThomas Haller2020-09-112-5/+8
| | | | | | It's important to find place in code where are field (state) gets mutated. Make sys_iface_state field const, but add a mutable alias via a union. You can now grep for places that change the field.
* device/trivial: unify (rename) functions in "nm-device.c"Thomas Haller2020-09-111-25/+24
|
* core: move nm_utils_generate_duid_from_machine_id() to "nm-core-utils.c"Thomas Haller2020-09-113-116/+138
|
* l3cfg: add nm_l3cfg_get_combined_l3cd() functionThomas Haller2020-09-112-0/+10
|
* l3cfg: gracefully accept %NULL argument in nm_l3_config_data_lookup_objs()Thomas Haller2020-09-111-0/+2
| | | | | | This way we can safely iterate over a %NULL instance with nm_l3_config_data_iter_obj_for_each(). This avoids a NULL check, which in this case seems more annoying than helpful.
* l3cfg: add nm_l3cfg_get_best_default_route() functionThomas Haller2020-09-112-0/+25
| | | | | | This is the best default route that we commited the last time (if any). It may not reflect what is currently configured (in NMPlatform) and it may not reflect the latest changes since nm_l3cfg_add_config().
* l3cfg: add nm_l3cfg_get_pllink() helperThomas Haller2020-09-111-0/+22
| | | | | | NML3Cfg already keeps track of the current NMPlatformLink object. Allow accessing it directly from an NML3Cfg instance, which saves a cache lookup from NMPlatform.
* l3cfg: support tracking the DHCP lease in NML3ConfigDataThomas Haller2020-09-113-3/+90
|
* core: add NMDhcpLease typedef and simple accessor functionsThomas Haller2020-09-111-0/+60
|
* device: remove unused dhcp4.root_path fieldThomas Haller2020-09-111-5/+0
|
* libnm,core: deprecate "active_slave" and alias it for "primary"Thomas Haller2020-09-101-63/+11
| | | | | | | | | | | | | | | Setting "active_slave" fails unless the slave is currently present and IFF_UP. That complicates the code, because we cannot set the property at any time, but only under the right circumstances. But really, "active_slave" option is something for debugging. It's not an option which should be set by NetworkManager. The right option instead is "primary", which will tell kernel to make the slave active, when it is ready. Deprecate the "active_slave" option and make it an alias for "primary". https://bugzilla.redhat.com/show_bug.cgi?id=1856640
* device: cleanup code in NMDeviceBond's update_connection()Thomas Haller2020-09-101-10/+13
|
* device: inline check_changed_options() in can_reapply_change()Thomas Haller2020-09-101-30/+26
| | | | | | | | | Code doesn't get simpler by having more functions -- if these functions are only called once. What actually is a problem is repeated, redundant code. Like the list of bond options that can be reapplied. But the function didn't help to avoid repeating the list.
* device: unify setting of bond optionsThomas Haller2020-09-101-27/+32
| | | | | | | | | | | | | | | | Add a macro for the list of bond options we are going to set. By seeing them side-by-side, it is hopefully simpler to see that all options are specified correctly. We see that: - the *_SUBSET defines don't include the options that we are explicitly setting, that is "mode", "active_slave" and "arp_ip_target". - OPTIONS_REAPPLY_SUBSET contains 4 options less than OPTIONS_APPLY_SUBSET: "ad_select", "ad_user_port_key", "lacp_rate" and "tlb_dynamic_lb". These are the options that are marked as BOND_OPTFLAG_IFDOWN in kernel.
* device: remove duplicate option "primary" from list to reapplyThomas Haller2020-09-101-1/+0
|
* device: allow "active_slave" and "arp_ip_target" bond option for reapplyThomas Haller2020-09-101-41/+28
| | | | | | | | | | | | | | | | I guess the idea was to only accept options that can be changed without taking the interface !IFF_UP. "active_slave" is wrongly omitted from that list. Also, "active_slave" option doesn't really make sense for NetworkManager to configure. Instead "primary" should be used. In the future, we should re-map the properties and deprecate "active_slave" for "primary" ([1]). Fixes: 746dc119a6bc ('bond: let 'reapply()' reapply all supported options') [1] https://bugzilla.redhat.com/show_bug.cgi?id=1856640#c19 https://bugzilla.redhat.com/show_bug.cgi?id=1876577
* device: fix wrongly considering ipv6.may-fail for ipv4Beniamino Galvani2020-09-091-1/+1
| | | | Fixes: 5e71f016057a ('device: merge stage3 and stage4 ip-config function for IPv4 and IPv6')
* device: enforce the absence of a master during activationbg/rh1869079Beniamino Galvani2020-09-071-9/+26
| | | | | | | | If the connection doesn't specify a master, ensure that the device is released from any master in platform. https://bugzilla.redhat.com/show_bug.cgi?id=1869079 https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/616
* core: accept void pointer in nm_dbus_object_export() and relatedThomas Haller2020-09-072-28/+37
| | | | | | | | | | NMDBusObject is an abstract type which provides the glue code for exposing a GObject on D-Bus. We almost never use that type directly, so as it was before, we always had to use a C cast to convince the compiler that this is right. Being always required to cast is not very useful, nor more typesafe. Just use a void pointer instead.
* l3cfg: add nm_l3cfg_commit_type*() API for tracking the level for committing ↵Thomas Haller2020-09-072-4/+143
| | | | | | | | | | | | | | | changes NML3Cfg manages one ifindex. In the future, we may want that multiple NMDevice and/or NMVpnConnection instances independently contribute their NML3ConfigData to the NML3Cfg instance. That means, at any time somebody may want to call nm_l3cfg_platform_commit() to apply the changes. Even ACD internally may do that, when configuration changes (e.g. an IP address passes ACD check). We thus need to know whether we are assuming, updating or reapplying the settings. Add API so users can register their "commit" preference.
* l3cfg: add nm_l3_config_data_has_routes_with_type_local() helperThomas Haller2020-09-072-0/+60
|
* l3cfg: more integration of NMDevice with l3cfgThomas Haller2020-09-073-25/+338
| | | | | Add more code that will be used later for glueing NMDevice with NML3Cfg and NML3ConfigData. The code is not yet really used.
* l3cfg: remove changed flag from nm_l3cfg_add_config()/nm_l3cfg_remove_config()Thomas Haller2020-09-072-26/+33
|
* l3cfg: drop unused NM_L3_CONFIG_MERGE_FLAGS_EXTERNALThomas Haller2020-09-072-21/+0
| | | | | | The current approach also tracks external configuration in an NMIP[46]Config, and we need to special handle those. In the future, we only want to track what we actually want to configure. So this flag won't be used with NML3Cfg/NML3ConfigData.
* l3cfg: add more l3cfg API that will be used nextThomas Haller2020-09-074-4/+89
|
* l3cfg: add nm_l3_config_data_get_blacklisted_ip4_routes() utilThomas Haller2020-09-073-29/+94
| | | | We will need to prune routes that kernel adds (and we don't want).
* l3cfg: add nm_l3_config_data_get_domains() accessorThomas Haller2020-09-072-0/+16
|
* platform: add nm_platform_ip_address_get_peer_address() helperThomas Haller2020-09-071-0/+12
|
* l3cfg: implement IPv4 DAD/ACD (address collision detection) in NML3Cfgth/l3cfg-6-acdThomas Haller2020-09-033-108/+1884
| | | | | | | | | | | | | | | | | | | Currently, NMDevice does ACD. It intercepts certain NMIP4Config instances, and tries to perform ACD on the addresses. I think this functionality should be handled by NML3Cfg instead. For one, NML3Cfg sees all configurations, and can perform ACD for all (relevant) addresses. Also, it moves logic away from NMDevice and makes the functionality available without an NMDevice. As such, it also will allow that independent "controllers" contribute NML3ConfigData instances and ACD will performed for all of them (as requested). This will be our implementation for IPv4 ACD (https://tools.ietf.org/html/rfc5227) based on nettools' n-acd library. The code is not actually tested yes, because NMDevice did not yet switch over to use NML3Cfg. Once that happens, surely issues with this patch will be found that will need fixing.
* platform: add nm_platform_ip4_address_addr_to_hash() helperThomas Haller2020-09-032-0/+39
| | | | | This will only have one particular use, from NNL3Cfg. However, it seems general enough to place it in "nm-platform.h".
* initrd/tests: fix memleak in test_dhcp_vendor_class_id()Thomas Haller2020-09-031-1/+3
| | | | | | | Having leaks in the tests, breaks running the test under valgrind. There must be no leaks. Fixes: c056cb9306be ('initrd: parse 'rd.net.dhcp.vendor-class' kernel cmdline arg')
* all: replace cleanup macro "gs_free_slist" by "nm_auto_free_slist"Thomas Haller2020-09-022-6/+6
|
* all: replace cleanup macro "gs_unref_keyfile" by "nm_auto_unref_keyfile"Thomas Haller2020-09-027-19/+19
|
* core: log message about secret-key version and filenameThomas Haller2020-09-021-5/+14
|
* shared: rename "gs_local_option_context" to "nm_auto_free_option_context"Thomas Haller2020-09-021-1/+1
| | | | | | | | | The "gs_*" macros originate from the (no longer existing) libgsystem library. We still have them, because so far we didn't go through the effort of renaming the API. Aside that oddity, our cleanup API is called "nm_auto*". There is no need to add new API with the old name.
* initrd: fix memory leakAntonio Cardace2020-09-011-1/+1
| | | | | Signed-off-by: Antonio Cardace <acardace@redhat.com> Fixes: 9f9609555d1c ('initrd: add configuration generator')
* initrd: parse 'rd.net.dhcp.vendor-class' kernel cmdline argac/dhcpclass-initrdAntonio Cardace2020-09-012-0/+53
| | | | | | | | | This arguments makes NM set the ipv4.dhcp-vendor-class-identifier property for all connections. https://bugzilla.redhat.com/show_bug.cgi?id=1872299 Signed-off-by: Antonio Cardace <acardace@redhat.com>
* core: add 'dhcp-vendor-class-identifier' validation functionAntonio Cardace2020-09-011-7/+4
| | | | | | So that it can be reused. Signed-off-by: Antonio Cardace <acardace@redhat.com>
* device: fix autoactivating virtual devices after a failureBeniamino Galvani2020-08-311-0/+5
| | | | | | | | | | | | | | | | | | | When a virtual device fails, its state goes to FAIL and then DISCONNECTED. In DISCONNECTED we call schedule_activate_check() to schedule an auto-activation if needed. We also schudule the deletion of the link through delete_on_deactivate_check_and_schedule(). The auto-activation attempt fails because the link deletion unmanages the device; as a result, the device doesn't try to auto-activate again. To fix this: - don't allow the device to auto-activate if the device deletion is pending; - check again if the device can be auto-activated after its deletion. https://bugzilla.redhat.com/show_bug.cgi?id=1818697 https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/613
* dhcp: workaround "maybe-uninitialized" in dhcp_event_cb()Thomas Haller2020-08-281-1/+1
| | | | | | | | | | | | | | With LTO we get a compiler warning: src/dhcp/nm-dhcp-systemd.c: In function dhcp_event_cb: src/dhcp/nm-dhcp-systemd.c:554: error: lease may be used uninitialized in this function [-Werror=maybe-uninitialized] 554 | r = sd_dhcp_lease_get_server_identifier (lease, &addr); | src/dhcp/nm-dhcp-systemd.c:528: note: lease was declared here 528 | sd_dhcp_lease *lease; | Fixes: 7f217d0345f5 ('core: honor the ipv4.dhcp-reject-servers property')
* device: fix casting pointer to enum for sriov_reset_on_deactivate_cb()Thomas Haller2020-08-281-2/+2
| | | | | | | | | | Avoids a compiler warning: ../src/devices/nm-device.c:16079:26: error: cast to smaller integer type 'NMDeviceStateReason' from 'gpointer' (aka 'void *') [-Werror,-Wvoid-pointer-to-enum-cast] deactivate_ready (self, (NMDeviceStateReason) reason); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ Fixes: 121c58f0c48d ('core: set number of SR-IOV VFs asynchronously')
* core/trivial: replace "XXX" markers with "TODO"Thomas Haller2020-08-274-7/+7
| | | | | | | | | "XXX" is used for tagging parts of code that still need work before merging a patch. If you want to highlight/mark a comment which is merged use either "TODO" or "FIXME". Of course, even "TODO" and "FIXME" should be avoided in favor of just doing/fixing it. Such things tend to never be done/fixed.
* dhcp: nettools: change event handler signatureBeniamino Galvani2020-08-261-6/+4
|
* core: honor the ipv4.dhcp-reject-servers propertyBeniamino Galvani2020-08-2612-2/+122
|
* all: add ipv4.dhcp-reject-servers propertyBeniamino Galvani2020-08-264-8/+30
| | | | | | Add a new dhcp-reject-servers property to the ipv4 setting, that allows specifying a list of server-ids from which offers should be rejected.
* dhcp: implement dhcp-vendor-class-identifier option for systemd's DHCPAntonio Cardace2020-08-261-0/+19
| | | | | | | client https://bugzilla.redhat.com/show_bug.cgi?id=1871042 Signed-off-by: Antonio Cardace <acardace@redhat.com>
* dhcp: implement dhcp-vendor-class-identifier option for internal DHCP clientAntonio Cardace2020-08-261-0/+20
| | | | | https://bugzilla.redhat.com/show_bug.cgi?id=1871042 Signed-off-by: Antonio Cardace <acardace@redhat.com>
* core: add support for dhcpv4 vendor class identifier optionAntonio Cardace2020-08-267-16/+96
| | | | | https://bugzilla.redhat.com/show_bug.cgi?id=1871042 Signed-off-by: Antonio Cardace <acardace@redhat.com>
* ifcfg-rh: add support for the DHCP_VENDOR_CLASS_IDENTIFIER optionAntonio Cardace2020-08-264-1/+12
| | | | | https://bugzilla.redhat.com/show_bug.cgi?id=1871042 Signed-off-by: Antonio Cardace <acardace@redhat.com>