diff --git a/sysutils/syslog-ng/Portfile b/sysutils/syslog-ng/Portfile index 8f38b9713fe8e..7039d3be9fa09 100644 --- a/sysutils/syslog-ng/Portfile +++ b/sysutils/syslog-ng/Portfile @@ -32,7 +32,8 @@ depends_lib port:gettext-runtime \ port:pcre patchfiles clock_gettime_compat.patch \ - MAP_ANONYMOUS.patch + MAP_ANONYMOUS.patch \ + 80e97634cb75878ee94b23ebf35cebc92481fbfc.patch startupitem.create yes startupitem.executable ${prefix}/sbin/syslog-ng diff --git a/sysutils/syslog-ng/files/80e97634cb75878ee94b23ebf35cebc92481fbfc.patch b/sysutils/syslog-ng/files/80e97634cb75878ee94b23ebf35cebc92481fbfc.patch new file mode 100644 index 0000000000000..ccecc20b6858e --- /dev/null +++ b/sysutils/syslog-ng/files/80e97634cb75878ee94b23ebf35cebc92481fbfc.patch @@ -0,0 +1,66 @@ +From 80e97634cb75878ee94b23ebf35cebc92481fbfc Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?L=C3=A1szl=C3=B3=20V=C3=A1rady?= +Date: Wed, 30 Aug 2023 19:32:17 +0200 +Subject: [PATCH] transport-udp: support platforms where PKTINFO is not + available +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +For example, older macOS versions. + +Signed-off-by: László Várady +--- + lib/transport/transport-udp-socket.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/lib/transport/transport-udp-socket.c b/lib/transport/transport-udp-socket.c +index 821f20b1ee..2bd9fe2350 100644 +--- lib/transport/transport-udp-socket.c ++++ lib/transport/transport-udp-socket.c +@@ -63,6 +63,7 @@ _extract_dest_ip4_addr_from_cmsg(struct cmsghdr *cmsg, GSockAddr *bind_addr) + GSockAddr * + _extract_dest_ip4_addr_from_cmsg(struct cmsghdr *cmsg, GSockAddr *bind_addr) + { ++#ifdef IP_PKTINFO + if (cmsg->cmsg_level == IPPROTO_IP && cmsg->cmsg_type == IP_PKTINFO) + { + struct sockaddr_in sin; +@@ -76,6 +77,7 @@ _extract_dest_ip4_addr_from_cmsg(struct cmsghdr *cmsg, GSockAddr *bind_addr) + sin.sin_addr = inpkt.ipi_addr; + return g_sockaddr_new((struct sockaddr *) &sin, sizeof(sin)); + } ++#endif + return NULL; + } + #endif +@@ -85,6 +87,7 @@ _extract_dest_ip4_addr_from_cmsg(struct cmsghdr *cmsg, GSockAddr *bind_addr) + GSockAddr * + _extract_dest_ip6_addr_from_cmsg(struct cmsghdr *cmsg, GSockAddr *bind_addr) + { ++#ifdef IPV6_PKTINFO + if (cmsg->cmsg_level == IPPROTO_IPV6 && cmsg->cmsg_type == IPV6_PKTINFO) + { + struct sockaddr_in6 sin6; +@@ -98,6 +101,7 @@ _extract_dest_ip6_addr_from_cmsg(struct cmsghdr *cmsg, GSockAddr *bind_addr) + sin6.sin6_addr = in6pkt.ipi6_addr; + return g_sockaddr_new((struct sockaddr *) &sin6, sizeof(sin6)); + } ++#endif + return NULL; + } + +@@ -142,11 +146,11 @@ _setup_fd(LogTransportUDP *self, gint fd) + { + #if defined(__FreeBSD__) || defined(__OpenBSD__) + setsockopt(fd, IPPROTO_IP, IP_RECVDSTADDR, &on, sizeof(on)); +-#else ++#elif defined(IP_PKTINFO) + setsockopt(fd, IPPROTO_IP, IP_PKTINFO, &on, sizeof(on)); + #endif + } +-#if SYSLOG_NG_ENABLE_IPV6 ++#if SYSLOG_NG_ENABLE_IPV6 && defined(IPV6_RECVPKTINFO) + else if (self->bind_addr->sa.sa_family == AF_INET6) + setsockopt(fd, IPPROTO_IPV6, IPV6_RECVPKTINFO, &on, sizeof(on)); + #endif