summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* build: fix meson build with -Dppp=falsebg/issue7Beniamino Galvani2018-08-151-1/+3
| | | | | | | | meson.build:897:15: ERROR: Unknown variable "pppd_plugin_dir". Fixes: a75ab799e4f6b9c5d6f298ad7c1899ae21726a48 https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/7
* po: update Brazilian Portuguese translationRafael Fontenelle2018-08-151-3323/+4594
| | | | https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/3
* device: cope with devices' failure to provide reason for incompatibilityLubomir Rintel2018-08-141-0/+1
| | | | | Pretty sure we get this right now, but if we don't let's fail more sensibly.
* wifi: provide reasons for connection incompatibilityLubomir Rintel2018-08-141-7/+28
| | | | | | The callers assume that we set an error on returning FALSE. Mostly copied from the IWD implementation.
* iwd: improve error messagesLubomir Rintel2018-08-141-3/+3
| | | | Fix errors, typoes and ambiguities.
* release: bump version to 1.13.3 (development)1.13.3-devThomas Haller2018-08-132-2/+2
|
* release: update NEWSThomas Haller2018-08-131-0/+3
|
* utils/test: don't assert on debug level messagesLubomir Rintel2018-08-111-2/+3
| | | | | They come and go in GLib core for all sorts of purposes. Don't let that break our tests.
* merge: branch 'bg/wildcard-match-rh1555012'Beniamino Galvani2018-08-1128-91/+866
|\ | | | | | | | | https://bugzilla.redhat.com/show_bug.cgi?id=1555012 https://github.com/NetworkManager/NetworkManager/pull/181
| * device: support match.interface-nameBeniamino Galvani2018-08-113-4/+47
| | | | | | | | | | Add support for matching a connection with the new match.interface-name property.
| * ifcfg-rh: add support for 'match' settingBeniamino Galvani2018-08-115-1/+140
| |
| * all: add 'match' settingBeniamino Galvani2018-08-1114-0/+462
| | | | | | | | | | | | | | Add a new 'match' setting containing properties to match a connection to devices. At the moment only the interface-name property is present and, contrary to connection.interface-name, it allows the use of wildcards.
| * shared: add @allow_escaping argument to @nm_utils_strsplit_setBeniamino Galvani2018-08-119-84/+108
| |
| * libnm-core: remove wrong annotation in NMSettingIPConfigBeniamino Galvani2018-08-111-2/+0
| |
| * shared: add space escape functionsBeniamino Galvani2018-08-113-0/+109
|/
* all/ethtool: merge branch 'th/ethtool-options-rh1335409-1'Thomas Haller2018-08-1096-1951/+5049
|\ | | | | | | | | | | | | | | Add support for setting offload features (akin to ethtool's -K|--offload|--feature). https://bugzilla.redhat.com/show_bug.cgi?id=1335409 https://github.com/NetworkManager/NetworkManager/pull/179
| * all/ethtool: add support for all currently supported kernel featuresThomas Haller2018-08-106-49/+322
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As of upstream kernel v4.18-rc8. Note that we name the features like they are called in ethtool's ioctl API ETH_SS_FEATURES. Except, for features like "tx-gro", which ethtool utility aliases as "gro". So, for those features where ethtool has a built-in, alternative name, we prefer the alias. And again, note that a few aliases of ethtool utility ("sg", "tso", "tx") actually affect more than one underlying kernel feature. Note that 3 kernel features which are announced via ETH_SS_FEATURES are explicitly exluded because kernel marks them as "never_changed": #define NETIF_F_NEVER_CHANGE (NETIF_F_VLAN_CHALLENGED | \ NETIF_F_LLTX | NETIF_F_NETNS_LOCAL)
| * cli: hide ethtool options form `nmcli connection show "$PROFILE"` outputThomas Haller2018-08-101-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We will add a large number of offload features. That means, the output of `nmcli connection show "$PROFILE"` would be very verbose, in case the profile has a [ethtool] option. Since this is newly added API, don't do that. Don't show ethtool properties that are left unset. A minor problem here is, that it becomes no longer obvious which properties exist. We should however counter that by documentation. Also, one could do: $ nmcli connection modify "$PROFILE" ethtool.xxx x Error: invalid property 'xxx': 'xxx' not among [feature-gro, feature-gso, feature-lro, feature-ntuple, feature-rx, feature-rxhash, feature-rxvlan, feature-sg, feature-tso, feature-tx, feature-txvlan, feature-tx-tcp6-segmentation, feature-tx-tcp-segmentation]. Likewise, bash completion still works as one would expect. $ nmcli --complete-args connection modify "$PROFILE" ethtool. ethtool.feature-gro ethtool.feature-gso ethtool.feature-lro [...] Note the output of $ nmcli -f ethtool.feature-gro connection show "$PROFILE" gives now nothing (if there is an ethtool section, but not this particular feature). Maybe this shouldn't be like that. On the other hand, specifying a connection setting that doesn't exist also gives no output: $ nmcli -f bond connection show "$PROFILE" So, maybe this behavior is fine.
| * cli: add functionality to hide properties from outputThomas Haller2018-08-102-1/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Historically, nmcli printed all fields during operations like `nmcli connection show "$PROFILE"`. As we supported more and more options, this resulted in a verbose output, of most properties just being the default values. To counter that, we added the '-overview' option. When given, it would hide options that are set at their default. This option was not the default, to preserve established behavior. However, for new options, we can afford to hide them. Add a mechanism, that property getters can mark their value to be hidden. At the moment, there is no way to show these properties. However, we could add a '-verbose' option, with the opposite meaning of '-overview'. Anyway, that does not seem necessary at the moment. Hiding properties from output is only acceptable for new properties (otherwise we badly change behavior), and if the properties are set at their default values (otherwise, we hide important information).
| * device: implement setting ethtool offload featuresThomas Haller2018-08-101-0/+87
| |
| * platform/ethtool: add code to get/set offload features via ethtoolThomas Haller2018-08-1010-26/+599
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also, add two more features "tx-tcp-segmentation" and "tx-tcp6-segmentation". There are two reasons for that: - systemd-networkd supports setting these two features, so lets support them too (apparently they are important enough for networkd). - these two features are already implicitly covered by "tso". Like for the "ethtool" program, "tso" is an alias for several actual features. By adding two features that are already also covered by an alias (which sets multiple kernel names at once), we showcase how aliases for the same feature can coexist. In particular, note how setting "tso on tx-tcp6-segmentation off" will behave as one would expect: all 4 tso features covered by the alias are enabled, except that particular one.
| * platform/mii: use SocketHandle also for nmp_utils_mii_supports_carrier_detect()Thomas Haller2018-08-101-16/+12
| | | | | | | | | | | | There is little difference in practice because there is only one caller. Still re-use the SocketHandle also for mii. If only, to make it clear that SocketHandle is not only suitable for ethtool, but also mii.
| * platform/ethtool: add SocketHandle to reuse socket for ethtool requestsThomas Haller2018-08-101-83/+131
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, each call to ethtool_get() would resolve the ifindex and create a new socket for the ethtool request. This is partly done, because ethtool only supports making requests by name. Since interfaces can be renamed, this is inherrently racy. So, we want to fetch the latest name shortly before making the request. Some functions like nmp_utils_ethtool_supports_vlans() require multiple ioctls. And next, we will introduce more ethtool functions, that make an even larger number of individual requests. Add a simple SocketHandle struct, to create the socket once and reuse it for multiple requests. This is still entirely internal API in "nm-platform-utils.c".
| * platform/ethtool: split functions for ETHTOOL_GSTRINGSThomas Haller2018-08-101-33/+69
| | | | | | | | | | | | | | ethtool_get_stringset() will be used later, independently. Also, don't trust and ensure that the block of strings returned by ETHTOOL_GSTRINGS are NUL terminated.
| * shared: add NM_DIV_ROUND_UP() helper macroThomas Haller2018-08-101-0/+8
| | | | | | | | Inspired by ethtool's DIV_ROUND_UP() and systemd's DIV_ROUND_UP().
| * libnm, cli, ifcfg-rh: add NMSettingEthtool settingThomas Haller2018-08-1029-91/+1241
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Note that in NetworkManager API (D-Bus, libnm, and nmcli), the features are called "feature-xyz". The "feature-" prefix is used, because NMSettingEthtool possibly will gain support for options that are not only -K|--offload|--features, for example -C|--coalesce. The "xzy" suffix is either how ethtool utility calls the feature ("tso", "rx"). Or, if ethtool utility specifies no alias for that feature, it's the name from kernel's ETH_SS_FEATURES ("tx-tcp6-segmentation"). If possible, we prefer ethtool utility's naming. Also note, how the features "feature-sg", "feature-tso", and "feature-tx" actually refer to multiple underlying kernel features at once. This too follows what ethtool utility does. The functionality is not yet implemented server-side.
| * libnm: add generic-data for implementing NMSettingThomas Haller2018-08-105-96/+708
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a new way how NMSetting subclasses can be implemented. Currently, most NMSetting implementations realize all their properties via GObject properties. That has some downsides: - the biggest one, is the large effort to add new properties. Most of them are implemented on a one-by-one basis and they come with additional API (like native getter functions). It makes it cumbersome to add more properties. - for certain properties, it's hard to encode them entirely in a GObject property. That results in unusable API like NM_SETTING_IP_CONFIG_ADDRESSES, NM_SETTING_BOND_OPTIONS, NM_SETTING_USER_DATA. These complex valued properties only exist, because we currently always need GObject properties to even implement simple functionality. For example, nm_setting_duplicate() is entirely implemented via nm_setting_enumerate_values(), which can only iterate GObject properies. There is no reason why this is necessary. Note also how nmcli badly handles bond options and VPN data. That is only a shortcoming of nmcli and wouldn't need to be that way. But it happend, because we didn't keep an open mind that settings might be more than just accessing GObject properties. - a major point of NMSetting is to convert to/from a GVariant from the D-Bus API. As NMSetting needs to squeeze all values into the static GObject structure, there is no place to encode invalid or unknown properties. Optimally, _nm_setting_new_from_dbus() does not loose any information and a subsequent _nm_setting_to_dbus() can restore the original variant. That is interesting, because we want that an older libnm client can talk to a newer NetworkManager version. The client needs to handle unknown properties gracefully to stay forward compatible. However, it also should not just drop the properties on the floor. Note however, optimally we want that nm_setting_verify() still can reject settings that have such unknown/invalid values. So, it should be possible to create an NMSetting instance without error or loosing information. But verify() should be usable to identify such settings as invalid. They also have a few upsides. - libnm is heavily oriented around GObject. So, we generate our nm-settings manual based on the gtk-doc. Note however, how we fail to generate a useful manual for bond.options. Also note, that there is no reason we couldn't generate great documentation, even if the properties are not GObject properties. - GObject properties do give some functionality like meta-data, data binding and notification. However, the meta-data is not sufficient on its own. Note how keyfile and nmcli need extensive descriptor tables on top of GObject properties, to make this useful. Note how GObject notifications for NMSetting instances are usually not useful, aside for data binding like nmtui does. Also note how NMSettingBond already follows a different paradigm than using GObject properties. Nowdays, NMSettingBond is considered a mistake (related bug rh#1032808). Many ideas of NMSettingBond are flawed, like exposing an inferiour API that reduces everything to a string hash. Also, it only implemented the options hash inside NMSettingBond. That means, if we would consider this a good style, we would have to duplicate this approach in each new setting implementation. Add a new style to track data for NMSetting subclasses. It keeps an internal hash table with all GVariant properies. Also, the functionality is hooked into NMSetting base class, so all future subclasses that follow this way, can benefit from this. This approach has a few similiarties with NMSettingBond, but avoids its flaws. With this, we also no longer need GObject properties (if we would also implement generating useful documentation based on non-gkt-doc). They may be added as accessors if they are useful, but there is no need for them. Also, handling the properties as a hash of variants invites for a more generic approach when handling them. While we still could add accessors that operate on a one-by-one bases, this leads to a more generic usage where we apply common functionality to a set of properties. Also, this is for the moment entirely internal and an implementation detail. It's entirely up to the NMSetting subclass to make use of this new style. Also, there are little hooks for the subclass available. If they turn out to be necessary, they might be added. However, for the moment, the functionality is restricted to what is useful and necessary.
| * libnm: rework setting metadata for property handlingThomas Haller2018-08-1046-540/+810
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | NMSetting internally already tracked a list of all proper GObject properties and D-Bus-only properties. Rework the tracking of the list, so that: - instead of attaching the data to the GType of the setting via g_type_set_qdata(), it is tracked in a static array indexed by NMMetaSettingType. This allows to find the setting-data by simple pointer arithmetic, instead of taking a look and iterating (like g_type_set_qdata() does). Note, that this is still thread safe, because the static table entry is initialized in the class-init function with _nm_setting_class_commit(). And it only accessed by following a NMSettingClass instance, thus the class constructor already ran (maybe not for all setting classes, but for the particular one that we look up). I think this makes initialization of the metadata simpler to understand. Previously, in a first phase each class would attach the metadata to the GType as setting_property_overrides_quark(). Then during nm_setting_class_ensure_properties() it would merge them and set as setting_properties_quark(). Now, during the first phase, we only incrementally build a properties_override GArray, which we finally hand over during nm_setting_class_commit(). - sort the property infos by name and do binary search. Also expose this meta data types as internal API in nm-setting-private.h. While not accessed yet, it can prove beneficial, to have direct (internal) access to these structures. Also, rename NMSettingProperty to NMSettInfoProperty to use a distinct naming scheme. We already have 40+ subclasses of NMSetting that are called NMSetting*. Likewise, NMMetaSetting* is heavily used already. So, choose a new, distinct name.
| * libnm/keyfile: use NMMetaSettingInfo for indexing keyfile vtableThomas Haller2018-08-101-49/+63
| | | | | | | | | | | | | | | | | | | | | | | | We have NMMetaSettingType enum, which is an enum of all setting types. We also have an efficient way to get the enum (and its NMMetaSettingInfo) from an NMSetting, setting-name and GType. No longer maintain the vtable for keyfile by "setting-name". Instead, index it by NMMetaSettingType enum. That way, we get efficient lookup, and don't need to duplicate the functionality of finding the vtable entry for a setting.
| * shared: use binary search in nm_meta_setting_infos_by_name()Thomas Haller2018-08-102-12/+47
| | | | | | | | | | | | | | nm_meta_setting_infos_by_name() did a naive search by name by iterating over all 42 setting types. Reorder nm_meta_setting_infos array, and use binary search instead.
| * libnm: use NMMetaSettingInfo for tracking setting priorityThomas Haller2018-08-1049-398/+344
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, each (non abstract) NMSetting class had to register its name and priority via _nm_register_setting(). Note, that libnm-core.la already links against "nm-meta-setting.c", which also redundantly keeps track of the settings name and gtype as well. Re-use NMMetaSettingInfo also in libnm-core.la, to track this meta data. The goal is to get rid of private data structures that track meta data about NMSetting classes. In this case, "registered_settings" hash. Instead, we should have one place where all this meta data is tracked. This was, it is also accessible as internal API, which can be useful (for keyfile). Note that NMSettingClass has some overlap with NMMetaSettingInfo. One difference is, that NMMetaSettingInfo is const, while NMSettingClass is only initialized during the class_init() method. Appart from that, it's mostly a matter of taste, whether we attach meta data to NMSettingClass, to NMMetaSettingInfo, or to a static-array indexed by NMMetaSettingType. Note, that previously, _nm_register_setting() was private API. That means, no user could subclass a functioning NMSetting instance. The same is still true: NMMetaSettingInfo is internal API and users cannot access it to create their own NMSetting subclasses. But that is almost desired. libnm is not designed, to be extensible via subclassing, nor is it clear why that would be a useful thing to do. One day, we should remove the NMSetting and NMSettingClass definitions from public headers. Their only use is subclassing the types, which however does not work. While libnm-core was linking already against nm-meta-setting.c, nm_meta_setting_infos was unreferenced. So, this change increases the binary size of libnm and NetworkManager (1032 bytes). Note however that roughly the same information was previously allocated at runtime.
| * cli: fix nmc_setting_get_valid_properties() to use setting metadataThomas Haller2018-08-101-18/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Not all properties that we want to handle in nmcli are actual GObject properties. For the moment that was the case, but that's about to change. This is a change in behavior with respect of the order in which properties are reported. For example, print_setting_description() now prints the property descriptions in a different order. However, one might argue that this order makes more sense because: - it's the same order as properties are listed in "nm-meta-setting-desc.c". At that place, we have explict control over the order and set it intentionally to suite our needs best. The order of the GObject properties is much less well defined. - the order from "nm-meta-setting-desc.c" is used at several other places. So, it makes sense to use the same order everywhere.
| * libnm/trivial: cleanup variable names in settings' class-init functionsThomas Haller2018-08-1044-363/+315
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Don't use @parent_class name. This local variable (and @object_class) is the class instance up-cast to the pointer types of the parents. The point here is not that it is the direct parent. The point is, that it's the NMSettingClass type. Also, it can only be used inconsistently, in face of NMSettingIP4Config, who's parent type is NMSettingIPConfig. Clearly, inside nm-setting-ip4-config.c we wouldn't want to use the "parent_class" name. Consistently rename @parent_class to @setting_class. - Also rename the pointer to the own class to @klass. "setting_class" is also the wrong name for that, because the right name would be something like "setting_6lowpan_class". However, "klass" is preferred over the latter, because we commonly create new GObject implementations by copying an existing one. Generic names like "klass" and "self" inside a type implementation make that simpler. - drop useless comments like /* virtual functions */ /* Properties */ It's better to logically and visually structure the code, and avoid trival remarks about that. They only end up being used inconsistently. If you even need a stronger visual separator, then an 80 char /****/ line should be preferred.
| * libnm-core/trivial: move codeThomas Haller2018-08-101-36/+38
| |
| * libnm: minor rework checking property flags in _nm_setting_to_dbus()Thomas Haller2018-08-101-15/+18
| | | | | | | | | | | | | | | | Properties that are backed by a GObject property are fundamentally different. I think it's clearer to rework the check, to first check whether we have a param_spec, and then implement different checks.
| * libnm: use nm_utils_hash_table_equal() in nm-setting-userThomas Haller2018-08-101-25/+2
| |
| * shared: move nm_utils_ptrarray_find_binary_search() to shared utilsThomas Haller2018-08-106-98/+100
| |
| * shared: move nm_utils_array_find_binary_search() to shared utilsThomas Haller2018-08-108-60/+99
| |
| * shared: add nm_utils_hash_table_equal() utilThomas Haller2018-08-102-0/+69
| | | | | | | | | | Add utility function to compare the content of two hash tables for equality.
| * cli: drop NMCTriStateValue for NMTernaryThomas Haller2018-08-103-16/+10
| |
| * ifcfg-rh: refactor parsing in parse_ethtool_option() to not call helper ↵Thomas Haller2018-08-101-125/+110
| | | | | | | | | | | | | | | | | | | | | | | | functions Parsing can be complicated enough. It's simpler to just work top-to-bottom, without calling various helper functions. This was, you can see all the code in one place, without need to jump to the helper function to see what it is doing. In general, a static function that is only called once, does sometimes not simplify but obfuscate the code.
| * ifcfg-rh: always reset ETHTOOL_WAKE_ON_LAN valueThomas Haller2018-08-101-5/+7
| | | | | | | | | | We must always set all variables, because othewise a previously set value might be merged into the new setting.
| * ifcfg-rh: split setting ETHTOOL_OPTS from write_wired_setting()Thomas Haller2018-08-103-12/+27
| | | | | | | | | | Will be used later, because we will not only have ethtool options in conjunction with wired settings.
| * ifcfg-rh: cleanup write_wired_setting()Thomas Haller2018-08-101-44/+42
| | | | | | | | | | Drop some local variables, or move them inside a nested scope, closer to where they are used.
| * ifcfg-rh/tests: regenerate .cexpected files with NM_TEST_REGENERATE=1Thomas Haller2018-08-101-1/+2
| | | | | | | | | | | | | | | | The tests already honored the environment variable $NMTST_IFCFG_RH_UPDATE_EXPECTED to indicate that the .cexpected files should be written by the tests. However, in the meantime, we instead use NM_TEST_REGENERATE=1 at various places for this purpose. Honor that flag as well.
| * keyfile: fix asserting for absolute base-dir in nm_keyfile_read()Thomas Haller2018-08-101-1/+1
| |
| * build/meson: fix naming of shared_nm_meta_setting_c variableThomas Haller2018-08-103-3/+3
| |
| * platform/tests: increase wait timeout in test_cleanup_internal()Thomas Haller2018-08-101-1/+1
|/ | | | | Seems this assertion still can fail. Dunno, maybe the timeout was just too short. Increase it.
* cli: remove assertion in nmc_device_state_to_color()Beniamino Galvani2018-08-101-1/+1
| | | | | | | | | | nmcli should not fail when the state device state is > ACTIVATED. Just return an unknown color code like we used to do, and like we do for connections. Fixes: 31aa2cfe29beb1bb7371ff36dbbd8baebeeaa06e https://bugzilla.gnome.org/show_bug.cgi?id=796834
* checkpatch.pl: complain about space in elvis operator ?:Thomas Haller2018-08-091-0/+1
|