diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2020-09-29 09:00:21 +0200 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2020-10-06 19:36:29 +0200 |
commit | 0d7d377b800db19728e3b6cb707925e557f5a536 (patch) | |
tree | 440b4685be08adc917b8941ad99664bf7a28ad51 /src/network/networkd-util.h | |
parent | network: drop list of static routing policy rules (diff) | |
download | systemd-0d7d377b800db19728e3b6cb707925e557f5a536.tar.xz systemd-0d7d377b800db19728e3b6cb707925e557f5a536.zip |
network: move log_message_warning_errno() to networkd-util.h
Diffstat (limited to 'src/network/networkd-util.h')
-rw-r--r-- | src/network/networkd-util.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/network/networkd-util.h b/src/network/networkd-util.h index 0433f883a3..2b6541d57e 100644 --- a/src/network/networkd-util.h +++ b/src/network/networkd-util.h @@ -2,10 +2,13 @@ #pragma once #include "sd-dhcp-lease.h" +#include "sd-netlink.h" #include "conf-parser.h" #include "hash-funcs.h" +#include "log.h" #include "macro.h" +#include "string-util.h" typedef enum AddressFamily { /* This is a bitmask, though it usually doesn't feel that way! */ @@ -70,3 +73,10 @@ static inline bool section_is_invalid(NetworkConfigSection *section) { } \ DEFINE_TRIVIAL_CLEANUP_FUNC(type*, free_func); \ DEFINE_TRIVIAL_CLEANUP_FUNC(type*, free_func##_or_set_invalid); + +static inline int log_message_warning_errno(sd_netlink_message *m, int err, const char *msg) { + const char *err_msg = NULL; + + (void) sd_netlink_message_read_string(m, NLMSGERR_ATTR_MSG, &err_msg); + return log_warning_errno(err, "%s: %s%s%m", msg, strempty(err_msg), err_msg ? " " : ""); +} |