summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* | platform: print genl family ID in hex formatThomas Haller2022-07-201-2/+2
| | | | | | | | | | | | | | | | | | That seems common. It's also done by genl-ctrl-list and iproute2's genl tool. Also, use avoid the leading zeros (0x1c instead of 0x001c). iproute2's genl tool does the former, libnl3's genl-ctrl-list does the latter.
* | platform: try harder to get the genl family ID by getting it synchronouslyThomas Haller2022-07-201-15/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We now cache the family ID for generic netlink protocols. However, when we for example create a wireguard interface, the kernel module might just get autoloaded. At this point, we didn't know the family ID yet. We already made an effort, that if the family ID is unknown during nm_platform_genl_get_family_id(), we would try to poll the genl socket in the hope there is a relevant event there. However, polling the socket also means to potentially emit all signals for any change that happen. We don't want that, if we currently are already polling the socket. Instead, fallback to synchronously get the family ID. $ sudo rmmod wireguard \ ./tools/run-nm-test.sh -m src/core/platform/tests/test-link-linux -p /link/software/detect/wireguard/1/external Fixes: 3d4906a3da89 ('platform: add genl socket support for events and genl family')
* | platform: merge branch 'th/platform-genl-4'Thomas Haller2022-07-2012-66/+490
|\ \ | | | | | | | | | https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1304
| * | platform: add NMPlatformMptcpAddr objectThomas Haller2022-07-206-4/+195
| | | | | | | | | | | | | | | | | | | | | An NMPObject is hashable, can be compared and printed. That is useful. Make an NMPObject for MPTCP addresses. It will hold the content of MPTCP_PM_ATTR_ADDR netlink attribute. But like other NMPObject types it will also be used to represent the data as NetworkManager tracks it.
| * | platform: avoid logging plain pointer values in "nmp-object.c"Thomas Haller2022-07-201-31/+33
| | |
| * | platform: drop unnecessary cmd_plobj_id_copy implementationsThomas Haller2022-07-201-18/+0
| | | | | | | | | | | | | | | The default implementation just uses memcpy() of the public part. That is just what we want. No need to implement those functions.
| * | platform: improve nmp_object_stackinit_id() for types that don't implement ↵Thomas Haller2022-07-201-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | cmd_plobj_id_copy() An object type that doesn't implement cmd_plobj_id_copy(), either: - implements cmd_obj_copy(), but then we cannot copy the ID only to a stack instance, because that cannot track ownership. This is a bug in the caller. We cannot use stackinit for an object of a type that is not a plain old data (in C++ terms). - fallback to plain memcpy(). That is in line with nmp_object_clone(). and nmp_object_copy().
| * | platform: drop detecting address scope in _nl_msg_new_address()Thomas Haller2022-07-201-10/+2
| | | | | | | | | | | | | | | All callers explicitly set a scope, like they should. Drop guessing the scope. Also, use the proper integer type.
| * | platform/netlink: add NLA_S32 enum value for attribute typeThomas Haller2022-07-202-0/+2
| | |
| * | linux-headers: include "mptcp.h" kernel headerThomas Haller2022-07-202-1/+234
| | | | | | | | | | | | Taken from v5.18, 4b0986a3613c ('Linux 5.18') from 20220522.
| * | glib-aux: use max_align_t in NM_HASH_COMBINE_VALS() macroThomas Haller2022-07-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The _nm_alignas() exists to choose a suitable alignment. Since it's on the stack, it has (almost) no overhead to just use the maximum alignment. That's why gint64 was chosen before. But that isn't the largest alignment. We rely on C11 already, and we also always include <stddef.h>. So use max_align_t instead.
| * | std-aux: use nm_memcmp() in NM_CMP_DIRECT_MEMCMP()Thomas Haller2022-07-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | NM_CMP_DIRECT_MEMCMP() gets called by NM_CMP_FIELD_MEMCMP_LEN(). For example, if you want to compare a NMIPAddr, it seems sensible to call NM_CMP_FIELD_MEMCMP_LEN(obj1, obj2, addr, nm_utils_addr_family_to_size(obj1->addr_family)); Granted, nm_utils_addr_family_to_size() asserts that addr_family is either AF_INET or AF_INET6. However, if the assertion fails, we don't want yet another undefined behavior here and do the sensible thing about n zero. In general, for a low-level function that uses memcmp(), it's non obvious to ensure that the caller does not accidentally invoke undefined behavior. nm_memcmp() avoids that.
| * | std-aux: add nm_memcmp() helperThomas Haller2022-07-201-0/+11
|/ /
* | ovs: fail device only when it's activatingBeniamino Galvani2022-07-191-1/+5
| | | | | | | | | | | | | | | | | | | | | | It doesn't make sense to fail a device that is not activating. Especially, if the device was in state UNMANAGED, it would enter state FAILED (and then DISCONNECTED) or ACTIVATED (when external or assumed); both are wrong. https://bugzilla.redhat.com/show_bug.cgi?id=2077950 https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1302
* | platform: merge branch 'th/platform-genl-3'Thomas Haller2022-07-1914-617/+1108
|\ \ | | | | | | | | | https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1294
| * | platform/netlink: adjust integer types in netlink APIThomas Haller2022-07-195-57/+76
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - use proper integer types. A netlink message cannot be as large as size_t, because the length is tracked in an uint32_t. Use the right types. - fields like "nlmsg_type" or "nlmsg_flags" are uint16_t. Use the right types. - note that nlmsg_size() still returns and accepts "int". Maybe the should be adjusted too, but we use macros from kernel headers, which also use int. Even if that is not the type of the length on the binary protocol. So some of these functions still use int, to be closer and compatible with <linux/netlink.h>.
| * | platform: use new platform API to get genl family id for nl802154/wpanThomas Haller2022-07-193-20/+19
| | |
| * | platform: use new platform API to get genl family id for nl80211/Wi-FiThomas Haller2022-07-195-20/+20
| | |
| * | platform: use new platform API to get genl family id for wireguardThomas Haller2022-07-193-56/+19
| | |
| * | platform: add genl socket support for events and genl familyThomas Haller2022-07-193-332/+671
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For generic netlink, the family-id is important. It changes when loading/unloading a module, so we should not cache it indefinitely. To get this right, takes some effort. For "nl80211", "nl802154" and "wireguard", we only cache the family ID in relation to an interface. If the module gets unloaded, the family ID also becomes irrelevant and we need to re-fetch it the next time. For generic families like "mptcp_pm" or "ethtool", they are commonly not kernel modules and cannot be unloaded. So caching them would be (probably) fine. Still. Some generic netlink families emit notifications, and it will be interesting to be able to handle them. Since that will be useful later, start by doing something simple: let the generic netlink family also be cached this way. Generic netlink will send notifications when a family gets added/deleted, and we can use that to reliably cache the family ID. We only care about a well-known set of generic families. Unlike libnl (which has "struct genl_family" object to handle any family), we can hard code the few we care about (NMPGenlFamilyType). This adds the necessary infrastructure of NMLinuxPlatform to listen to events on the generic netlink socket.
| * | platform: make FOR_EACH_DELAYED_ACTION() robust against integer overflowThomas Haller2022-07-191-15/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently there is no problem. However, DelayedActionType is a packed enum, and if we add a few more enum values, it might happen that DELAYED_ACTION_TYPE_MAX is 0x8000 and DelayedActionType effectively uint16_t. When that happens, the code would become an infinite loop, because 0x8000 is not larger than DELAYED_ACTION_TYPE_MAX, but `<<= 1` shifts out the bit, making it zero. Avoid that.
| * | platform: rename DELAYED_ACTION_TYPE_REFRESH_ALL_* enums to "all-rtnl"Thomas Haller2022-07-191-146/+160
| | | | | | | | | | | | We'll also have generic netlink things. Rename.
| * | platform: add delayed_action_schedule_refresh_all() helper and avoid ↵Thomas Haller2022-07-191-22/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | refreshing tc cache If nm_platform_get_cache_tc() is disabled, there is no need to refresh it. Filter those flags out. Also, don't duplicate the code and add a helper function delayed_action_schedule_refresh_all().
| * | platform: rename rtnetlink specific enum values to be clearly about rtnlThomas Haller2022-07-191-15/+15
| | | | | | | | | | | | | | | We will have similar names which are about generic netlink. Rename to be clear.
| * | platform: tighter pack structs and enumsThomas Haller2022-07-191-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | Reorder fields in DelayedActionWaitForNlResponseData, so that the struct size is optimal due to the alignment constraints. Also, when we remember enum values and embed them somewhere, it's nice if they only take the space actually needed. _nm_packed solves that.
| * | platform: rename RefreshAllInfo.addr_family to "addr_family_for_dump"Thomas Haller2022-07-191-7/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The term "addr_family" is used very frequently, and it usually is an auto variable or a function parameter. It is interesting to search where this field is used. So rename to give it a unique (and better fitting) name. While at it, use gint8 to encode the addr_family. It's always sufficient, and this reduces the size of RefreshAllInfo from 8 bytes to two.
| * | platform: add NMPGenlFamilyType enum for generic netlink typesThomas Haller2022-07-193-0/+149
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The genl types that we care about are well known. Add an enum for them, so we can do a lookup by index. To kernel, the corresponding names (like "wireguard") are also well known. However, the family-id, that we need when using genl are allocated dynamically. So we need to lookup the family-id, and by having an enum for the genl type, we can do so generically.
| * | platform/netlink: ensure padding is zero in _nest_end()Thomas Haller2022-07-191-1/+5
|/ / | | | | | | | | | | nla_reserve() also ensures that the padding is zero, and only the padding. Thus, when we call nla_reserve(), we need to zero the padding ourselves.
* | c-stdaux: re-import git-subtree for 'src/c-stdaux'Thomas Haller2022-07-194-1/+30
|\ \ | |/ | | | | git subtree pull --prefix src/c-stdaux git@github.com:c-util/c-stdaux.git main --squash
| * Squashed 'src/c-stdaux/' changes from 1407a1fb2754..da7209900ef0Thomas Haller2022-07-194-1/+30
| | | | | | | | | | | | | | | | | | da7209900ef0 api: add c_memcmp() 2369947a563b build: use v1 ci-sphinx d46a3eeaf30d build: mention documentation in README.md git-subtree-dir: src/c-stdaux git-subtree-split: da7209900ef065024db92b180dd8bc70440af9b4
* | c-rbtree: re-import git-subtree for 'src/c-rbtree'Thomas Haller2022-07-197-21/+119
|\ \ | | | | | | | | | git subtree pull --prefix src/c-rbtree git@github.com:c-util/c-rbtree.git main --squash
| * | Squashed 'src/c-rbtree/' changes from e56535a5daa5..edec411b3c1cThomas Haller2022-07-197-21/+119
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | edec411b3c1c build: add RTD link to README.md 431a47467052 build: add RTD integration e406cca122d7 build: import documentation builder 5f41b5d8ff75 ci: convert to new ci-c-util workflow git-subtree-dir: src/c-rbtree git-subtree-split: edec411b3c1c03985adb73e3f5b4c9a402206f5b
* | | c-list: re-import git-subtree for 'src/c-list'Thomas Haller2022-07-191-29/+17
|\ \ \ | | | | | | | | | | | | git subtree pull --prefix src/c-list git@github.com:c-util/c-list.git main --squash
| * | | Squashed 'src/c-list/' changes from fa024740fc6f..9aa81d84cadcThomas Haller2022-07-191-29/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 9aa81d84cadc ci: convert to new ci-c-util git-subtree-dir: src/c-list git-subtree-split: 9aa81d84cadc67e92b441c89f84c57e72dd1e8a9
* | | | contrib: add "git-subtree-reimport.sh" scriptThomas Haller2022-07-191-0/+33
| | | |
* | | | po: update Georgian (ka) translationNorwayFun2022-07-181-1113/+902
| | | | | | | | | | | | | | | | https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1301
* | | | core: merge branch 'th/cmdline-log-debug'Thomas Haller2022-07-187-15/+67
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | https://bugzilla.redhat.com/show_bug.cgi?id=2102313 https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1297
| * | | | core: support "nm.debug" kernel command line to enable verbose loggingThomas Haller2022-07-185-5/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When NetworkManager runs in initrd, it can be cumbersome to enable debug logging. Granted, when using dracut, the NetworkManager dracut module will honor "rd.debug". However, a user may use NetworkManager in initrd without dracut. Then, the only way to enable debug logging would be by changing "NetworkManager.conf" and rebuild the initrd (or having some script in place, that allows to more conveniently enable debug logging for NetworkManager). To make it easier for debugging, honor "nm.debug" on the kernel command line. Note that if "nm.debug" is set on the kernel command line, it always overrides both the command line arguments and the configuration from NetworkManager.conf. That is intentional. The only way to override that is by overriding the kernel command line with a file "/run/NetworkManager/proc-cmdline". https://bugzilla.redhat.com/show_bug.cgi?id=2102313
| * | | | core: support "/run/NetworkManager/proc-cmdline" to overwrite /proc/cmdlineThomas Haller2022-07-181-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We read /proc/cmdline for "match.kernel-command-line". But next we will also honor "nm.debug" on the kernel command line, to enable debug logging. For "nm.debug" it makes sense that it overwrites the debug options from the command line and from "NetworkManager.conf". That means, if you set "nm.debug", then verbose logging will be enabled. It can only be turned off again at runtime (via D-Bus), otherwise, it's hard to avoid. It still can make sense to overrule this setting once again. Support that, by honoring a file "/run/NetworkManager/proc-cmdline" to be used instead of "/proc/cmdline". This option is mainly for debugging and testing, but it might be useful in production too, if you had "nm.debug" enabled during boot, but later want to disable it until next reboot. Then you could do: sed 's/ *\<nm\.debug\> */ /g' /proc/cmdline > /run/NetworkManager/proc-cmdline nmcli general logging level DEFAULT domains DEFAULT
| * | | | glib-aux: don't use GPtrArray in nm_utils_strsplit_quoted()Thomas Haller2022-07-181-9/+24
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | GPtrArray requires an additional heap allocation for the GPtrArray. Utterly useless in the majority of cases. Anyway. Allocating (and exponentially grown) a buffer is not too hard, just slightly more cumbersome. Since nm_utils_strsplit_quoted() is heavily unit tested and entirely self-contained, let's opt for the more complicated implementation and avoid the extra allocation.
* | | | core: merge branch 'bg/l3cd-dns-priority'Beniamino Galvani2022-07-188-16/+11
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1045 https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1298
| * | | | ppp,wwan: remove explicit initialization of DNS priorityBeniamino Galvani2022-07-182-6/+1
| | | | | | | | | | | | | | | | | | | | | | | | | It's no longer necessary, as modem devices get the priority from the ipmanual configuration created from the profile.
| * | | | wwan: enable manual IP configurationBeniamino Galvani2022-07-181-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before 1.36, manual addresses from the profile were assigned to the interface; restore that behavior. The manual IP configuration also contains the DNS priority from the profile; so this change ensures that the merged l3cd has a DNS priority and that dynamically discovered DNS servers are not ignored by the DNS manager. Fixes: 58287cbcc0c8 ('core: rework IP configuration in NetworkManager using layer 3 configuration')
| * | | | device: add "is_manual" argument to ready_for_ip_config() device methodBeniamino Galvani2022-07-186-7/+7
|/ / / / | | | | | | | | | | | | | | | | Some device types might want to run manual ip configuration while skipping other methods.
* | | | doc: preserve paraghraphs in nmcli man pagesVojtech Bubela2022-07-158-162/+252
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Improve documentation by preserving paragraphs in the nm-settings-nmcli man pages. To do that structure of src/libnm-client-impl/nm-settings-docs-gir.xml was changed to have "description" as subnode to property node instead of attribute of property node. Another subnode "description-docbook" was added - this node is then used when generating man pages. tools/generate-docs-nm-settings-docs-gir.py and man/nm-settings-dbus.xsl were also changed to accomodate for changes mentioned above. Replace xsltproc tool with python script when generating ./src/libnmc-setting/settings-docs.h. Deleted settings-docs.xsl since it was replaced by python script. Change src/libnmc-setting/settings-docs.h.in accodring to newly generated src/libnmc-setting/settings-docs.h https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/661 https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1260
* | | | libnm: add comment to libnm.ver about preserving existing version nodesThomas Haller2022-07-151-0/+8
| | | |
* | | | policy: downgrade verbosity of hostname change logging messageThomas Haller2022-07-151-1/+1
| | | | | | | | | | | | | | | | This message seems not useful at <info> level. Downgrade logging level.
* | | | man/nm-initrd-generator: add missing command line optionsAntonio Alvarez Feijoo2022-07-141-1/+6
| | | | | | | | | | | | | | | | https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1300
* | | | release: bump version to 1.39.10 (development)1.39.10-devLubomir Rintel2022-07-132-2/+2
| | | |
* | | | examples: fix tracking destruction in destroy_nmc()Thomas Haller2022-07-131-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While iterating the context (once), multiple sources can be dispatched. So if we get a timeout and shortly after the weak-ref callback, then we still need to honor the weak-ref. In particular, because weak_ref.unref() is not safe to do after the object was already destroyed. So we need to be correct about tracking destruction.