From: Yu Watanabe Date: Wed, 18 Sep 2024 19:03:11 +0000 (+0900) Subject: network/neighbor: use log_section_warning_errno() X-Git-Tag: v257-rc1~398^2~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8d6eedd8a31db65420ab83f63643fdf095941bc8;p=thirdparty%2Fsystemd.git network/neighbor: use log_section_warning_errno() --- diff --git a/src/network/networkd-neighbor.c b/src/network/networkd-neighbor.c index 9a03e12448b..87af5e9e62f 100644 --- a/src/network/networkd-neighbor.c +++ b/src/network/networkd-neighbor.c @@ -660,28 +660,28 @@ int manager_rtnl_process_neighbor(sd_netlink *rtnl, sd_netlink_message *message, return 1; } +#define log_neighbor_section(neighbor, fmt, ...) \ + ({ \ + const Neighbor *_neighbor = (neighbor); \ + log_section_warning_errno( \ + _neighbor ? _neighbor->section : NULL, \ + SYNTHETIC_ERRNO(EINVAL), \ + fmt " Ignoring [Neighbor] section.", \ + ##__VA_ARGS__); \ + }) + static int neighbor_section_verify(Neighbor *neighbor) { if (section_is_invalid(neighbor->section)) return -EINVAL; if (neighbor->dst_addr.family == AF_UNSPEC) - return log_warning_errno(SYNTHETIC_ERRNO(EINVAL), - "%s: Neighbor section without Address= configured. " - "Ignoring [Neighbor] section from line %u.", - neighbor->section->filename, neighbor->section->line); + return log_neighbor_section(neighbor, "Neighbor section without Address= configured."); if (neighbor->dst_addr.family == AF_INET6 && !socket_ipv6_is_supported()) - return log_warning_errno(SYNTHETIC_ERRNO(EINVAL), - "%s: Neighbor section with an IPv6 destination address configured, " - "but the kernel does not support IPv6. " - "Ignoring [Neighbor] section from line %u.", - neighbor->section->filename, neighbor->section->line); + return log_neighbor_section(neighbor, "Neighbor section with an IPv6 destination address configured, but the kernel does not support IPv6."); if (neighbor->ll_addr.length == 0) - return log_warning_errno(SYNTHETIC_ERRNO(EINVAL), - "%s: Neighbor section without LinkLayerAddress= configured. " - "Ignoring [Neighbor] section from line %u.", - neighbor->section->filename, neighbor->section->line); + return log_neighbor_section(neighbor, "Neighbor section without LinkLayerAddress= configured."); return 0; }