]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/resolve/resolved-llmnr.c
resolved: add missing error code check when initializing DNS-over-TLS
[thirdparty/systemd.git] / src / resolve / resolved-llmnr.c
index dfa55c577c402a1575379ab0f74b041346830c45..61e50343e5c74d63912f1506c9d19fcc8e1ca507 100644 (file)
@@ -3,6 +3,7 @@
 #include <netinet/in.h>
 #include <resolv.h>
 
+#include "errno-util.h"
 #include "fd-util.h"
 #include "resolved-llmnr.h"
 #include "resolved-manager.h"
@@ -289,19 +290,21 @@ static int on_llmnr_stream(sd_event_source *s, int fd, uint32_t revents, void *u
 
         cfd = accept4(fd, NULL, NULL, SOCK_NONBLOCK|SOCK_CLOEXEC);
         if (cfd < 0) {
-                if (IN_SET(errno, EAGAIN, EINTR))
+                if (ERRNO_IS_ACCEPT_AGAIN(errno))
                         return 0;
 
                 return -errno;
         }
 
-        r = dns_stream_new(m, &stream, DNS_PROTOCOL_LLMNR, cfd, NULL);
+        r = dns_stream_new(m, &stream, DNS_STREAM_LLMNR_RECV, DNS_PROTOCOL_LLMNR, cfd, NULL);
         if (r < 0) {
                 safe_close(cfd);
                 return r;
         }
 
         stream->on_packet = on_llmnr_stream_packet;
+        /* We don't configure a "complete" handler here, we rely on the default handler than simply drops the
+         * reference to the stream, thus freeing it */
         return 0;
 }