summaryrefslogtreecommitdiff
path: root/shared
Commit message (Collapse)AuthorAgeFilesLines
* shared: add nmtst_auto_unlinkfile cleanup macroThomas Haller2016-11-091-0/+42
|
* shared: add nmtst_file_get_contents()Thomas Haller2016-11-091-0/+14
|
* shared: add NM_STRCHAR_ALL() and NM_STRCHAR_ANY() macrosThomas Haller2016-11-091-0/+46
|
* shared: minor cleanup in _nm_utils_ascii_str_to_int64() using const pointerThomas Haller2016-11-021-2/+2
|
* shared: add nm_assert_se() macroThomas Haller2016-10-281-0/+2
| | | | | | | | We usually don't build NM with g_assert() disabled (G_DISABLE_ASSERT). But even if we would, there is no assertion macro that always evaluates the condition for possible side effects. I think that is a useful thing to have.
* shared: make nm_str_not_empty() inline function instead of macroThomas Haller2016-10-241-7/+5
| | | | | | | | | | | | | | | | | | | | | | It was a macro to pass on the non-const-ness of the argument, but that just doesn't make sense. That is a signature char *nm_str_not_empty (char *) does not make sense, because you cannot transfer ownership conditionally without additional checks to avoid a leak. Which makes this form is pointless. For example: char * foo (void) { char *s; s = _create_value (); return nm_str_not_empty (s); /* leaks "" */ }
* shared: add unaligned.hBeniamino Galvani2016-10-141-0/+129
| | | | | The file, imported from systemd sources, contains macros for accessing potentially unaligned data in a safe way (i.e. byte-wise).
* build: merge shared/Makefile.am into parent Makefile.amThomas Haller2016-10-131-21/+0
|
* shared: re-define _G_BOOLEAN_EXPR() to allow nesting g_assert()Thomas Haller2016-10-111-0/+27
| | | | | | | | | | | | | g_assert() uses G_LIKELY(), which in turn uses _G_BOOLEAN_EXPR(). As glib's version of _G_BOOLEAN_EXPR() uses a local variable _g_boolean_var_, we cannot nest a G_LIKELY() inside a G_LIKELY(), or inside a g_assert(), or a g_assert() inside a g_assert(). Workaround that, by redefining the macro. I already encountered this problem before, when having a nm_assert() inside a ({...}) block, inside a g_assert(). Then I just avoided that combination, but this situation is quite easy to encounter.
* shared: add NM_DECIMAL_STR_MAX() macroThomas Haller2016-10-111-0/+14
|
* shared: assert against buffer length in nm_sprintf_buf()Thomas Haller2016-10-111-4/+8
|
* shared: add NMTST_UUID_INIT() macroThomas Haller2016-10-051-0/+4
|
* shared: add nm_clear_g_free()Thomas Haller2016-10-031-0/+21
|
* all: modify line separator comments to be 80 chars wideThomas Haller2016-10-034-19/+19
| | | | sed 's#^/\*\{5\}\*\+/$#/*****************************************************************************/#' $(git grep -l '\*\{5\}' | grep '\.[hc]$') -i
* shared: add test for NM_SET_OUT()Thomas Haller2016-09-261-0/+5
|
* core: add _nm_utils_array_find_binary_search()Thomas Haller2016-09-231-0/+13
| | | | Also add nm_cmp_uint32_p_with_data(). Will be used later.
* macros: simplify NM_IN_SET() and NM_IN_STRSET() macrosThomas Haller2016-09-221-78/+36
| | | | and support up to 16 arguments.
* shared: add nm_utils_syslog_coerce_from_nm() utilThomas Haller2016-09-191-0/+32
| | | | | | | | When a VPN plugin logs to syslog(), it should not use the syslog levels that were passed in by NetworkManager directly. Instead, it must map LOG_NOTICE to LOG_INFO and LOG_INFO to LOG_DEBUG. Add a utility function does gets that right.
* build: disable type checks in G_TYPE_CHECK_INSTANCE_CAST() macros (bgo#771120)Thomas Haller2016-09-121-4/+57
| | | | | | | Avoid the pointless overhead. Even glib disables them unless you build with --enable-debug. https://bugzilla.gnome.org/show_bug.cgi?id=771120
* shared: add _NM_GET_PRIVATE() macroThomas Haller2016-09-081-0/+18
|
* shared: add NM_MIN()/NM_MAX() macros to replace glib's MIN()/MAX()Thomas Haller2016-09-081-0/+44
|
* shared: add helper macros nm_str_not_empty() and nm_strdup_not_empty()Thomas Haller2016-09-061-0/+16
|
* release: bump version to 1.5.0 (development)1.5.0-devLubomir Rintel2016-08-171-2/+3
|
* auth: check when setting statistics refresh rateAlfonso Sanchez-Beato2016-08-171-0/+1
|
* checkpoint: use polkit to check permissionBeniamino Galvani2016-08-171-0/+1
|
* nm-glib.h: fix compatibility wrapper for g_variant_new_take_string()Thomas Haller2016-08-111-1/+10
| | | | | g_variant_new_from_bytes() is itself only available since 2.36, thus using it triggers a deprecation warning itself.
* nm-glib: add compatibility wrapper for g_variant_new_take_string()Thomas Haller2016-08-111-0/+23
|
* build: cleanup src/Makefile.amThomas Haller2016-08-113-1/+64
| | | | | | | | | | | | | - reorder entries in src/Makefile.am so that general names are all at the beginning (AM_CPPFLAGS, sbin_PROGRAMS) and the names for a certain library/binary are grouped together - have libNetworkManager.la reuse libNetworkManagerBase.la. - let all components in src/Makefile.am use the same AM_CPPFLAGS, except libsystem-nm.la. - move callouts/nm-dispatcher-api.h to shared/ directory. It is obviously not internal API to callouts, and callouts is not a library. Thus, the right place is shared/.
* shared: add NM_VPN_PLUGIN_CONFIG_PROXY_PAC to "nm-vpn-plugin-macros.h" for ↵Thomas Haller2016-07-061-0/+4
| | | | | | | | | | | | | | | | VPN plugins Soon we will add proxy support where VPN plugins set a property NM_VPN_PLUGIN_CONFIG_PROXY_PAC. All a VPN plugin needs to make use of this new setting is the NM_VPN_PLUGIN_CONFIG_PROXY_PAC define. We don't want that older plugins (still compatible with libnm 1.2 API) require a new API only for this define. Define it instead in "shared/nm-utils/nm-vpn-plugin-macros.h" as fallback. https://mail.gnome.org/archives/networkmanager-list/2016-June/msg00154.html
* shared: add nm_strquote_a() helperThomas Haller2016-07-051-0/+29
|
* shared: drop function name from g_return_val_if_reached()Thomas Haller2016-07-051-0/+24
| | | | | | When using g_return_val_if_reached(), the default macro would include the function name. This name is increasing the binary size. Replace it in non-debug builds.
* vpn: support option to preserve previous routing information on VPN config ↵Thomas Haller2016-07-041-0/+14
| | | | | | | | | | | | | | update On openvpn restart, the VPN helper script is invoked without full routing information. Thus, the routes will be dropped because the helper script cannot provide them on update. Add an option "preserve-route" which tells NetworkManager to preserve and reuse the previous configuration. https://bugzilla.redhat.com/show_bug.cgi?id=1231338 https://bugzilla.gnome.org/show_bug.cgi?id=750873
* device: extend MAC address handling including randomization for ethernet and ↵Thomas Haller2016-06-301-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | wifi Extend the "ethernet.cloned-mac-address" and "wifi.cloned-mac-address" settings. Instead of specifying an explicit MAC address, the additional special values "permanent", "preserve", "random", "random-bia", "stable" and "stable-bia" are supported. "permanent" means to use the permanent hardware address. Previously that was the default if no explict cloned-mac-address was set. The default is thus still "permanent", but it can be overwritten by global configuration. "preserve" means not to configure the MAC address when activating the device. That was actually the default behavior before introducing MAC address handling with commit 1b49f941a69af910b0e68530be7339e8053068e5. "random" and "random-bia" use a randomized MAC address for each connection. "stable" and "stable-bia" use a generated, stable address based on some token. The "bia" suffix says to generate a burned-in address. The stable method by default uses as token the connection UUID, but the token can be explicitly choosen via "stable:<TOKEN>" and "stable-bia:<TOKEN>". On a D-Bus level, the "cloned-mac-address" is a bytestring and thus cannot express the new forms. It is replaced by the new "assigned-mac-address" field. For the GObject property, libnm's API, nmcli, keyfile, etc. the old name "cloned-mac-address" is still used. Deprecating the old field seems more complicated then just extending the use of the existing "cloned-mac-address" field, although the name doesn't match well with the extended meaning. There is some overlap with the "wifi.mac-address-randomization" setting. https://bugzilla.gnome.org/show_bug.cgi?id=705545 https://bugzilla.gnome.org/show_bug.cgi?id=708820 https://bugzilla.gnome.org/show_bug.cgi?id=758301
* dns: log DNS servers at TRACE levelBeniamino Galvani2016-06-281-0/+8
| | | | | | | Be more verbose at TRACE level and log the DNS servers associated to configurations. This will help to debug issues like [0]. [0] https://bugzilla.redhat.com/show_bug.cgi?id=1348887
* nm-glib: implement compatibility macro for g_strv_contains() differentlyThomas Haller2016-06-171-14/+7
| | | | | | Otherwise, deprecation warnings are not properly suppressed for g_return_if_fail (g_strv_contains (strv, str));
* nm-glib: remove G_GNUC_EXTENSIONThomas Haller2016-06-171-6/+6
| | | | | | | We use statement expressions all over the place without explicitly marking them. If that would be a problem, we'd have to change a *lot* of code. We simply require that as a mandatory feature from our compiler.
* shared: backport g_strv_contains()Lubomir Rintel2016-06-171-0/+30
|
* shared: add also "shared/nm-utils/nm-vpn-plugin-macros.h"Thomas Haller2016-06-162-0/+44
| | | | | It has the very similar purpose as "nm-utils/nm-vpn-plugin-utils.[ch]", except that is is header-only.
* tests: fix checking NM_ASSERT_NO_MSG define in "nm-test-utils.h"Thomas Haller2016-06-161-1/+1
| | | | | "nm-test-utils.h" may also be used by the VPN plugins, there we have no NM_ASSERT_NO_MSG define.
* shared: include "nm-glib.h" from "nm-macros-internal.h"Thomas Haller2016-06-162-2/+3
| | | | | "nm-glib.h" is our most basic header. "nm-macros-internal.h" extends on that. Thus, let "nm-macros-internal.h" include "nm-glib.h".
* shared: include "gsystem-local-alloc.h" from "nm-glib.h"Thomas Haller2016-06-163-2/+2
| | | | | | | | | "nm-glib.h" is the most basic header, the one we cannot do without. ("nm-default.h", is already more generic, the one which every common source file in NetworkManager repository should include). Let "gsystem-local-alloc.h" be included by "nm-glib.h" and nowhere else.
* shared: add "nm-utils/nm-vpn-plugin-utils.h"Thomas Haller2016-06-163-0/+174
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This file is only used by plugins and copied between them. It's purpose is to contain general utility functions that are only relevant for implementing NetworkManager's VPN plugins. In principle the utility functions could be part of libnm, however, there are a few problems with that: - if they are part of libnm, adding and using a new utility function requires the plugin to bump the required libnm version. Since you usally can work around/reimplement utility functions, this results in not using the API from libnm, not adding the API to libnm, and reimplementing it over and over in the plugin. - plugins compile both against libnm and libnm-glib. Thus, either the utility function would also be needed in libnm-glib, or again, it is not usable by the plugin. We must avoid that the utility functions diverge and no local modifications to these files should be made in the plugin. Instead, one special location of the utility functions shall be extended and re-imported (copied) to the plugin as needed. Add the files to NetworkManager's repository. Although they are not needed for NetworkManager itself, they are a different API provided by NetworkManager. An API that is reused and shared by copying the files around.
* shared: move shared files to subdirectory "shared/nm-utils/"Thomas Haller2016-06-1610-12/+13
| | | | | | | | | | | | | The "shared" directory contains files that are possibly used by all components of NetworkManager repository. Some of these files are even copied as-is to other projects (VPN plugins, nm-applet) and used there without modification. Move those files to a separate directory. By moving them to a common directory, it is clearer that they belong together. Also, you can easier compare the copied versions to their original via $ diff -r ./shared/nm-utils/ /path/to/nm-vpn-plugin/shared/nm-utils/
* libnm/vpn: add nm_vpn_editor_plugin_load_vt()Thomas Haller2016-06-152-1/+191
| | | | | | | | | | Let VPN plugins return a virtual function table to extend the API while bypassing libnm. This allows to add and use new functionality to VPN plugins without updating libnm. The actual definitions are in a header-only file "nm-vpn-editor-plugin-call.h", which can be copied to the caller/plugin.
* shared: add nm_strcmp_p() utils macroThomas Haller2016-06-151-0/+30
|
* build: remove assertion messages in non-debug buildThomas Haller2016-06-092-1/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | Assertions like g_assert*() and g_return_*() contain the stringified test expression. This string ends up in the binary and increases its size. We usually don't have failing assertions. These string are a waste, instead the file and line number shall suffice. It reduces the striped size of the NetworkManager binary from 2500k to 2392k, that is -108k, -4.3%. This changes - "g_assert (1 == 2);" from: NetworkManager:ERROR:source.c:347:some_function: assertion failed: (1 == 2) to: NetworkManager:ERROR:source.c:347:<unknown-fcn>: assertion failed: (<dropped>) - "g_return_if_fail (1 == 2);" from: (process:21024): NetworkManager-CRITICAL **: some_function: assertion '1 == 2' failed to: (process:21024): NetworkManager-CRITICAL **: ((source.c:347)): assertion '<dropped>' failed When doing a non-debug build, those string are now removed. Debug-builds can be enabled by setting --with-more-assert=$LEVEL to larger then zero. https://bugzilla.gnome.org/show_bug.cgi?id=767296
* tests: add macro NMTST_G_RETURN_MSG for expecting g_return*() failuresThomas Haller2016-06-091-0/+5
| | | | | | A failure to g_return*() by default prints a g_critical() with stringifing the condition. Add a macro NMTST_G_RETURN_MSG() that reproduces that line to more accurately match the failure message.
* macros: add macro _nm_printf() for function attributeThomas Haller2016-06-051-0/+1
|
* all: move NM_AUTH_PERMISSION_* defines to "nm-common-macros.h" headerThomas Haller2016-06-011-0/+16
|
* shared: add "nm-common-macros.h" headerThomas Haller2016-06-012-0/+28
| | | | | | | | | | | | | | | | | | | | | | | | | Shared headers are all project-wide and internal API. Currently we have the following: General purpose: - shared/gsystem-local-alloc.h: header-only, allocation macros - shared/nm-dbus-compat.h: header-only, D-Bus related defines - shared/nm-glib.h: header-only, glib compatibility defines - shared/nm-macros-internal.h: header-only, utils - shared/nm-shared-utils.[hc]: source and header, utils - shared/nm-test*.[hc]: source and header, libnm testing utils Special to NetworkManager repository: - shared/nm-version-macros.h.in: header-only, version macros - shared/nm-default.h: header-only, default-include Now we add "shared/nm-common-macros.h" which is header-only, but non general purpose. I am running low on good names, considering all the shared/core/macros utils headers. Still, I think "nm-common-macros.h" is appropriate.