svn commit: r490503 - in head/dns/gdnsd2: . files
Ryan Steinmetz
zi at FreeBSD.org
Wed Jan 16 19:27:37 UTC 2019
Author: zi
Date: Wed Jan 16 19:27:36 2019
New Revision: 490503
URL: https://svnweb.freebsd.org/changeset/ports/490503
Log:
- Fix EADDRNOTAVAIL issue under FreeBSD when using IPs bound to loopback interfaces
- Bump PORTREVISION
Obtained from: upstream PR #175
Added:
head/dns/gdnsd2/files/patch-src_dnsio__udp.c (contents, props changed)
Modified:
head/dns/gdnsd2/Makefile
Modified: head/dns/gdnsd2/Makefile
==============================================================================
--- head/dns/gdnsd2/Makefile Wed Jan 16 19:18:14 2019 (r490502)
+++ head/dns/gdnsd2/Makefile Wed Jan 16 19:27:36 2019 (r490503)
@@ -3,7 +3,7 @@
PORTNAME= gdnsd
PORTVERSION= 2.4.1
-PORTREVISION= 1
+PORTREVISION= 2
CATEGORIES= dns
MASTER_SITES= https://github.com/gdnsd/gdnsd/releases/download/v${PORTVERSION}/ \
ZI \
Added: head/dns/gdnsd2/files/patch-src_dnsio__udp.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/dns/gdnsd2/files/patch-src_dnsio__udp.c Wed Jan 16 19:27:36 2019 (r490503)
@@ -0,0 +1,44 @@
+--- src/dnsio_udp.c.orig 2019-01-16 15:44:43 UTC
++++ src/dnsio_udp.c
+@@ -296,13 +296,16 @@ static void mainloop(const int fd, void*
+ .iov_len = 0
+ };
+ struct msghdr msg_hdr;
+- char cmsg_buf[cmsg_size];
+- memset(cmsg_buf, 0, sizeof(cmsg_buf));
++ union {
++ char cbuf[CMSG_BUFSIZE];
++ struct cmsghdr align;
++ } cmsg_buf;
++ memset(cmsg_buf.cbuf, 0, sizeof(cmsg_buf.cbuf));
+ memset(&msg_hdr, 0, sizeof(struct msghdr));
+ msg_hdr.msg_name = &asin.sa;
+ msg_hdr.msg_iov = &iov;
+ msg_hdr.msg_iovlen = 1;
+- msg_hdr.msg_control = use_cmsg ? cmsg_buf : NULL;
++ msg_hdr.msg_control = use_cmsg ? cmsg_buf.cbuf : NULL;
+
+ #if GDNSD_B_QSBR
+ const struct timeval tmout_short = { .tv_sec = 0, .tv_usec = PRCU_DELAY_US };
+@@ -341,6 +344,21 @@ static void mainloop(const int fd, void*
+ recvmsg_rv = recvmsg(fd, &msg_hdr, 0);
+ #endif
+
++#if defined __FreeBSD__ && defined IPV6_PKTINFO
++ if(asin.sa.sa_family == AF_INET6) {
++ struct cmsghdr* cmsg;
++ for(cmsg = (struct cmsghdr *)CMSG_FIRSTHDR(&msg_hdr); cmsg;
++ cmsg = (struct cmsghdr *)CMSG_NXTHDR(&msg_hdr, cmsg)) {
++ if((cmsg->cmsg_level == IPPROTO_IPV6) && (cmsg->cmsg_type == IPV6_PKTINFO)) {
++ struct in6_pktinfo* pi = (void*)CMSG_DATA((struct cmsghdr*)cmsg_buf.cbuf);
++ if(!IN6_IS_ADDR_LINKLOCAL(&pi->ipi6_addr))
++ pi->ipi6_ifindex = 0;
++ continue;
++ }
++ }
++ }
++#endif
++
+ if(unlikely(
+ (asin.sa.sa_family == AF_INET && !asin.sin.sin_port)
+ || (asin.sa.sa_family == AF_INET6 && !asin.sin6.sin6_port)
More information about the svn-ports-head
mailing list