summaryrefslogtreecommitdiff
path: root/libnm
Commit message (Collapse)AuthorAgeFilesLines
* libnm: add nm_client_reload()Beniamino Galvani2019-09-175-0/+162
| | | | | Introduce libnm API to reload NM configuration through the Reload() D-Bus method.
* libnm: export reload flagsBeniamino Galvani2019-09-171-0/+1
| | | | | Flags to the manager Reload() method are stable API but not exposed in a public header. Export them.
* libnm: Add missing autoptr macros for classesRobert Ancell2019-09-131-0/+40
| | | | https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/270
* setting-gsm: add auto-config propertyLubomir Rintel2019-09-111-0/+5
| | | | | | | | | | This will make NetworkManager look up APN, username, and password in the Mobile Broadband Provider database. It is mutually exclusive with the apn, username and password properties. If that is the case, the connection will be normalized to auto-config=false. This makes it convenient for the user to turn off the automatism by just setting the apn.
* all: SPDX header conversionLubomir Rintel2019-09-10115-1689/+115
| | | | | $ find * -type f |xargs perl contrib/scripts/spdx.pl $ git rm contrib/scripts/spdx.pl
* libnm/remote-connection: add a pair of curly bracketsLubomir Rintel2019-09-021-2/+2
| | | | ...to aid readability.
* wifi: drop support for wpa-none key-mgmtBeniamino Galvani2019-08-261-2/+1
| | | | | | | | NM didn't support wpa-none for years because kernel drivers used to be broken. Note that it wasn't even possible to *add* a connection with wpa-none because it was rejected in nm_settings_add_connection_dbus(). Given that wpa-none is also deprecated in wpa_supplicant and is considered insecure, drop altogether any reference to it.
* build: fix meson warning about invalid 'depends' keywordBeniamino Galvani2019-08-051-1/+1
| | | | | | | | Fix this: libnm/meson.build:215: WARNING: Passed invalid keyword argument "depends". WARNING: This will become a hard error in the future.
* wireguard: support configuring policy routing to avoid routing loopsThomas Haller2019-07-291-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For WireGuard (like for all IP-tunnels and IP-based VPNs), the IP addresses of the peers must be reached outside the tunnel/VPN itself. For VPN connections, NetworkManager usually adds a direct /32 route to the external VPN gateway to the underlying device. For WireGuard that is not done, because injecting a route to another device is ugly and error prone. Worse: WireGuard with automatic roaming and multiple peers makes this more complicated. This is commonly a problem when setting the default-route via the VPN, but there are also other subtle setups where special care must be taken to prevent such routing loops. WireGuard's wg-quick provides a simple, automatic solution by adding two policy routing rules and relying on the WireGuard packets having a fwmark set (see [1]). Let's also do that. Add new properties "wireguard.ip4-auto-default-route" and "wireguard.ip6-auto-default-route" to enable/disable this. Note that the default value lets NetworkManager automatically choose whether to enable it (depending on whether there are any peers that have a default route). This means, common scenarios should now work well without additional configuration. Note that this is also a change in behavior and upon package upgrade NetworkManager may start adding policy routes (if there are peers that have a default-route). This is a change in behavior, as the user already clearly had this setup working and configured some working solution already. The new automatism picks the rule priority automatically and adds the default-route to the routing table that has the same number as the fwmark. If any of this is unsuitable, then the user is free to disable this automatism. Note that since 1.18.0 NetworkManager supports policy routing (*). That means, what this automatism does can be also achieved via explicit configuration of the profile, which gives the user more flexibility to adjust all parameters explicitly). (*) but only since 1.20.0 NetworkManager supports the "suppress_prefixlength" rule attribute, which makes it impossible to configure exactly this rule-based solution with 1.18.0 NetworkManager. [1] https://www.wireguard.com/netns/#improved-rule-based-routing
* core,libnm: add AddConnection2() D-Bus API to block autoconnect from the startThomas Haller2019-07-255-125/+348
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It should be possible to add a profile with autoconnect blocked form the start. Update2() has a %NM_SETTINGS_UPDATE2_FLAG_BLOCK_AUTOCONNECT flag to block autoconnect, and so we need something similar when adding a connection. As the existing AddConnection() and AddConnectionUnsaved() API is not extensible, add AddConnection2() that has flags and room for additional arguments. Then add and implement the new flag %NM_SETTINGS_ADD_CONNECTION2_FLAG_BLOCK_AUTOCONNECT for AddConnection2(). Note that libnm's nm_client_add_connection2() API can completely replace the existing nm_client_add_connection_async() call. In particular, it will automatically prefer to call the D-Bus methods AddConnection() and AddConnectionUnsaved(), in order to work with server versions older than 1.20. The purpose of this is that when upgrading the package, the running NetworkManager might still be older than the installed libnm. Anyway, so since nm_client_add_connection2_finish() also has a result output, the caller needs to decide whether he cares about that result. Hence it has an argument ignore_out_result, which allows to fallback to the old API. One might argue that a caller who doesn't care about the output results while still wanting to be backward compatible, should itself choose to call nm_client_add_connection_async() or nm_client_add_connection2(). But instead, it's more convenient if the new function can fully replace the old one, so that the caller does not need to switch which start/finish method to call. https://bugzilla.redhat.com/show_bug.cgi?id=1677068
* libnm,core: Add ConnectivityCheckUri property and accessorsIain Lane2019-07-225-0/+34
| | | | | | | So that applications like GNOME Shell can hit the same URI to show the captive portal login page. https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/209
* device: free temporary typename with iface variableMarco Trevisan (TreviƱo)2019-07-221-3/+4
| | | | | | | | | | | | To create a disambiguated name for some Bluetooth devices we use its type name with iface, however this value is allocated but never free'd when passed to g_strdup_printf. So use instead a temporary variable and free it once done. https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/208 Fixes: 8bbda5cdff0f7f04d3b5863edfdba335dab4c7f8
* libnm,core: add support for "suppress_prefixlength" rule attributeThomas Haller2019-07-161-0/+2
| | | | | | | | | | | | | | | WireGuard's wq-quick configures such rules to avoid routing loops. While we currently don't have an automatic solution for this, at least we should support it via explicit user configuration. One problem is that suppress_prefixlength is relatively new and kernel might not support this attribute. That can lead to odd results, because the NetworkManager is valid but it cannot be configured on the current kernel. But this is a general problem, and we would require a general solution. The solution cannot be to only support rule attributes that are supported by the oldest possible kernel. It's not clear how much of a problem there really is, or which general solution is required (if any).
* libnm,cli,ifcfg-rh: add connection:wait-device-timeout propertyThomas Haller2019-07-101-0/+1
| | | | | | | | | | | | | | | | | Initscripts already honor the DEVTIMEOUT variable (rh #1171917). Don't make this a property only supported by initscripts. Every useful property should also be supported by keyfile and it should be accessible via D-Bus. Also, I will soon drop NMSIfcfgConnection, so handling this would require extra code. It's easier when DEVTIMEOUT is a regular property of the connection profile. The property is not yet implemented. ifcfg-rh still uses the old implementation, and keyfile is not yet adjusted. Since both keyfile and ifcfg-rh will both be rewritten soon, this property will be implemented then.
* libnm-core: add ovs-dpdk settingLubomir Rintel2019-06-142-0/+4
|
* libnm: belatedly expose nm_ethtool_optname_is_feature() in libnmThomas Haller2019-06-111-0/+4
| | | | | | | | Also, plan right away to backport this symbol all the way back to 1.14.8. As such, we only need to add it once, with the right linker version "libnm_1_14_8". But still, the symbols first appears on a major release 1.20.0.
* libnm: add nm_setting_ethtool_get_optnames() functionThomas Haller2019-06-111-0/+1
| | | | | | | | | | | | | It's rather limiting if we have no API to ask NMSettingEthtool which options are set. Note that currently NMSettingEthtool only supports offload features. In the future, it should also support other options like coalesce or ring options. Hence, this returns all option names, not only features. If a caller needs to know whether the name is an option name, he/she should call nm_ethtool_optname_is_feature().
* all: drop vim file variables from source filesThomas Haller2019-06-111-1/+0
| | | | sed '1,3 { /^\(#\|--\) *vim:/d }; 1 { /^\/\* *vim:.*\*\/$/ d}' -i $(git grep -l 'vim:')
* all: drop emacs file variables from source filesThomas Haller2019-06-1198-98/+0
| | | | | | | | | | | | | | | | | | | | | | We no longer add these. If you use Emacs, configure it yourself. Also, due to our "smart-tab" usage the editor anyway does a subpar job handling our tabs. However, on the upside every user can choose whatever tab-width he/she prefers. If "smart-tabs" are used properly (like we do), every tab-width will work. No manual changes, just ran commands: F=($(git grep -l -e '-\*-')) sed '1 { /\/\* *-\*- *[mM]ode.*\*\/$/d }' -i "${F[@]}" sed '1,4 { /^\(#\|--\|dnl\) *-\*- [mM]ode/d }' -i "${F[@]}" Check remaining lines with: git grep -e '-\*-' The ultimate purpose of this is to cleanup our files and eventually use SPDX license identifiers. For that, first get rid of the boilerplate lines.
* libnm/modem: add APN getterlr/modem-propertiesLubomir Rintel2019-06-053-0/+41
|
* libnm/modem: add network id getterLubomir Rintel2019-06-053-0/+42
|
* libnm/modem: add device id getterLubomir Rintel2019-06-053-0/+59
|
* libnm: rework team handling of JSON configThomas Haller2019-05-231-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Completely refactor the team/JSON handling in libnm's NMSettingTeam and NMSettingTeamPort. - team handling was added as rh#1398925. The goal is to have a more convenient way to set properties than constructing JSON. This requires libnm to implement the hard task of parsing JSON (and exposing well-understood properties) and generating JSON (based on these "artificial" properties). But not only libnm. In particular nmcli and the D-Bus API must make this "simpler" API accessible. - since NMSettingTeam and NMSettingTeamPort are conceptually the same, add "libnm-core/nm-team-utils.h" and NMTeamSetting that tries to handle the similar code side-by-sdie. The setting classes now just delegate for everything to NMTeamSetting. - Previously, there was a very fuzzy understanding of the provided JSON config. Tighten that up, when setting a JSON config it regenerates/parses all other properties and tries to make the best of it. When modifying any abstraction property, the entire JSON config gets regenerated. In particular, don't try to merge existing JSON config with the new fields. If the user uses the abstraction API, then the entire JSON gets replaced. For example note that nm_setting_team_add_link_watcher() would not be reflected in the JSON config (a bug). That only accidentally worked because client would serializing the changed link watcher to GVariant/D-Bus, then NetworkManager would set it via g_object_set(), which would renerate the JSON, and finally persist it to disk. But as far as libnm is concerned, nm_setting_team_add_link_watcher() would bring the settings instance in an inconsistent state where JSON and the link watcher property disagree. Setting any property must immediately update both the JSON and the abstraction API. - when constucting a team setting from D-Bus, we would previously parse both "config" and abstraction properties. That is wrong. Since our settings plugins only support JSON, all information must be present in the JSON config anyway. So, when "config" is present, only the JSON must be parsed. In the best case, the other information is redudant and contributes nothing. In the worse case, they information differs (which might happen if the client version differs from the server version). As the settings plugin only supports JSON, it's wrong to consider redundant, differing information from D-Bus. - we now only convert string to JSON or back when needed. Previously, setting a property resulted in parsing several JSON multiple times (per property). All operations should now scale well and be reasonably efficient. - also the property-changed signals are now handled correctly. Since NMTeamSetting knows the current state of all attributes, it can emit the exact property changed signals for what changed. - we no longer use libjansson to generate the JSON. JSON is supposed to be a machine readable exchange format, hence a major goal is to be easily handled by applications. While parsing JSON is not so trivial, writing a well-known set of values to JSON is. The advantage is that when you build libnm without libjansson support, then we still can convert the artificial properties to JSON. - Requiring libjansson in libnm is a burden, because most of the time it is not needed (as most users don't create team configurations). With this change we only require it to parse the team settings (no longer to write them). It should be reasonably simple to use a more minimalistic JSON parser that is sufficient for us, so that we can get rid of the libjansson dependency (for libnm). This also avoids the pain that we have due to the symbol collision of libjansson and libjson-glib. https://bugzilla.redhat.com/show_bug.cgi?id=1691619
* build/meson: introduce libnm/liblibnm.la as static library for libnm/libnm.laThomas Haller2019-05-222-31/+49
| | | | Same as done for autotools.
* libnm/tests: rename libnm's "test-general" to "test-libnm"Thomas Haller2019-05-192-3/+3
|
* all: use nm_clear_g_dbus_connection_signal() helperThomas Haller2019-05-121-5/+2
| | | | | | | | | I also like this because it's non-obvious that subscription IDs from GDBusConnection are "guint" (contrary to signal handler IDs which are "gulong"). So, by using this API you get a compiler error when using the wrong type. In the past, when switching to nm_clear_g_signal_handler() this uncovered multiple bugs where the wrong type was used to hold the ID.
* all: use nm_dbus_connection_signal_subscribe_name_owner_changed()Thomas Haller2019-05-121-10/+6
| | | | ... and nm_dbus_connection_call_get_name_owner().
* build/meson: rename "nm_core_dep" to "libnm_core_dep"Thomas Haller2019-04-182-4/+4
| | | | | The library is called "libnm_core". So the dependency should be called "libnm_core_dep", like in all other cases.
* shared: build helper "libnm-libnm-core-{intern|aux}.la" library for libnm-coreThomas Haller2019-04-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "libnm-core" implements common functionality for "NetworkManager" and "libnm". Note that clients like "nmcli" cannot access the internal API provided by "libnm-core". So, if nmcli wants to do something that is also done by "libnm-core", , "libnm", or "NetworkManager", the code would have to be duplicated. Instead, such code can be in "libnm-libnm-core-{intern|aux}.la". Note that: 0) "libnm-libnm-core-intern.la" is used by libnm-core itsself. On the other hand, "libnm-libnm-core-aux.la" is not used by libnm-core, but provides utilities on top of it. 1) they both extend "libnm-core" with utlities that are not public API of libnm itself. Maybe part of the code should one day become public API of libnm. On the other hand, this is code for which we may not want to commit to a stable interface or which we don't want to provide as part of the API. 2) "libnm-libnm-core-intern.la" is statically linked by "libnm-core" and thus directly available to "libnm" and "NetworkManager". On the other hand, "libnm-libnm-core-aux.la" may be used by "libnm" and "NetworkManager". Both libraries may be statically linked by libnm clients (like nmcli). 3) it must only use glib, libnm-glib-aux.la, and the public API of libnm-core. This is important: it must not use "libnm-core/nm-core-internal.h" nor "libnm-core/nm-utils-private.h" so the static library is usable by nmcli which couldn't access these. Note that "shared/nm-meta-setting.c" is an entirely different case, because it behaves differently depending on whether linking against "libnm-core" or the client programs. As such, this file must be compiled twice.
* shared: move "nm-dbus-compat.h" header to "nm-std-aux/nm-dbus-compat.h"Thomas Haller2019-04-181-1/+1
|
* shared: move most of "shared/nm-utils" to "shared/nm-glib-aux"Thomas Haller2019-04-182-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | From the files under "shared/nm-utils" we build an internal library that provides glib-based helper utilities. Move the files of that basic library to a new subdirectory "shared/nm-glib-aux" and rename the helper library "libnm-core-base.la" to "libnm-glib-aux.la". Reasons: - the name "utils" is overused in our code-base. Everything's an "utils". Give this thing a more distinct name. - there were additional files under "shared/nm-utils", which are not part of this internal library "libnm-utils-base.la". All the files that are part of this library should be together in the same directory, but files that are not, should not be there. - the new name should better convey what this library is and what is isn't: it's a set of utilities and helper functions that extend glib with funcitonality that we commonly need. There are still some files left under "shared/nm-utils". They have less a unifying propose to be in their own directory, so I leave them there for now. But at least they are separate from "shared/nm-glib-aux", which has a very clear purpose.
* shared: move udev helper to separate directory "shared/nm-udev-aux"Thomas Haller2019-04-181-1/+1
| | | | | | | | We built (among others) two libraries from the sources in "shared/nm-utils": "libnm-utils-base.la" and "libnm-utils-udev.la". It's confusing. Instead use directories so there is a direct correspondence between these internal libraries and the source files.
* all: support bridge vlan rangesBeniamino Galvani2019-04-181-1/+1
| | | | | | | | | | | | In some cases it is convenient to specify ranges of bridge vlans, as already supported by iproute2 and natively by kernel. With this commit it becomes possible to add a range in this way: nmcli connection modify eth0-slave +bridge-port.vlans "100-200 untagged" vlan ranges can't be PVIDs because only one PVID vlan can exist. https://bugzilla.redhat.com/show_bug.cgi?id=1652910
* all: goodbye libnm-glibLubomir Rintel2019-04-166-143/+0
| | | | | | | | | | | | | | | | | | | | | | | This removes libnm-glib, libnm-glib-vpn, and libnm-util for good. The it has been replaced with libnm since NetworkManager 1.0, disabled by default since 1.12 and no up-to-date distributions ship it for years now. Removing the libraries allows us to: * Remove the horrible hacks that were in place to deal with accidental use of both the new and old library in a single process. * Relief the translators of maintenance burden of similar yet different strings. * Get rid of known bad code without chances of ever getting fixed (libnm-glib/nm-object.c and libnm-glib/nm-object-cache.c) * Generally lower the footprint of the releases and our workspace If there are some really really legacy users; they can just build libnm-glib and friends from the NetworkManager-1.16 distribution. The D-Bus API is stable and old libnm-glib will keep working forever. https://github.com/NetworkManager/NetworkManager/pull/308
* core/qdisc: add support for attributesLubomir Rintel2019-04-121-0/+3
|
* Revert "all: goodbye libnm-glib"Lubomir Rintel2019-04-036-0/+143
| | | | | | We need this for a little little longer :( This reverts commit 1de8383ad9fdfc8f552117e5d109bdfa7005634b.
* libnm: add API to NMSettingIPConfig for routing rulesThomas Haller2019-03-271-0/+5
|
* libnm: add NMIPRoutingRule APIThomas Haller2019-03-271-1/+45
| | | | | | | | | | | | Add NMIPRoutingRule API with a few basic rule properties. More properties will be added later as we want to support them. Also, add to/from functions for string/GVariant representations. These will be needed to persist/load/exchange rules. The to-string format follows the `ip rule add` syntax, with the aim to be partially compatible. Full compatibility is not possible though, for various reasons (see code comment).
* libnm/lldp: cleanup asserting for valid NMLldpNeighbor agumentbg/lldp-enh-rh1652211Thomas Haller2019-03-271-12/+19
| | | | | | | | | At a few places we checked whether neighbor->attrs was non-NULL. That is not necessary, unless we'd like to catch some dangling/invalid pointers. The attrs hash is always set otherwise. Instead of just dropping the check, add a NM_IS_LLDP_NEIGHBOR() macro (inline function).
* libnm/lldp: fix leak and bug in nm_lldp_neighbor_dup()Thomas Haller2019-03-271-1/+7
| | | | | | | | | | | For one, just reassigning copy->attrs leaks the previous hash table. Fix that. Also, NMLldpNeighbor instances are not immutable. I think that is an uglyness, and it would be preferable that they can be sealed. A sealed object could safely share/ref the internal hash-table. However, as it is, we cannot just have two NMLldpNeighbor instances share the same hash-table. Do a full copy.
* libnm: add nm_lldp_neighbor_get_attr_value()Beniamino Galvani2019-03-273-0/+24
| | | | | The function provides access to the GVariant representing a LLDP attribute.
* libnm: make attribute name const in LLDP API functionsBeniamino Galvani2019-03-272-6/+6
| | | | | | Add the const qualifier to the attribute name in LLDP API functions so that const strings and string literals are accepted. This change is backwards compatible for existing users of the API.
* libnm-core: add bridge vlan conversion utilsBeniamino Galvani2019-03-261-0/+2
|
* libnm-core: add vlans property to bridge settingBeniamino Galvani2019-03-261-0/+6
|
* libnm-core: add vlans property to bridge-port settingBeniamino Galvani2019-03-261-0/+19
|
* all: add vlan-filtering and vlan-default-pvid bridge propertiesBeniamino Galvani2019-03-261-0/+6
|
* libnm: don't use strlen() for checking for non-empty stringThomas Haller2019-03-251-2/+1
| | | | | | It's well understood that these are NUL terminated strings. We don't need strlen() to check that the strings aren't empty.
* all: goodbye libnm-glibLubomir Rintel2019-03-196-143/+0
| | | | | | | | | | | | | | | | | | | | | | | This removes libnm-glib, libnm-glib-vpn, and libnm-util for good. The it has been replaced with libnm since NetworkManager 1.0, disabled by default since 1.12 and no up-to-date distributions ship it for years now. Removing the libraries allows us to: * Remove the horrible hacks that were in place to deal with accidental use of both the new and old library in a single process. * Relief the translators of maintenance burden of similar yet different strings. * Get rid of known bad code without chances of ever getting fixed (libnm-glib/nm-object.c and libnm-glib/nm-object-cache.c) * Generally lower the footprint of the releases and our workspace If there are some really really legacy users; they can just build libnm-glib and friends from the NetworkManager-1.16 distribution. The D-Bus API is stable and old libnm-glib will keep working forever. https://github.com/NetworkManager/NetworkManager/pull/308
* libnm: fix dns-configuration property typeBeniamino Galvani2019-03-151-8/+3
| | | | | | | Fixes: a8d600525643 ('libnm: implement support for DNS manager properties') https://bugzilla.redhat.com/show_bug.cgi?id=1689055 (cherry picked from commit d867837d05a808ff90756a41a96f778846522465)
* all: codespell fixesLubomir Rintel2019-03-111-1/+1
| | | | | | | Codespel run with the same arguments as described in commit 58510ed56679 ('docs: misc. typos pt2'). (cherry picked from commit bf0c4e6ac2855088e3962693886bb6ab71856f7b)