summaryrefslogtreecommitdiff
path: root/libnm
Commit message (Collapse)AuthorAgeFilesLines
* 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)
* libnm: Fix reporting of unknown device typesBenjamin Berg2019-03-071-2/+2
| | | | | | | | | | | nm_device_get_device_type would report the device type as it was send on DBus, while fetching the property would mean that only a known device types is reported. Make both results consistent by coercing in nm_device_get_device_type rather than when setting the property. (cherry picked from commit a6a185ba00c6218d9b1ace6e3bd6b57347198246)
* core,wifi-p2p: Fix Wi-Fi P2P device typeBenjamin Berg2019-03-071-0/+3
| | | | | | | | | | The device type was set to the GType rather than a new value in the NMDeviceType enum. Add the corresponding enum entry, fix the device type and set the routing priority to the same value as generic devices. (cherry picked from commit 8d9365a973025976a15e5e7adb26a6f791957b7c)
* libnm: rename and expose nm_utils_base64secret_decode() in libnmThomas Haller2019-03-071-0/+1
| | | | | | | | | | | | | | | | | | | A NetworkManager client requires an API to validate and decode a base64 secret -- like it is used by WireGuard. If we don't have this as part of the API, it's inconvenient. Expose it. Rename it from _nm_utils_wireguard_decode_key(), to give it a more general name. Also, rename _nm_utils_wireguard_normalize_key() to nm_utils_base64secret_normalize(). But this one we keep as internal API. The user will care more about validating and decoding the base64 key. To convert the key back to base64, we don't need a public API in libnm. This is another ABI change since 1.16-rc1. (cherry picked from commit e46ba0186720bfe5e31dcad9a5001a415deb9ce6)
* nm: Fix syntax on introspection annotationsMarco Trevisan (TreviƱo)2019-03-072-3/+3
| | | | | | | | Various annotations were added using multiple colons, while only one has to be added or g-ir-introspect will consider them part of the description https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/94 (cherry picked from commit 73005fcf5b957a4cf7f8244da85ade0214db7606)
* wireguard: add "peer-routes" setting for WireGuard profilesThomas Haller2019-03-051-0/+1
| | | | | | | | This setting is not yet implemented. This adds new API for 1.16.0 and is an ABI break since 1.16-rc1. (cherry picked from commit d719ad31f096583c501af3bea01a01ffd72337d5)
* wireguard: add "mtu" setting for WireGuard profilesThomas Haller2019-03-051-0/+1
| | | | | | This adds new API for 1.16.0 and is an ABI break since 1.16-rc1. (cherry picked from commit d5e93ae613fd355351bdf37530cae3d3dfb4e5ba)
* libnm,core: fix device TYPE for Wi-Fi P2P devicesThomas Haller2019-02-262-0/+8
| | | | | | | | | | | | Don't use "wifip2p" for the type description. $ nmcli device DEVICE TYPE STATE CONNECTION wlan0 wifi connected x p2p-dev-wlan0 wifip2p disconnected -- https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/87 (cherry picked from commit 8f6a8d051731333d94da6f2c43c72a1fd9aed9ff)
* all/trivial: fix whitespace/indentationThomas Haller2019-02-221-3/+3
|
* libnm: add NMWireGuardPeer and libnm support for peersThomas Haller2019-02-221-0/+31
|
* libnm,cli: add NMSettingWireGuardThomas Haller2019-02-223-0/+8
| | | | | | | | | | | | | | For now only add the core settings, no peers' data. To support peers and the allowed-ips of the peers is more complicated and will be done later. It's more complicated because these are nested lists (allowed-ips) inside a list (peers). That is quite unusual and to conveniently support that in D-Bus API, in keyfile format, in libnm, and nmcli, is a effort. Also, it's further complicated by the fact that each peer has a secret (the preshared-key). Thus we probably need secret flags for each peer, which is a novelty as well (until now we require a fixed set of secrets per profile that is well known).
* libnm: fix leak in nm_client_add_and_activate_connection{2,_async}()Thomas Haller2019-02-222-7/+13
| | | | | | | | Detected via valgrind: $ ./tools/run-nm-test.sh -m -v libnm/tests/test-nm-client -p /libnm/active-connections Fixes: fbb038af5e5d675c994de26da676edfd8e73ffbe
* wifi-p2p: drop WiFi-P2P "group-owner" property from D-Bus API and libnmThomas Haller2019-02-213-45/+0
| | | | | | | | | It's not yet implemented server-side. Until it is clear that we need this property and until it is implemented, drop it again from public API. See-also: https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/80#note_118004
* Add polkit action for Wi-Fi scansJonathan Kang2019-02-212-1/+5
| | | | | | | | | | | | | | | | | | Previously, Wi-Fi scans uses polkit action "org.freedesktop.NetworkManager.network-control". This is introduced in commit 5e3e19d0. But in a system with restrict polkit rules, for example "org.freedesktop.NetworkManager.network-control" was set as auth_admin. When you open the network panel of GNOME Control Center, a polkit dialog will keep showing up asking for admin password, as GNOME Control Center scans the Wi-Fi list every 15 seconds. Fix that by adding a new polkit action "org.freedesktop.NetworkManager.wifi.scan" so that distributions can add specific rule to allow Wi-Fi scans. [thaller@redhat.com: fix macro in "shared/nm-common-macros.h"] https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/68
* Remove WFD IEs property from P2P deviceBenjamin Berg2019-02-211-34/+0
| | | | | | | While this can be considered a property of the P2P device, the API will require setting it through the settings when activating a connection. As such, having a (read only) property on the device is not very useful, so remove it again.
* core/setting-wifi-p2p: Add WFD IEs property to P2P settingsBenjamin Berg2019-02-211-0/+1
| | | | | | This is a protocol specific extension to Wi-Fi frames which need to be set in certain conditions. The P2P device will use this to update the corresponding wpa_supplicant property.
* libnm: fix leaking checkpoints from NMManagerThomas Haller2019-02-191-0/+2
| | | | Fixes: c3efedf54bc64fd130849096849540ed1294df55
* libnm: fix memleak for NMDeviceTun:hw-addressThomas Haller2019-02-191-0/+1
| | | | Fixes: 337304f19df43eaa6c76a7571094ccc9dc99a4c5
* libnm: fix duplicate free in nm_client_checkpoint_rollback()Thomas Haller2019-02-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | #0 0x00007fffea7481e5 in _g_log_abort (breakpoint=1) at gmessages.c:554 #1 0x00007fffea74951d in g_logv (log_domain=0x7fffea78e00e "GLib", log_level=G_LOG_LEVEL_CRITICAL, format=<optimized out>, args=args@entry=0x7fffffffcbb0) at gmessages.c:1371 #2 0x00007fffea7496f3 in g_log (log_domain=log_domain@entry=0x7fffea78e00e "GLib", log_level=log_level@entry=G_LOG_LEVEL_CRITICAL, format=format@entry=0x7fffea798320 "%s: assertion '%s' failed") at gmessages.c:1413 #3 0x00007fffea749f2d in g_return_if_fail_warning (log_domain=log_domain@entry=0x7fffea78e00e "GLib", pretty_function=pretty_function@entry=0x7fffea799d40 <__func__.4759> "g_atomic_ref_count_dec", expression=expression@entry=0x7fffea799ca1 "g_atomic_int_get (arc) > 0") at gmessages.c:2762 #4 0x00007fffea754c12 in g_atomic_ref_count_dec (arc=arc@entry=0x5555558c5280) at grefcount.c:260 #5 0x00007fffea7302c6 in g_hash_table_unref (hash_table=0x5555558c5240) at ghash.c:1101 #6 0x00007fffea4b6dbc in clear_op_res (simple=0x55555587ed90 [GSimpleAsyncResult]) at gsimpleasyncresult.c:248 #7 0x00007fffea4b6dbc in g_simple_async_result_finalize (object=0x55555587ed90 [GSimpleAsyncResult]) at gsimpleasyncresult.c:268 #8 0x00007fffea67b949 in g_object_unref (_object=<optimized out>) at gobject.c:3346 #9 0x00007fffea67b949 in g_object_unref (_object=0x55555587ed90) at gobject.c:3238 #10 0x00007fffe95dea2d in checkpoint_rollback_cb (object=<optimized out>, result=<optimized out>, user_data=0x55555587ed90) at libnm/nm-manager.c:1584 #11 0x00007fffea4ca834 in g_task_return_now (task=0x5555558b5c80 [GTask]) at gtask.c:1148 #12 0x00007fffea4cb196 in g_task_return (task=0x5555558b5c80 [GTask], type=<optimized out>) at gtask.c:1206 #13 0x00007fffea5096bb in reply_cb (connection=<optimized out>, res=<optimized out>, user_data=0x5555558b5c80) at gdbusproxy.c:2596 #14 0x00007fffea4ca834 in g_task_return_now (task=0x5555558b5d50 [GTask]) at gtask.c:1148 #15 0x00007fffea4cb196 in g_task_return (task=0x5555558b5d50 [GTask], type=<optimized out>) at gtask.c:1206 #16 0x00007fffea4fdd4a in g_dbus_connection_call_done (source=<optimized out>, result=0x5555558b5e20, user_data=0x5555558b5d50) at gdbusconnection.c:5715 #17 0x00007fffea4ca834 in g_task_return_now (task=0x5555558b5e20 [GTask]) at gtask.c:1148 #18 0x00007fffea4ca86d in complete_in_idle_cb (task=task@entry=0x5555558b5e20) at gtask.c:1162 #19 0x00007fffea73e97b in g_idle_dispatch (source=0x7fffdc04eb90, callback=0x7fffea4ca860 <complete_in_idle_cb>, user_data=0x5555558b5e20) at gmain.c:5620 #20 0x00007fffea74206d in g_main_dispatch (context=0x5555557c8410) at gmain.c:3182 #21 0x00007fffea74206d in g_main_context_dispatch (context=context@entry=0x5555557c8410) at gmain.c:3847 #22 0x00007fffea742438 in g_main_context_iterate (context=0x5555557c8410, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at gmain.c:3920 #23 0x00007fffea742762 in g_main_loop_run (loop=0x55555584ed00) at gmain.c:4116 Fixes: c3efedf54bc64fd130849096849540ed1294df55
* all: cache errno in local variable before using itThomas Haller2019-02-121-1/+0
|
* all: drop unnecessary includes of <errno.h> and <string.h>Thomas Haller2019-02-1249-105/+34
| | | | | "nm-macros-interal.h" already includes <errno.h> and <string.h>. No need to include it everywhere else too.
* build/meson: add dependency of libnm to libnm-coreThomas Haller2019-02-061-0/+2
| | | | | | | | We need to build libnm-core first. Especially, because libnm sources require the "libnm-core/nm-core-enum-types.h" header to be generated first. Add a missing dependency.
* build/meson: cleanup of libnm/meson.buildThomas Haller2019-02-062-17/+15
| | | | | | | | | | | "libnm/fake-typelib/meson.build" modifies the variable "sources", which is defined by the outer "libnm/meson.build" file. That is confusing. If a variable is not only used within one "meson.build" file alone, it should have a unique name. Rename the variable to "libnm_utils_sources". Also avoid local variable "deps" which is only used at one place.
* all: don't use "static inline" in source filesThomas Haller2019-02-061-1/+1
| | | | | | | | For static functions inside a module, the compiler determines on its own whether to inline the function. Also, "inline" was used at some places that don't immediatly look like candidates for inlining. It was most likely a copy&paste error.
* libnm: Add async start/stop routines for P2P find operationsBenjamin Berg2019-02-053-0/+169
| | | | | | | | | | | | These were dropped earlier as new sync API must not be the primary way of calling new routines in libnm. In this particular case the DBus calls are simple and unlikely to fail. Most users should use the normal async API and call the finish routine. However, if the API user is not interested in the result, then they can simply set the callback to NULL to ignore it. [thaller@redhat.com: added options argument to start-find method]
* build/meson: add intermediate shared/nm-utils base libraryThomas Haller2019-02-051-2/+2
| | | | | | | | | | Like also done for autotools, create and use intermediate libraries from "shared/nm-utils/". Also, replace "shared_dep" by "shared_nm_utils_base_dep". We don't need super fine-grained selection of what we link. We can always link in "shared/libnm-utils-base.a", and let the linker throw away unsed parts.
* libnm/secret-agent/trivial: rename internal init-data structureThomas Haller2019-02-051-9/+9
| | | | No "NM" prefix for internal structure.
* libnm/secret-agent: use cleanup attribute in NMSecretAgentOldPrivateThomas Haller2019-02-051-56/+49
| | | | Refactor memory handling to use cleanup attribute.
* libnm/secret-agent: reorder fields in NMSecretAgentOldPrivateThomas Haller2019-02-051-8/+9
| | | | And don't waste 4 bytes per boolean.
* libnm/secret-agent: use CList instead of GSList for tracking requestsThomas Haller2019-02-051-33/+34
| | | | | | | Always always when we want a linked list, CList is a better choice than GSList. It's more convenient to use and is more efficient. Also, use GSlice allocator for GetSecretRequest data.
* clients/secret-agent: fix cancel_get_secrets() implementationThomas Haller2019-02-051-8/+6
| | | | | | | | | | | | | | The callback must be invoked, as also documented. Otherwise, the tracked info gets leaked. Let NMSecretAgentOld (the caller) be a bit resilient against bugs in the client, and avoid a crash by prematurely remove the request-info from the pending list. That does not fully workaround the bug (it leads to a leak), but at least it does not cause other "severe" issues. The leak was present earlier as well.
* libnm/secret-agent: refactor GObject properties in NMSecretAgentOldThomas Haller2019-02-051-36/+31
| | | | | Use NM_GOBJECT_PROPERTIES_DEFINE() and _notify() and get rid of the extra tab for indentation.
* libnm/secret-agent: reorder codeThomas Haller2019-02-051-94/+104
|
* libnm/trival: fix indention in "libnm/nm-secret-agent-old.c"Thomas Haller2019-02-051-34/+34
|
* wifi-p2p: rename Wi-Fi P2PThomas Haller2019-02-018-292/+292
| | | | | After renaming the files, also rename all the content to follow the "Wi-Fi P2P" naming scheme.
* wifi-p2p: rename files for consistent Wi-Fi P2P namingThomas Haller2019-02-017-22/+22
| | | | | | | | | | | | | | | | | | | | | | | We named the types inconsistently: - "p2p-wireless" ("libnm-core/nm-setting-p2p-wireless.h") - "p2p" ("libnm/nm-p2p-peer.h") - "p2p-wifi" ("src/devices/wifi/nm-device-p2p-wifi.h") It seems to me, "libnm/nm-p2p-peer.h" should be qualified with a "Wi-Fi" specific name. It's not just peer-to-peer, it's Wi-Fi P2P. Yes, there is an inconsistency now, because there is already "libnm/nm-access-point.h". It seems to me (from looking at the internet), that the name "Wi-Fi P2P" is more common than "P2P Wi-Fi" -- although both are used. There is also the name "Wi-Fi Direct". But it's not clear which name should be preferred here, so stick to "Wi-Fi P2P". In this first commit only rename the files. The following commit will rename the content.
* libnm/device-p2p-wifi: drop API that still needs considerationThomas Haller2019-02-013-82/+0
| | | | | | | | | | | | | | | | | | | | Having synchronous API is wrong, or at least questionable. Granted, libnm isn't currently very good about the exact order of things to happen. However synchronous API by design delays events while waiting for the response and hence messes up the ordering. Maybe synchronous API should not be added to libnm. Or at least, if we have synchronous API, we certainly need an asynchrnous variant as well (which is still missing). As synchronous API is not preferred, it should also be named nm_some_thing_sync(), accompanied by nm_some_thing() and nm_some_thing_finish(). The name for the synchronous method should be the odd one and we shouldn't have an nm_some_thing_async(). Yes, libnm is not consistend about that. I am going to drop this API for the moment.
* libnm/device-p2p-wifi: drop unused codeThomas Haller2019-02-012-33/+0
| | | | If this is going to be implemented, revert the patch.
* libnm: various cleanup of NMP2PPeer and NMDeviceP2PWifiThomas Haller2019-02-014-234/+224
| | | | | | | | | | | | | | | | - fix leaking hw_address in finalize(). - reorder code. - avoid double tabs in GObject property definitions. - hide struct definitions from header. - don't use signal slots in class structure. - use NM_GOBJECT_PROPERTIES_DEFINE_BASE(). - add missing NM_AVAILABLE_IN_1_16 annotations.