#include "dirent-util.h"
#include "dns-domain.h"
#include "fd-util.h"
-#include "fileio-label.h"
+#include "fileio.h"
#include "hostname-util.h"
#include "io-util.h"
#include "netlink-util.h"
#include "random-util.h"
#include "resolved-bus.h"
#include "resolved-conf.h"
-#include "resolved-dnssd.h"
#include "resolved-dns-stub.h"
+#include "resolved-dnssd.h"
#include "resolved-etc-hosts.h"
#include "resolved-llmnr.h"
#include "resolved-manager.h"
if (r < 0)
return r;
- r = sd_netlink_add_match(m->rtnl, RTM_NEWLINK, manager_process_link, m);
+ r = sd_netlink_add_match(m->rtnl, NULL, RTM_NEWLINK, manager_process_link, NULL, m, "resolve-NEWLINK");
if (r < 0)
return r;
- r = sd_netlink_add_match(m->rtnl, RTM_DELLINK, manager_process_link, m);
+ r = sd_netlink_add_match(m->rtnl, NULL, RTM_DELLINK, manager_process_link, NULL, m, "resolve-DELLINK");
if (r < 0)
return r;
- r = sd_netlink_add_match(m->rtnl, RTM_NEWADDR, manager_process_address, m);
+ r = sd_netlink_add_match(m->rtnl, NULL, RTM_NEWADDR, manager_process_address, NULL, m, "resolve-NEWADDR");
if (r < 0)
return r;
- r = sd_netlink_add_match(m->rtnl, RTM_DELADDR, manager_process_address, m);
+ r = sd_netlink_add_match(m->rtnl, NULL, RTM_DELADDR, manager_process_address, NULL, m, "resolve-DELADDR");
if (r < 0)
return r;
r = dns_label_unescape(&p, label, sizeof label);
if (r < 0)
return log_error_errno(r, "Failed to unescape host name: %m");
- if (r == 0) {
- log_error("Couldn't find a single label in hostname.");
- return -EINVAL;
- }
+ if (r == 0)
+ return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
+ "Couldn't find a single label in hostname.");
#if HAVE_LIBIDN2
r = idn2_to_unicode_8z8z(label, &utf8, 0);
if (k > 0)
r = k;
- if (!utf8_is_valid(label)) {
- log_error("System hostname is not UTF-8 clean.");
- return -EINVAL;
- }
+ if (!utf8_is_valid(label))
+ return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
+ "System hostname is not UTF-8 clean.");
decoded = label;
#else
decoded = label; /* no decoding */
if (r < 0)
return log_error_errno(r, "Failed to escape host name: %m");
- if (is_localhost(n)) {
- log_debug("System hostname is 'localhost', ignoring.");
- return -EINVAL;
- }
+ if (is_localhost(n))
+ return log_debug_errno(SYNTHETIC_ERRNO(EINVAL),
+ "System hostname is 'localhost', ignoring.");
r = dns_name_concat(n, "local", mdns_hostname);
if (r < 0)
if (r < 0)
return r;
- iov = (struct iovec) {
- .iov_base = DNS_PACKET_DATA(p),
- iov.iov_len = p->allocated,
- };
+ iov = IOVEC_MAKE(DNS_PACKET_DATA(p), p->allocated);
l = recvmsg(fd, &mh, 0);
- if (l == 0)
- return 0;
if (l < 0) {
if (IN_SET(errno, EAGAIN, EINTR))
return 0;
return -errno;
}
+ if (l == 0)
+ return 0;
assert(!(mh.msg_flags & MSG_CTRUNC));
assert(!(mh.msg_flags & MSG_TRUNC));
assert(port > 0);
assert(p);
- iov = (struct iovec) {
- .iov_base = DNS_PACKET_DATA(p),
- .iov_len = p->size,
- };
+ iov = IOVEC_MAKE(DNS_PACKET_DATA(p), p->size);
sa = (union sockaddr_union) {
.in.sin_family = AF_INET,
assert(port > 0);
assert(p);
- iov = (struct iovec) {
- .iov_base = DNS_PACKET_DATA(p),
- .iov_len = p->size,
- };
+ iov = IOVEC_MAKE(DNS_PACKET_DATA(p), p->size);
sa = (union sockaddr_union) {
.in6.sin6_family = AF_INET6,