]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
Fix #928 (1.18 doesn't start on macOS/SunOS)
authorPhilip Homburg <philip@nlnetlabs.nl>
Thu, 7 Sep 2023 13:35:32 +0000 (15:35 +0200)
committerPhilip Homburg <philip@nlnetlabs.nl>
Thu, 7 Sep 2023 14:35:22 +0000 (16:35 +0200)
services/listen_dnsport.c
util/fptr_wlist.c
util/netevent.c

index 60f9b41e5f6cd9c1e0a7f241784b114b0ee0fb2e..259347a367e45ccb94706693e96b91b1146c68b8 100644 (file)
@@ -1498,9 +1498,13 @@ listen_create(struct comm_base* base, struct listen_port* ports,
                        }
                } else if(ports->ftype == listen_type_udpancil ||
                                  ports->ftype == listen_type_udpancil_dnscrypt) {
+#if defined(AF_INET6) && defined(IPV6_PKTINFO) && defined(HAVE_RECVMSG)
                        cp = comm_point_create_udp_ancil(base, ports->fd,
                                front->udp_buff, ports->pp2_enabled, cb,
                                cb_arg, ports->socket);
+#else
+                       log_warn("This system does not support UDP ancilliary data.");
+#endif
                }
                if(!cp) {
                        log_err("can't create commpoint");
index 3b88da2358e5d792522914ec21f5209145e53afb..43d38dc3797ddd7316ea90bebc35a7aa9ba70ee1 100644 (file)
@@ -168,7 +168,9 @@ int
 fptr_whitelist_event(void (*fptr)(int, short, void *))
 {
        if(fptr == &comm_point_udp_callback) return 1;
+#if defined(AF_INET6) && defined(IPV6_PKTINFO) && defined(HAVE_RECVMSG)
        else if(fptr == &comm_point_udp_ancil_callback) return 1;
+#endif
        else if(fptr == &comm_point_tcp_accept_callback) return 1;
        else if(fptr == &comm_point_tcp_handle_callback) return 1;
        else if(fptr == &comm_timer_callback) return 1;
index 204e4883cf2781926082ae767b8230cf43276a56..9f4a6e6c3804a17584194e59c59d55a5346c5c29 100644 (file)
@@ -850,10 +850,10 @@ done:
        return 1;
 }
 
+#if defined(AF_INET6) && defined(IPV6_PKTINFO) && defined(HAVE_RECVMSG)
 void
 comm_point_udp_ancil_callback(int fd, short event, void* arg)
 {
-#if defined(AF_INET6) && defined(IPV6_PKTINFO) && defined(HAVE_RECVMSG)
        struct comm_reply rep;
        struct msghdr msg;
        struct iovec iov[1];
@@ -972,14 +972,8 @@ comm_point_udp_ancil_callback(int fd, short event, void* arg)
                if(!rep.c || rep.c->fd == -1) /* commpoint closed */
                        break;
        }
-#else
-       (void)fd;
-       (void)event;
-       (void)arg;
-       fatal_exit("recvmsg: No support for IPV6_PKTINFO; IP_PKTINFO or IP_RECVDSTADDR. "
-               "Please disable interface-automatic");
-#endif /* AF_INET6 && IPV6_PKTINFO && HAVE_RECVMSG */
 }
+#endif /* AF_INET6 && IPV6_PKTINFO && HAVE_RECVMSG */
 
 void
 comm_point_udp_callback(int fd, short event, void* arg)
@@ -3860,7 +3854,7 @@ comm_point_create_udp(struct comm_base *base, int fd, sldns_buffer* buffer,
        evbits = UB_EV_READ | UB_EV_PERSIST;
        /* ub_event stuff */
        c->ev->ev = ub_event_new(base->eb->base, c->fd, evbits,
-#ifdef USE_WINSOCK
+#if defined(USE_WINSOCK) || !(defined(AF_INET6) && defined(IPV6_PKTINFO) && defined(HAVE_RECVMSG))
                comm_point_udp_callback, c);
 #else
                comm_point_udp_ancil_callback, c);
@@ -3879,6 +3873,7 @@ comm_point_create_udp(struct comm_base *base, int fd, sldns_buffer* buffer,
        return c;
 }
 
+#if defined(AF_INET6) && defined(IPV6_PKTINFO) && defined(HAVE_RECVMSG)
 struct comm_point*
 comm_point_create_udp_ancil(struct comm_base *base, int fd,
        sldns_buffer* buffer, int pp2_enabled,
@@ -3941,6 +3936,7 @@ comm_point_create_udp_ancil(struct comm_base *base, int fd,
        c->event_added = 1;
        return c;
 }
+#endif
 
 static struct comm_point*
 comm_point_create_tcp_handler(struct comm_base *base,