summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* device: clean up exported IP6 config when flushing addressesbg/rh1848888Beniamino Galvani2020-06-261-0/+3
| | | | | | | | | After flushing addresses and routes, it's also necessary to update the exported IP6 configuration. https://bugzilla.redhat.com/show_bug.cgi?id=1848888 Fixes: e302f5ff77a9 ('device: flush IP configuration of slaves during activation')
* all: merge branch 'th/strbuf-uses'Thomas Haller2020-06-2612-424/+672
|\ | | | | | | https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/547
| * supplicant: use NMStrBuf in wifi_freqs_to_string()Thomas Haller2020-06-261-14/+28
| | | | | | | | And don't access global data without atomic operations.
| * supplicant: use nm_streq() in "nm-supplicant-config.c"Thomas Haller2020-06-261-18/+18
| |
| * libnm: refactor wifi frequency handling in libnmThomas Haller2020-06-262-64/+176
| | | | | | | | | | | | | | | | | | | | | | | | - mark global variables as const. This allows the linker to mark the variable as read only. - for nm_utils_wifi_[25]ghz_freqs(), don't generate a list based on bg_table/a_table. Instead, keep static array of frequencies. Since we have unit tests that check the consistency, this has little maintenance effort. - add unit tests
| * libnm: don't use assert for validating arguments to ↵Thomas Haller2020-06-261-4/+2
| | | | | | | | nm_utils_wifi_find_next_channel()
| * libnm: use nm_streq() in "libnm-core/nm-utils.c"Thomas Haller2020-06-261-33/+29
| |
| * libnm: use NMStrBuf in nm_utils_file_search_in_paths()Thomas Haller2020-06-261-23/+23
| |
| * libnm: use NMStrBuf in _nm_utils_uuid_generate_from_strings()Thomas Haller2020-06-261-17/+17
| |
| * libnm: use NMStrBuf in nm_ip_routing_rule_to_string()Thomas Haller2020-06-261-66/+67
| |
| * keyfile: cleanup uses of GString in keyfile codeThomas Haller2020-06-262-142/+159
| | | | | | | | | | | | | | | | | | | | | | | | - in _keyfile_key_decode(), don't use GString. We know the maximum string length before, so we can just allocated one buffer. - in qdisc and tfilter writers, reuse the same GString instance. No need to allocate a new temporary string buffer for each iteration. - at other places, replace GString by NMStrBuf. This avoids the heap allocated GString instance. Also, most operations can be inlined. This results in larger code side, but avoids function calls to glib.
| * libnm: use NMStrBuf in "nm-setting-bridge.c"Thomas Haller2020-06-262-29/+10
| |
| * shared: add nm_str_buf_reset() helperThomas Haller2020-06-261-0/+18
| |
| * shared: add nm_utils_escaped_tokens_escape_strbuf*() helpersThomas Haller2020-06-261-0/+28
| |
| * shared: add nm_utils_escaped_tokens_escape_unnecessary() utilThomas Haller2020-06-261-15/+24
| |
| * shared: add nm_str_buf_append_required_delimiter()Thomas Haller2020-06-261-0/+13
| |
| * shared: add nm_str_buf_append_c_hex() helperThomas Haller2020-06-261-0/+10
| |
| * shared: add nm_hexchar() helperThomas Haller2020-06-262-0/+14
| |
| * shared: add nm_str_buf_append0() and nm_str_buf_append_len0() helperThomas Haller2020-06-261-0/+28
| | | | | | | | | | These are basically nm_str_buf_append()/nm_str_buf_append_len() and nm_str_buf_get_str() in one.
| * shared: add NM_UTILS_GET_NEXT_REALLOC_SIZE_32 and _40 macrosThomas Haller2020-06-262-0/+4
| |
| * shared: return non-const pointer from nm_str_buf_get_str()Thomas Haller2020-06-261-1/+1
| | | | | | | | | | It's more convenient in certain cases. The user is allowed to modified the content of the returned buffer.
| * shared: avoid copying empty string in nm_str_buf_append_printf()Thomas Haller2020-06-251-1/+6
|/
* libnm: fix wrong assertion in nm_client_check_connectivity_finish()Beniamino Galvani2020-06-251-1/+1
| | | | | | https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/476 Fixes: b44d883d920d ('libnm: implement nm_client_check_connectivity_async() by using GDBusConnection directly')
* libnm: omit nm_device_*_get_hw_address() from introspection outputbg/introspection-get-hw-addrBeniamino Galvani2020-06-2518-18/+18
| | | | | | | | | | | | | | | | | | When the get_hw_address() method is called on a device object through GObject-introspection, the device-specific (e.g. nm_device_ethernet_get_hw_address()) C function is called instead of the more generic nm_device_get_hw_address(). Those device-specific functions were deprecated in commit 067a3d6c0861 ('nm-device: expose via D-Bus the 'hw-address' property') and so libnm will print out deprecation warnings like: DeprecationWarning: NM.DeviceEthernet.get_hw_address is deprecated Omit the device-specific function from the introspection output so that the generic function will be called instead. https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/544
* initrd: merge branch 'bg/initrd-ipv6'Beniamino Galvani2020-06-242-5/+16
|\ | | | | | | | | https://bugzilla.redhat.com/show_bug.cgi?id=1848943 https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/548
| * initrd: set ipv6.method=auto when the autoconfiguration field is 'none'bg/initrd-ipv6Beniamino Galvani2020-06-242-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The 7th field of: ip=<client-IP>:[<peer>]:<gateway-IP>:<netmask>:<client_hostname>:<interface>:{none|off|dhcp|on|any|dhcp6|auto6|ibft}:[:[<mtu>][:<macaddr>]] specifies which kind of autoconfiguration to do. 'none' and 'off' mean static addresses. The old network module of dracut used to leave kernel IPv6 autoconfiguration enabled when IPv4 static addresses were configured. With NM, this corresponds to enabling IPv6 auto method. https://bugzilla.redhat.com/show_bug.cgi?id=1848943
| * initrd: generate connections with IPv6 method 'auto' instead of 'ignore'Beniamino Galvani2020-06-242-3/+9
|/ | | | | | | | | | When the initrd generator creates a connection with IPv6 method 'ignore', the kernel will do IPv6 autoconfiguration on the interface. However, it is preferable to let NetworkManager configure the interface directly instead of relying on kernel. Therefore, change the IPv6 method to 'auto'. Note that we still set ipv6.may-fail to 'yes' so that a failure during IPv6 autoconfiguration doesn't bring down the interface.
* shared,core: merge branch 'th/strsplit-quoted-kernel-cmdline'Thomas Haller2020-06-247-18/+401
|\ | | | | | | https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/549
| * core: use nm_utils_strsplit_quoted() for splitting the kernel command lineth/strsplit-quoted-kernel-cmdlineThomas Haller2020-06-231-11/+5
| | | | | | | | | | | | | | The kernel command line supports escaping and quoting (at least, according to systemd's parser, which is our example to follow). Use nm_utils_strsplit_quoted() which supports that.
| * shared: add nm_utils_strsplit_quoted()Thomas Haller2020-06-233-0/+327
| | | | | | | | | | | | | | | | We want to parse "/proc/cmdline". That is space separated with support for quoting and escaping. Our implementation becomes part of stable behavior, and we should interpret the kernel command line the same way as the system does. That means, our implementation should match systemd's.
| * tests: add nmtst_extract_first_word_all() for testingThomas Haller2020-06-222-0/+44
| | | | | | | | | | | | We usually don't want to use internal API of systemd for our own purposes. Here, we will use it to check our implementation against systemd's. Add an accessor to extract_first_word() for testing.
| * shared: add nm_str_buf_append_c_repeated() helperThomas Haller2020-06-221-0/+13
| |
| * shared: make NM_STR_BUF_INIT() an inline functionThomas Haller2020-06-221-7/+12
|/ | | | | | | | | | | | In the previous form, NM_STR_BUF_INIT() was a macro. That makes sense, however it's not really possible to make that a macro without evaluating the reservation length multiple times. That means, NMStrBuf strbuf = NM_STR_BUF_INIT (nmtst_get_rand_uint32 () % 100, FALSE); leads to a crash. That is unfortunate, so instead make it an inline function that returns a NMStrBut struct. Usually, we avoid functions that returns structs, but here we do it.
* libnm: avoid deprecation warning about NMUtilsPredicateStrThomas Haller2020-06-221-1/+0
| | | | | | | | | | | | | NMUtilsPredicateStr got introduced in 1.26.0 API. However, marking the typedef to be available only in 1.26, causes a compiler warning when using the header: /usr/include/libnm/nm-setting.h:372:39: error: ‘NMUtilsPredicateStr’ is deprecated: Not available before 1.26 [-Werror=deprecated-declarations] 372 | NMUtilsPredicateStr predicate); | ^~~~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors Avoid that. It's not a problem in practice, because all users of the typedef are functions that are marked to be available in 1.26 themselves.
* libnm: return NULL for boxed strv properties of NMSettingMatchThomas Haller2020-06-221-4/+4
| | | | | | | | | | | | | | | The API does not allow to distinguish between an unset (NULL) or empty strv array. For example, nm_setting_match_get_paths() never returns %NULL, but returns an empty strv array. On the other hand, the GObject properties of type G_TYPE_STRV have a default value of %NULL. That means, also the getter should map both unset and empty to %NULL. Note that this is a change in behavior w.r.t. 1.24.0 API, where match.interface-name property would return an empty strv array. Regrading the other API, this is no change because it is new API and we will fix it before 1.26.0 release.
* shared: add nm_strvarray_get_strv_non_empty() helperThomas Haller2020-06-221-0/+12
|
* settings: fix assertion when updating default wired connectionbg/issue471Beniamino Galvani2020-06-221-4/+3
| | | | | | | | | The connection is expected to have the NM_GENERATED flag, since it has a default wired device. Fixes: d35d3c468a30 ('settings: rework tracking settings connections and settings plugins') https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/471
* shared: fix string truncation in nm_str_buf_append_printf()Thomas Haller2020-06-211-1/+1
| | | | | | | | | If g_vsnprintf() returns that it wants to write 5 characters, it really needs space for 5+1 characters. If we have 5 characters available, it would have written "0123\0", which leaves the buffer broken. Fixes: eda47170ed2e ('shared: add NMStrBuf util')
* shared: allow empty NMStrBuf buffers with un-allocated memoryThomas Haller2020-06-202-15/+28
| | | | | | | | | Previously, for simplicity, NMStrBuf did not support buffers without any data allocated. However, supporting that has very little overhead/complexity, so do it. Now you can initialize buffers to have no data allocated, and when appending data, it will automatically grow.
* all: merge branch 'th/stdict-values'Thomas Haller2020-06-199-111/+146
|\ | | | | | | https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/531
| * libnm: ensure stable behavior in _nm_ip_route_attribute_validate_all()Thomas Haller2020-06-191-5/+14
| | | | | | | | | | Check the attributes in a defined, stable order. This is necessary, so that consistently the same error gets reported.
| * libnm: use nm_utils_named_values_from_strdict() in "nm-setting-tc-config.c"Thomas Haller2020-06-191-16/+30
| |
| * libnm: add missing since gtk-doc for nm_tc_action_get_attribute_names()Thomas Haller2020-06-191-0/+6
| |
| * shared: refactor nm_utils_strdict_to_variant_ass() to use ↵Thomas Haller2020-06-191-40/+15
| | | | | | | | | | | | nm_utils_named_values_from_strdict() It is pretty much the same code this way, but shorter.
| * shared,core: rename and move function to nm_utils_strdict_to_variant_asv()Thomas Haller2020-06-195-30/+29
| |
| * ifcfg-rh: use nm_utils_named_values_from_strdict() in write_secrets()Thomas Haller2020-06-191-6/+12
| |
| * shared: avoid allocating temporary buffer for ↵Thomas Haller2020-06-194-25/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | nm_utils_named_values_from_strdict() Iterating hash tables gives an undefined order. Often we want to have a stable order, for example when printing the content of a hash or when converting it to a "a{sv}" variant. How to achieve that best? I think we should only iterate the hash once, and not require additional lookups. nm_utils_named_values_from_strdict() achieves that by returning the key and the value together. Also, often we only need the list for a short time, so we can avoid heap allocating the list, if it is short enough. This works by allowing the caller to provide a pre-allocated buffer (usually on the stack) and only as fallback allocate a new list.
| * shared: make NMUtilsNamedValue.value_ptr non constThomas Haller2020-06-191-1/+1
|/ | | | | | If the value pointer is const, it is commonly inconvenient and requires a cast. Requiring casts on a common base does not increase type safety, but is annoying.
* build: merge branch 'ss/python-improvements'Thomas Haller2020-06-193-2/+13
|\ | | | | | | https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/540
| * gitlab-ci: enable python black check in gitlab-ciThomas Haller2020-06-191-1/+2
| |