summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* core: shorten the hostname from DHCP when necessarybg/dhcp-shorten-hostnameBeniamino Galvani2020-11-111-4/+22
| | | | | | | | | The hostname received in option 12 can be a FQDN longer than the maximum allowed by kernel (64 characters). Change the code in NMPolicy to gracefully handle such hostnames by truncating them to the first dot or to the maximum length, whatever comes earlier. https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/572
* core: add nm_utils_shorten_hostname()Beniamino Galvani2020-11-113-1/+88
| | | | Add nm_utils_shorten_hostname() to shorten a hostname when too long.
* po: update Ukrainian (uk) translationYuri Chornoivan2020-11-111-260/+285
| | | | https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/676
* gitlab-ci: automatically run prep-container to fix hanging testsThomas Haller2020-11-112-23/+23
| | | | | | | | | | | | | | The goal is to run most distros only manually. However, it would be nice to avoid (manually) clicking twice to start the tests for one distro: once for the container preparation, and once for the actual test. Previously, the container prep part was set to manual and the actual test automatic. It worked almost as desired, except that this leads to the entire gitlab-ci pipeline be be in running state indefinitely. To fix that, always run the container prep steps. If the container is cached, this is supposed to be fast and cheap. Now only the actual tests are marked as "manual".
* gitlab-ci: add "needs" for pages testThomas Haller2020-11-112-0/+4
| | | | | | It seems "pages" test does not get properly triggered, if only t_fedora:33 completes. It should, because the other distros are optional. Try to set "needs" to fix that.
* device: fix _Generic() types for _NM_DEVICE_CAST() macro (2)Thomas Haller2020-11-101-1/+4
| | | | | | | | | | | | | | | | | | | | | | clang (x86_64, 3.4.2-9.el7) fails: ../src/devices/nm-device.c:957:9: error: controlling expression type 'typeof (*self) *const' (aka 'struct _NMDevice *const') not compatible with any generic association type _LOGT(LOGD_DEVICE, ^~~~~~~~~~~~~~~~~~ ../shared/nm-glib-aux/nm-logging-fwd.h:162:20: note: expanded from macro '_LOGT' #define _LOGT(...) _NMLOG(_LOGL_TRACE, __VA_ARGS__) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../src/devices/nm-device-logging.h:34:81: note: expanded from macro '_NMLOG' const char *const _ifname = _nm_device_get_iface(_NM_DEVICE_CAST(_self)); \ ^~~~~ ../src/devices/nm-device-logging.h:14:63: note: expanded from macro '_NM_DEVICE_CAST' #define _NM_DEVICE_CAST(self) _NM_ENSURE_TYPE(NMDevice *, self) ^ ../shared/nm-glib-aux/nm-macros-internal.h:664:53: note: expanded from macro '_NM_ENSURE_TYPE' #define _NM_ENSURE_TYPE(type, value) (_Generic((value), type : (value))) ^ Fixes: cc35dc3bdf5f ('device: improve "nm-device-logging.h" to support a self pointer of NMDevice type')
* build: fix handling NMTST_SKIP_PYTHON_BLACK for skipping `make ↵Thomas Haller2020-11-101-1/+1
| | | | | | check-python-black` test Fixes: c537852231a6 ('build: optionally skip python black check by setting NMTST_SKIP_PYTHON_BLACK=1')
* device: fix _Generic() types for _NM_DEVICE_CAST() macroThomas Haller2020-11-101-4/+6
| | | | | | | | | | | | | | | | | | | clang (x86_64, 3.4.2-9.el7) fails: ../src/devices/nm-device-6lowpan.c:161:9: error: controlling expression type 'typeof (*self) *const' (aka 'struct _NMDevice6Lowpan *const') not compatible with any generic association type _LOGW(LOGD_DEVICE, "could not get 6lowpan properties"); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../shared/nm-glib-aux/nm-logging-fwd.h:165:20: note: expanded from macro '_LOGW' #define _LOGW(...) _NMLOG(_LOGL_WARN, __VA_ARGS__) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../src/devices/nm-device-logging.h:32:81: note: expanded from macro '_NMLOG' const char *const _ifname = _nm_device_get_iface(_NM_DEVICE_CAST(_self)); \ ^~~~~ ../src/devices/nm-device-logging.h:17:19: note: expanded from macro '_NM_DEVICE_CAST' _Generic((self), _NMLOG_DEVICE_TYPE * \ ^ Fixes: cc35dc3bdf5f ('device: improve "nm-device-logging.h" to support a self pointer of NMDevice type')
* gitlab-ci: fix building artifacts (pages) during gitlab-ci testThomas Haller2020-11-103-1/+9
|
* gitlab-ci: skip python black check during `make check` for buildsThomas Haller2020-11-101-0/+6
| | | | | | | | | | | We now install black by default via REQUIRED_PACKAGES script. Thus, also when we build on Fedora 30, `make check` would run python black. However, the formatting depends on the version of python black, and the one in Fedora 30 is not right. Skip all black tests during `make check`. We have a deicated gitlab-ci test that runs black already (with the desired version of black).
* contrib/checkpatch: fix shallow repository for checkpatch scriptThomas Haller2020-11-101-0/+2
| | | | | | | | The checkpatch test tests the patches on the merg-request, as they branch off from master (or one of the stable branches). It thus need the full git history, but the git repository might be a shallow clone. Fix it.
* contrib/checkpatch: use random name for git remote and clean up afterwardsThomas Haller2020-11-101-5/+14
|
* gitlab-ci: bump default-tagThomas Haller2020-11-102-5/+5
|
* gitlab-ci: merge "check-ci-script" test with static checksThomas Haller2020-11-103-47/+37
| | | | | | | | | | | | | | | | | | | | | | Certain parts of the code are entirely generated or must follow a certain format that can be enforced by a tool. These invariants must never fail: - ci-fairy generate-template (check-ci-script) - black python formatting - clang-format C formatting - msgfmt -vs On the other hand, we also have a checkpatch script that checks the current patch for common errors. These are heuristics and only depend on the current patch (contrary to the previous type that depend on the entire source tree). Refactor the gitlab-ci tests: - split "checkpatch" into "check-patch" and "check-tree". - merge the "check-ci-script" test into "check-tree".
* gitlab-ci: cleanup ".gitlab-ci/{build,fedora-install,debian-install}.sh"Thomas Haller2020-11-103-45/+104
| | | | | | | Now that the individual steps are no longer in .gitlab.yml but we run a full shell script, clean it up to be better readable. Also, we need to fail the script when any command fails.
* contrib: install "udev" package with "debian/REQUIRED_PACKAGES"Thomas Haller2020-11-101-0/+2
| | | | | | | | | | | "debian/REQUIRED_PACKAGES" is used by gitlab-ci to prepare the image. We require "udev" package, if only to install "/usr/share/pkgconfig/udev.pc" to get the udev directory. Otherwise build fails with: Run-time dependency udev found: NO (tried pkgconfig) meson.build:371:2: ERROR: Dependency "udev" not found, tried pkgconfig
* contrib: install "python{3,}-setuptools" package with "debian/REQUIRED_PACKAGES"Thomas Haller2020-11-101-0/+2
| | | | | | | Odd, sometimes gitlab CI fails to use pip3 install, because setuptools module is not installed. But only sometimes... Explicitly install it.
* ovs: merge branch 'th/ovs-external-ids' (first part of feature)Thomas Haller2020-11-1058-631/+2182
|\ | | | | | | https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/673
| * core/ovs: refactor duplicate code in ovsdb_next_command()th/ovs-external-idsThomas Haller2020-11-091-52/+39
| |
| * core/ovs: split payload out of OvsdbMethodCall structThomas Haller2020-11-091-98/+125
| | | | | | | | | | | | | | | | Before, ovsdb_call_method() has a long list of arguments to account for all possible commands. That does not scale. Instead, introduce a separate OvsdbMethodPayload type and only add a macro to allow passing the right parameters.
| * core/ovs: rename logging output for _LOGT_call()Thomas Haller2020-11-091-3/+3
| | | | | | | | | | | | | | | | The text should match the OvsdbCommand enum. If the enum value is named OVSDB_ADD_INTERFACE, then we should print "add-interface". Or alternatively, if you think spelling out interface is too long, then the enum should be renamed. I don't care, but name should correspond.
| * core/ovs: name union fields in OvsdbMethodCallThomas Haller2020-11-091-33/+41
| | | | | | | | | | | | As we add more command types, the union gets more members. Name each union field explicitly to match the OvsdbCommand type.
| * core/ovs: cleanup debug logging for OVS commandThomas Haller2020-11-091-15/+9
| | | | | | | | | | | | | | - always print the JSON string as last (if present). Previously that didn't happen with OVSDB_SET_INTERFACE_MTU. - introduce _QUOTE_MSG() macro.
| * core/ovs: track external-ids for cached ovsdb objectsThomas Haller2020-11-092-45/+119
| | | | | | | | We will need them later.
| * core/ovs: cleanup logic in update handling of ovsdb_got_update()Thomas Haller2020-11-091-152/+269
| | | | | | | | | | | | | | | | | | | | | | | | | | | | ovsdb sends monitor updates, with "new" and "old" values that indicate whether this is an addition, and update, or a removal. Since we also cache the entries, we might not agree with what ovsdb says. E.g. if ovsdb says this is an update, but we didn't have the interface in our cache, we should rather pretend that the interface was added. Even if this possibly indicates some inconsistency between what OVS says and what we have cached, we should make the best of it. Rework the code. On update, we compare the result with our cache and care less about the "new" / "old" values.
| * core/ovs: change function signature of _free_{bridge,port,interface}Thomas Haller2020-11-091-14/+11
| | | | | | | | | | | | | | | | We will call the function directly as well. Lets aim to get the types right. Also the compiler would warn if the cast to (GDestroyNotify) would be to a fundamtally different function signature.
| * core/ovs: use helper functions to emit NM_OVSDB_* signalsThomas Haller2020-11-092-47/+44
| |
| * core/ovs: move code in "nm-ovsdb.c" around to have simple helpers at the topThomas Haller2020-11-091-59/+67
| |
| * core/ovs: track key for OpenvswitchInterface in same structThomas Haller2020-11-091-6/+9
| |
| * core/ovs: track key for OpenvswitchPort in same structThomas Haller2020-11-091-6/+9
| |
| * core/ovs: track key for OpenvswitchBridge in same structThomas Haller2020-11-091-13/+14
| | | | | | | | | | | | | | GHashTable is optimized for data that has no separate value pointer. We can use the OpenvswitchBridge structs as key themselves, by having the id as first field of the structure and only use g_hash_table_add().
| * core/ovs: minor cleanup of logic in _add_interface()Thomas Haller2020-11-091-6/+8
| |
| * core/ovs: avoid possible crash in _add_interface()Thomas Haller2020-11-091-2/+2
| |
| * core/ovs: use streq() instead of strcmp()Thomas Haller2020-11-091-21/+19
| |
| * core/ovs: cleanup uses of g_slice_*() in "nm-ovsdb.c"Thomas Haller2020-11-091-20/+27
| |
| * core/ovs: fix using unsigned "mtu" value to json_pack()Thomas Haller2020-11-091-2/+2
| | | | | | | | | | | | | | Of course, in practice "mtu" is much smaller than 2^31, and also is sizeof(int) >= sizeof(uint32_t) (on our systems). Hence, this was correct. Still, it feels ugly to pass a unsigned integer where not the entire range is covered.
| * core/ovs: cleanup handling of call id for OVS commandsThomas Haller2020-11-091-18/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | - rename "id" to something more distinct: "call_id". - consistently use guint64 type. We don't want nor need to handle negative values. For CALL_ID_UNSPEC we can use G_MAXUINT64. - don't use "i" format string for the call id. That expects an "int", so it's not clear how this was working correctly previously. Also, "int" has a smaller range than our 64bits. Use instead "json_int_t" and cast properly in the variadic arguments of json_pack().
| * core/ovs: fix leak of "NMOvsdbPrivate.db_uuidThomas Haller2020-11-091-2/+6
| | | | | | | | | | | | | | Also, never update the value to %NULL. If the current message does not contain a UUID, keep the previous one. Fixes: 830a5a14cb29 ('device: add support for OpenVSwitch devices')
| * core/trivial: add FIXME comment about immutable applied-connectionThomas Haller2020-11-092-0/+4
| |
| * device: refactor NMDevice's can_reapply_change() to return earlyThomas Haller2020-11-091-20/+26
| | | | | | | | | | Don't have if-else-if structure, if we can always return from an "if" block, once we matched the setting-name.
| * device: improve "nm-device-logging.h" to support a self pointer of NMDevice typeThomas Haller2020-11-0929-55/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | "nm-device-logging.h" defines logging macros for a NMDevice instance. It also expects a "self" variable in the call environment, and that variable had to be in the type of NMDevice or the NMDevice subclass. Extend the macro foo, so that @self can be either a NMDevice* pointer or a NMDevice$SUBTYPE. Of course, that would have always been possible, if we would simply cast to "(NMDevice *)" where we need it. The trick is that the macro only works if @self is one of the two expected types, and not some arbitrary unrelated type.
| * format: mark json_{object,array}_foreach() macors as ForEachMacros for ↵Thomas Haller2020-11-092-12/+8
| | | | | | | | clang-format
| * examples: add "ovs-external-ids.py" example scriptThomas Haller2020-11-092-0/+426
| | | | | | | | | | | | | | | | | | | | | | | | | | And example script for getting and setting OVS external-ids. Since currently there is no nmcli support for these properties yet, the script becomes more interesting. This "example" is rather long, and it showcases less the usage of libnm (which is rather trivial, with respect to configuring NMSettingOvsExternalIDs). Instead, it aims to provide a useful command line tool for debugging. Hence, it's mostly concerned with an elaborate command line syntax and useful print output.
| * libnm: add NMSettingOvsExternalIDsThomas Haller2020-11-0916-4/+747
| |
| * libnm: add nm_utils_print() functionThomas Haller2020-11-093-0/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | libnm supports verbose debug logging by setting "LIBNM_CLIENT_DEBUG" environment variable. That mechanism uses g_printerr() (or g_print()). When testing an application it's useful to combine printf debugging with this debug logging. However, python's print() statement is additionally buffered and not in sync with the logging functions that libnm uses. As far as I see, g_print() and g_printerr() is not accessible via introspections/pygobject, probably because these are variadic functions. Add nm_utils_print() to libnm. This ensures to use the same logging mechanism as libnm.
| * shared/strbuf: add nm_str_buf_get_char() and nm_str_buf_get_str_at_unsafe() ↵Thomas Haller2020-11-091-1/+26
| | | | | | | | helpers
| * shared,all: cleanup nm_utils_hashtable_equal*() functionsThomas Haller2020-11-095-86/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We have: - nm_utils_hashtable_cmp(): this does a full cmp of two hash tables, with the intent to provide a stable sort order. It thus takes a GCompareDataFunc() argument. - nm_utils_hashtable_cmp_equal(): this is like nm_utils_hashtable_cmp(), except that the caller won't get a compare value, only a boolean value that indicates equality. This was previously called nm_utils_hashtable_equal(). - nm_utils_hashtable_equal(): this takes a GEqualFunc function for comparing the values for equality. It takes thus a different kind of predicate, but otherwise is similar to nm_utils_hashtable_cmp_equal(). This was previously called nm_utils_hash_table_equal(). Unify the naming of these functions.
| * shared: use GEqualFunc instead of NMUtilsHashTableEqualFunc typedefThomas Haller2020-11-092-10/+8
| |
| * shared: add nm_g_array_unref() helperThomas Haller2020-11-091-0/+7
| |
| * shared: add nm_utils_strdict_clone() helperThomas Haller2020-11-092-0/+20
| |