git: 440c2c6a2630 - main - net/mDNSResponder: Fix build in IPv6 environment

From: Po-Chuan Hsieh <sunpoet_at_FreeBSD.org>
Date: Sun, 09 Apr 2023 13:40:00 UTC
The branch main has been updated by sunpoet:

URL: https://cgit.FreeBSD.org/ports/commit/?id=440c2c6a26303e1a1db6e5f5de039d64bac4ff3a

commit 440c2c6a26303e1a1db6e5f5de039d64bac4ff3a
Author:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
AuthorDate: 2023-04-09 13:30:08 +0000
Commit:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
CommitDate: 2023-04-09 13:36:36 +0000

    net/mDNSResponder: Fix build in IPv6 environment
    
    - Restore patch-mDNSPosix-mDNSPosix.c which was removed by accident in 1790.80.10 update
    - Bump PORTREVISION for package change
    
    PR:             270683, 270689
    Reported by:    Matthieu Volat <mazhe@alkumuna.eu>, <dougs@dawnsign.com>
---
 net/mDNSResponder/Makefile                         |  1 +
 .../files/patch-mDNSPosix-mDNSPosix.c              | 38 ++++++++++++++++++++++
 2 files changed, 39 insertions(+)

diff --git a/net/mDNSResponder/Makefile b/net/mDNSResponder/Makefile
index 34dad890bf47..a22cc563e361 100644
--- a/net/mDNSResponder/Makefile
+++ b/net/mDNSResponder/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	mDNSResponder
 PORTVERSION=	1790.80.10
+PORTREVISION=	1
 CATEGORIES=	net dns
 MASTER_SITES=	https://opensource.apple.com/tarballs/mDNSResponder/
 
diff --git a/net/mDNSResponder/files/patch-mDNSPosix-mDNSPosix.c b/net/mDNSResponder/files/patch-mDNSPosix-mDNSPosix.c
new file mode 100644
index 000000000000..7cc9462a8031
--- /dev/null
+++ b/net/mDNSResponder/files/patch-mDNSPosix-mDNSPosix.c
@@ -0,0 +1,38 @@
+--- mDNSPosix/mDNSPosix.c.orig	2023-01-24 00:43:17 UTC
++++ mDNSPosix/mDNSPosix.c
+@@ -1064,7 +1064,10 @@ mDNSlocal int SetupIPv6Socket(int fd)
+ {
+     int err;
+ 
+-    #if defined(IPV6_PKTINFO)
++    #if defined(IPV6_RECVPKTINFO)
++    err = setsockopt(fd, IPPROTO_IPV6, IPV6_RECVPKTINFO, &kOn, sizeof(kOn));
++    if (err < 0) { err = errno; perror("setsockopt - IPV6_RECVPKTINFO"); }
++    #elif defined(IPV6_PKTINFO)
+     err = setsockopt(fd, IPPROTO_IPV6, IPV6_2292_PKTINFO, &kOn, sizeof(kOn));
+     if (err < 0) { err = errno; perror("setsockopt - IPV6_PKTINFO"); }
+     #else
+@@ -1135,7 +1138,7 @@ mDNSlocal int SetupSocket(struct sockaddr *intfAddr, m
+         // to bind to the socket. Our suggestion was to switch the order in which
+         // SO_REUSEPORT and SO_REUSEADDR was tested so that SO_REUSEADDR stays on
+         // top and SO_REUSEPORT to be used only if SO_REUSEADDR doesn't exist.
+-        #if defined(SO_REUSEADDR) && !defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
++        #if defined(SO_REUSEADDR) && !defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && !defined(__FreeBSD__)
+         err = setsockopt(*sktPtr, SOL_SOCKET, SO_REUSEADDR, &kOn, sizeof(kOn));
+         #elif defined(SO_REUSEPORT)
+         err = setsockopt(*sktPtr, SOL_SOCKET, SO_REUSEPORT, &kOn, sizeof(kOn));
+@@ -1224,7 +1227,13 @@ mDNSlocal int SetupSocket(struct sockaddr *intfAddr, m
+         if (err == 0) {
+             err = SetupIPv6Socket(*sktPtr);
+         }
+-    #if defined(IPV6_HOPLIMIT)
++    #if defined(IPV6_RECVHOPLIMIT)
++        if (err == 0)
++        {
++            err = setsockopt(*sktPtr, IPPROTO_IPV6, IPV6_RECVHOPLIMIT, &kOn, sizeof(kOn));
++            if (err < 0) { err = errno; perror("setsockopt - IPV6_RECVHOPLIMIT"); }
++        }
++    #elif defined(IPV6_HOPLIMIT)
+         if (err == 0)
+         {
+             err = setsockopt(*sktPtr, IPPROTO_IPV6, IPV6_2292_HOPLIMIT, &kOn, sizeof(kOn));