Commit graph

24 commits

Author SHA1 Message Date
Thomas Haller
d66b5e79c7 core: reuse common static string buffer in nm_utils_dnsmasq_status_to_string()
Instead of declaring our local string buffer @buffer,
reuse nm_utils_to_string_buffer_init().

https://github.com/NetworkManager/NetworkManager/pull/8
2016-06-03 09:24:45 +02:00
Lubomir Rintel
0c40bce314 core-utils: add conversions of ipv6 tokens
From/to strings and interface identifiers.
2016-05-30 16:19:20 +02:00
Lubomir Rintel
02f935c4cc all: fix the identfier typo 2016-05-30 16:14:04 +02:00
Thomas Haller
d3be90e3e7 utils: fix memleak in nm_utils_read_link_absolute()
Fixes: c4b88bf23f
2016-05-12 15:24:11 +02:00
Thomas Haller
ba90c9601c all: replace nm_unauto() by g_steal_pointer()
They do essentially the same.
2016-05-12 14:28:44 +02:00
Beniamino Galvani
c0d322720a core: introduce nm_utils_dnsmasq_status_to_string() 2016-05-02 15:06:43 +02:00
Thomas Haller
5fe99a1d1a core: add nm_utils_ipx_address_clear_host_address() util 2016-04-28 12:53:21 +02:00
Thomas Haller
c4b88bf23f utils: add nm_utils_read_link_absolute() 2016-04-27 14:51:55 +02:00
Thomas Haller
f137af2e23 core: add nm_utils_machine_id_read() and parse() util 2016-04-26 12:48:27 +02:00
Thomas Haller
d787b8c827 core: add nm_utils_get_secret_key() util 2016-04-26 12:48:27 +02:00
Thomas Haller
d061025f1e core: minor cleanup of nm_utils_get_start_time_for_pid()
And for @out_state, return ' ' instead of '\0' in case of
failure. That is more friendly, when the user happens to
print the value.
2016-04-22 12:58:20 +02:00
Thomas Haller
8f7029d132 core: add nm_utils_new_infiniband_name() util 2016-04-20 12:09:40 +02:00
Thomas Haller
186787744c shared: move nm_utils_ascii_str_to_bool() to shared/nm-shared-utils.h 2016-04-19 13:47:41 +02:00
Thomas Haller
db3175d9c0 core: add nm_utils_ip6_address_same_prefix() util 2016-04-11 11:26:36 +02:00
Beniamino Galvani
5e78322088 core: fix message format for failed creation of secret key 2016-04-05 14:32:00 +02:00
Thomas Haller
72216f7359 shared: move NM_UTILS_ERROR to shared-utils
NM_UTILS_ERROR is our way to say, that we don't care about
the GError domain and code. nmcli sometimes passes domain "1"
and code "0" to g_set_error(), which could be considered
a bug.

We usually don't care about the error but only about the error
message, so let's have a universally available error quark around.
2016-03-26 12:10:53 +01:00
Beniamino Galvani
519787e1e4 core: accept zero @wait_before_kill_msec in nm_utils_kill_process_sync()
A zero @wait_before_kill_msec argument should disable the generation
of a SIGKILL signal (after a different signal has been sent).
2016-03-24 15:03:04 +01:00
Thomas Haller
c7aea6b620 platform: use gint32 for monotonic-timestamp seconds
@now is obtained via nm_utils_get_monotonic_timestamp_s(),
which is gint32 (although it will never be negative).

Use the correct type.
2016-03-15 18:28:43 +01:00
Thomas Haller
6cb7322465 platform: remove padding for IP address lifetimes
We used to pad the lifetime since the beginning (commit
f121995fad).

However, there is not race involved, since our platform cache
is in sync with the messages from kernel (which didn't used to
be the case).

Also, when receiving a RA with a zero preferred time, we must
not extend the address lifetime by 5 seconds, but instead deprecate
the address immediately.

https://bugzilla.gnome.org/show_bug.cgi?id=763513
2016-03-15 18:28:43 +01:00
Thomas Haller
d5cc42ff6f core/trivial: rename NM_ASSERT_VALID_PATH_COMPONENT() helper
All defines from header files must have a NM prefix.
2016-03-08 17:45:50 +01:00
Thomas Haller
6165df788d core: move simple utils function from "nm-platform-utils.h"
Most functions defined in "nm-platform-utils.h" perform a lookup
of link properties, for example via ethtool or sysfs. Those functions
depend on the system configuration, such as the current network namespace.

Move the simple helper functions away to "nm-core-internal.h", so that
all remaining functions from "nm-platform-utils.h" are really related to
somthing that interacts with the system/kernel.
2016-03-07 11:49:52 +01:00
Thomas Haller
0e90f1ba83 platform: add and use nm_utils_ifname_cpy() helper
Coverity complains rightly about "strncpy (dst, ifname, IFNAMSIZ)"
because it might leave @dst non-NULL-terminated, in case @ifname
is too long (which already would be a bug in the first place).

Replace the strcpy() uses by a new helper nm_utils_ifname_cpy()
that asserts against valid arguments.
2016-03-07 11:36:57 +01:00
Thomas Haller
d17aedf91f all: explicitly ignore return values
Coverity warns that usually we check for the return value.
2016-03-04 09:06:21 +01:00
Thomas Haller
adb56d137e core: split "nm-core-utils.h" out of "NetworkManagerUtils.h"
"NetworkManagerUtils.h" contains a bunch of helper tools for core
daemon ("src/").

Unfortunately, it has dependencies to other parts of core,
such as "nm-device.h" and "nm-platform.h". Split out a part
of tools that are independent so that they can be used without
dragging in other dependencies.

"nm-core-utils.h" should only use libnm-core, "nm-logging.h"
and shared.

"NetworkManagerUtils.h" should provide all "nm-core-utils.h" and
possibly other utilities that have larger dependencies.
2016-03-01 12:42:42 +01:00