| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
| |
and add NM_IN_SET*_TYPED() macros, which allow to explicitly select
the type of "x".
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
| |
_NM_GET_PRIVATE() macro is used to implement a standard private-getter, but it
requires that "self" is a pointer of either "const type *" or "type *". That
is great in most cases, but sometimes we have predominatly self pointers of
different type, so it would require a lot of casts.
Add a different form _NM_GET_PRIVATE_VOID() where self pointer can be any
non-const pointer and returns a non-const private pointer after casting.
|
| |
|
|
| |
Add utility functions to check the value of a route attribute.
|
| |
|
|
|
| |
Use a consistent order of "static inline". This seems the prefered
order in general, and we also use it more often already.
|
| |
|
|
|
|
|
|
| |
- simplify nm_strquote_a().
- use '"' for quoting instad of '\''.
- have nm_sprintf_bufa() evalute @n_elements only once.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
I think NM_CACHED_QUARK_FCN() is better because:
- the implementation is in our hand, meaning it is clear that
putting a "static" before NM_CACHED_QUARK_FCN() is guaranteed to
work -- without relying on G_DEFINE_QUARK() to be defined in a way
that this works (in fact, we currently never do that and instead
make all functions non-static).
- it does not construct function names by appending "_quark".
Thus you can grep for the entire function name and finding
the place where it is implemented.
- same with the stings, where the new macro doesn't stringify the
argument, which is less surpising. Again, now you can grep
for the string including the double quoting.
(yes, I really use grep to understand the source-code)
|
| |
|
|
|
|
|
|
|
|
|
|
| |
NM_CACHED_QUARK_FCN() is a replacement for G_DEFINE_QUARK().
G_DEFINE_QUARK() is mostly used to define GError quarks. As
such, it always appends _quark() to the function name, which
is unfavorable because it makes it harder to grep for the
definition of the function.
In general I think that macros that defined symbols by concatenating
something should be avoided because that makes it harder to locate
where the symbol was defined.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fix it by converting the macro to an inline function. It's anyway
nicer.
$ make src/src_libNetworkManagerBase_la-main-utils.lo
CC src/src_libNetworkManagerBase_la-main-utils.lo
In file included from ./shared/nm-utils/nm-macros-internal.h:29:0,
from ./shared/nm-default.h:178,
from src/main-utils.c:22:
src/main-utils.c: In function ‘nm_main_utils_setup_signals’:
./shared/nm-utils/nm-glib.h:144:36: error: comparison of unsigned expression >= 0 is always true [-Werror=type-limits]
&& glib_micro_version >= (micro))))
^
src/main-utils.c:82:6: note: in expansion of macro ‘nm_glib_check_version’
if (nm_glib_check_version (2, 36, 0)) {
^~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
Makefile:12312: recipe for target 'src/src_libNetworkManagerBase_la-main-utils.lo' failed
|
| |
|
|
|
| |
Make _nm_utils_strv_find_first() accessible outside of libnm-core
by copying it from "libnm-core/nm-core-internal.h" (and rename it).
|
| |
|
|
| |
(cherry picked from commit 7b84c73331ef5642e3717e2333865c70e2244def)
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
| |
Similar to systemd's PROTECT_ERRNO. The difference it, that it doesn't
treat the auto-variable as internal, so it is allowed to use it. E.g.
if (!(fd = open (...)) {
NM_AUTO_PROTECT_ERRNO (errno_saved);
printf ("error: %s", g_strerror (errno_saved));
return FALSE;
}
|
| |
|
|
|
|
|
|
| |
We already have gs_fd_close, which however doesn't preserve
errno and only checks for fd != -1. Add our own define.
Downside is, we have to include stdio.h and errno.h,
which effectively ends up to be included *everywhere*.
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 "" */
}
|
| |
|
|
|
| |
The file, imported from systemd sources, contains macros for accessing
potentially unaligned data in a safe way (i.e. byte-wise).
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
| |
sed 's#^/\*\{5\}\*\+/$#/*****************************************************************************/#' $(git grep -l '\*\{5\}' | grep '\.[hc]$') -i
|
| | |
|
| |
|
|
| |
Also add nm_cmp_uint32_p_with_data(). Will be used later.
|
| |
|
|
| |
and support up to 16 arguments.
|
| |
|
|
|
|
|
|
| |
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.
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
| |
g_variant_new_from_bytes() is itself only available since 2.36, thus
using it triggers a deprecation warning itself.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
| |
|
|
|
|
|
| |
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
|
| |
|
|
|
|
| |
Otherwise, deprecation warnings are not properly suppressed for
g_return_if_fail (g_strv_contains (strv, str));
|
| |
|
|
|
|
|
| |
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.
|
| | |
|
| |
|
|
|
| |
It has the very similar purpose as "nm-utils/nm-vpn-plugin-utils.[ch]", except
that is is header-only.
|
| |
|
|
|
| |
"nm-test-utils.h" may also be used by the VPN plugins, there
we have no NM_ASSERT_NO_MSG define.
|