Properly address IPV6 loopback check.
Submitted by: jmg (via twitter)
This commit is contained in:
parent
3cdace3d56
commit
c68b94d6f1
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=375210
3 changed files with 23 additions and 32 deletions
|
@ -3,6 +3,7 @@
|
|||
|
||||
PORTNAME= ntp
|
||||
PORTVERSION= 4.2.8
|
||||
PORTREVISION= 1
|
||||
CATEGORIES= net ipv6
|
||||
MASTER_SITES= ftp://ftp.udel.edu/pub/ntp/ntp4/ \
|
||||
http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ \
|
||||
|
@ -47,10 +48,6 @@ CONFIGURE_ARGS+= --enable-${D}
|
|||
.endif
|
||||
.endfor
|
||||
|
||||
.if ${PORT_OPTIONS:MMX4200}
|
||||
BROKEN= Fails to compile when MX4200 is enabled.
|
||||
.endif
|
||||
|
||||
DOCSDIR= ${PREFIX}/share/doc/${PORTNAME}4
|
||||
|
||||
# XXX Temporary hack. Remember to remove this next commit.
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
--- include/ntp_net.h.orig 2014-12-19 03:56:52.000000000 -0800
|
||||
+++ include/ntp_net.h 2014-12-19 16:21:51.050264459 -0800
|
||||
@@ -5,6 +5,11 @@
|
||||
#ifndef NTP_NET_H
|
||||
#define NTP_NET_H
|
||||
|
||||
+/* XXX obtained from /usr/include/netinet6/in6.h */
|
||||
+#define s6_addr8 __u6_addr.__u6_addr8
|
||||
+#define s6_addr16 __u6_addr.__u6_addr16
|
||||
+#define s6_addr32 __u6_addr.__u6_addr32
|
||||
+
|
||||
#include <sys/types.h>
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
@@ -29,6 +34,13 @@
|
||||
struct sockaddr sa;
|
||||
struct sockaddr_in sa4;
|
||||
struct sockaddr_in6 sa6;
|
||||
+/* XXX obtained from /usr/include/netinet6/in6.h */
|
||||
+ union {
|
||||
+ uint8_t __u6_addr8[16];
|
||||
+ uint16_t __u6_addr16[8];
|
||||
+ uint32_t __u6_addr32[4];
|
||||
+ } __u6_addr; /* 128-bit IP6 address */
|
||||
+
|
||||
} sockaddr_u;
|
||||
|
||||
/*
|
22
net/ntp/files/patch-ntpd__ntp_io.c
Normal file
22
net/ntp/files/patch-ntpd__ntp_io.c
Normal file
|
@ -0,0 +1,22 @@
|
|||
--- ntpd/ntp_io.c.orig 2014-12-19 03:56:55.000000000 -0800
|
||||
+++ ntpd/ntp_io.c 2014-12-21 22:36:02.977441698 -0800
|
||||
@@ -3454,15 +3454,15 @@
|
||||
if (AF_INET6 == itf->family) {
|
||||
DPRINTF(1, ("Got an IPv6 packet, from <%s> (%d) to <%s> (%d)\n",
|
||||
stoa(&rb->recv_srcadr),
|
||||
- IN6_IS_ADDR_LOOPBACK(&rb->recv_srcadr),
|
||||
+ IN6_IS_ADDR_LOOPBACK(&rb->recv_srcadr.sa6.sin6_addr),
|
||||
stoa(&itf->sin),
|
||||
- !IN6_IS_ADDR_LOOPBACK(&itf->sin)
|
||||
+ !IN6_IS_ADDR_LOOPBACK(&itf->sin.sa6.sin6_addr)
|
||||
));
|
||||
}
|
||||
|
||||
if ( AF_INET6 == itf->family
|
||||
- && IN6_IS_ADDR_LOOPBACK(&rb->recv_srcadr)
|
||||
- && !IN6_IS_ADDR_LOOPBACK(&itf->sin)
|
||||
+ && IN6_IS_ADDR_LOOPBACK(&rb->recv_srcadr.sa6.sin6_addr)
|
||||
+ && !IN6_IS_ADDR_LOOPBACK(&itf->sin.sa6.sin6_addr)
|
||||
) {
|
||||
packets_dropped++;
|
||||
DPRINTF(1, ("DROPPING that packet\n"));
|
Loading…
Reference in a new issue