Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/bsd/libpcap ENABLE_REMOTE and add rpcapd(8)



details:   https://anonhg.NetBSD.org/src/rev/34b69547ea61
branches:  trunk
changeset: 746358:34b69547ea61
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Mar 29 17:12:45 2020 +0000

description:
ENABLE_REMOTE and add rpcapd(8)

diffstat:

 external/bsd/libpcap/Makefile.inc         |  11 ++++++++
 external/bsd/libpcap/dist/pcap-rpcap.c    |   2 +-
 external/bsd/libpcap/dist/sockutils.c     |   8 +++---
 external/bsd/libpcap/lib/Makefile         |  24 +++++++++---------
 external/bsd/libpcap/lib/shlib_version    |   4 +-
 external/bsd/libpcap/sbin/Makefile        |   5 +++
 external/bsd/libpcap/sbin/Makefile.inc    |   2 +
 external/bsd/libpcap/sbin/rpcapd/Makefile |  39 +++++++++++++++++++++++++++++++
 8 files changed, 76 insertions(+), 19 deletions(-)

diffs (198 lines):

diff -r d138afff95dd -r 34b69547ea61 external/bsd/libpcap/Makefile.inc
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/external/bsd/libpcap/Makefile.inc Sun Mar 29 17:12:45 2020 +0000
@@ -0,0 +1,11 @@
+# $NetBSD: Makefile.inc,v 1.1 2020/03/29 17:12:45 christos Exp $
+
+SRCDIR := ${.PARSEDIR}/dist
+
+__sed: .USE
+       @rm -f ${.TARGET}
+       ${TOOL_SED} \
+           -e 's,@MAN_FILE_FORMATS@,5,g' \
+           -e 's,@MAN_MISC_INFO@,7,g' \
+           -e 's,@MAN_ADMIN_COMMANDS@,8,g' \
+           -e 's,3PCAP,3,g' < ${.ALLSRC} > ${.TARGET}
diff -r d138afff95dd -r 34b69547ea61 external/bsd/libpcap/dist/pcap-rpcap.c
--- a/external/bsd/libpcap/dist/pcap-rpcap.c    Sun Mar 29 15:38:29 2020 +0000
+++ b/external/bsd/libpcap/dist/pcap-rpcap.c    Sun Mar 29 17:12:45 2020 +0000
@@ -2701,7 +2701,7 @@
        }
 
        /* checks if the connecting host is among the ones allowed */
-       if (sock_check_hostlist((char *)hostlist, RPCAP_HOSTLIST_SEP, &from, errbuf, PCAP_ERRBUF_SIZE) < 0)
+       if (sock_check_hostlist(__UNCONST(hostlist), RPCAP_HOSTLIST_SEP, &from, errbuf, PCAP_ERRBUF_SIZE) < 0)
        {
                rpcap_senderror(sockctrl, 0, PCAP_ERR_REMOTEACCEPT, errbuf, NULL);
                sock_close(sockctrl, NULL, 0);
diff -r d138afff95dd -r 34b69547ea61 external/bsd/libpcap/dist/sockutils.c
--- a/external/bsd/libpcap/dist/sockutils.c     Sun Mar 29 15:38:29 2020 +0000
+++ b/external/bsd/libpcap/dist/sockutils.c     Sun Mar 29 17:12:45 2020 +0000
@@ -250,13 +250,13 @@
 {
        if (saddr->sa_family == PF_INET)
        {
-               struct sockaddr_in *saddr4 = (struct sockaddr_in *) saddr;
+               const struct sockaddr_in *saddr4 = (const struct sockaddr_in *) saddr;
                if (IN_MULTICAST(ntohl(saddr4->sin_addr.s_addr))) return 0;
                else return -1;
        }
        else
        {
-               struct sockaddr_in6 *saddr6 = (struct sockaddr_in6 *) saddr;
+               const struct sockaddr_in6 *saddr6 = (const struct sockaddr_in6 *) saddr;
                if (IN6_IS_ADDR_MULTICAST(&saddr6->sin6_addr)) return 0;
                else return -1;
        }
@@ -1534,7 +1534,7 @@
        if ((flags & NI_NUMERICHOST) == 0)      /* Check that we want literal names */
        {
                if ((sockaddr->ss_family == AF_INET6) &&
-                       (memcmp(&((struct sockaddr_in6 *) sockaddr)->sin6_addr, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", sizeof(struct in6_addr)) == 0))
+                       (memcmp(&((const struct sockaddr_in6 *) sockaddr)->sin6_addr, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", sizeof(struct in6_addr)) == 0))
                {
                        if (address)
                                pcap_strlcpy(address, SOCKET_NAME_NULL_DAD, addrlen);
@@ -1542,7 +1542,7 @@
                }
        }
 
-       if (getnameinfo((struct sockaddr *) sockaddr, sockaddrlen, address, addrlen, port, portlen, flags) != 0)
+       if (getnameinfo((const struct sockaddr *) sockaddr, sockaddrlen, address, addrlen, port, portlen, flags) != 0)
        {
                /* If the user wants to receive an error message */
                if (errbuf)
diff -r d138afff95dd -r 34b69547ea61 external/bsd/libpcap/lib/Makefile
--- a/external/bsd/libpcap/lib/Makefile Sun Mar 29 15:38:29 2020 +0000
+++ b/external/bsd/libpcap/lib/Makefile Sun Mar 29 17:12:45 2020 +0000
@@ -1,19 +1,14 @@
-# $NetBSD: Makefile,v 1.26 2019/10/13 07:28:06 mrg Exp $       
+# $NetBSD: Makefile,v 1.27 2020/03/29 17:12:45 christos Exp $  
 
 USE_SHLIBDIR=yes
 .include <bsd.own.mk>
 USE_FORT?= yes # network protocol library
 
-CPPFLAGS+= -DPCAP_DONT_INCLUDE_PCAP_BPF_H -DHAVE_CONFIG_H -I${.OBJDIR}
+CPPFLAGS+= -DPCAP_DONT_INCLUDE_PCAP_BPF_H -DHAVE_CONFIG_H -DENABLE_REMOTE
+CPPFLAGS+= -I${.OBJDIR}
 
 .SUFFIXES: .3 .3pcap
 
-__sed: .USE
-       @rm -f ${.TARGET}
-       ${TOOL_SED} -e 's,@MAN_FILE_FORMATS@,5,g' \
-           -e 's,@MAN_MISC_INFO@,7,g' \
-           -e 's,3PCAP,3,g' < ${.ALLSRC} > ${.TARGET}
-
 .3pcap.3:
        @rm -f ${.TARGET}
        ${TOOL_SED} -e 's,@MAN_FILE_FORMATS@,5,g' \
@@ -23,10 +18,9 @@
 
 # Search first in the kernel for bpf_filter.c
 .PATH: ${NETBSDSRCDIR}/sys/net
-SRCDIR=                ${.CURDIR}/../dist
-.PATH:         ${SRCDIR}
+.PATH: ${SRCDIR}
 
-LIB=           pcap
+LIB=   pcap
 MAN3= \
 pcap_activate.3pcap \
 pcap_breakloop.3pcap \
@@ -142,11 +136,15 @@
 optimize.c \
 pcap-bpf.c \
 pcap-common.c \
+pcap-new.c \
+pcap-rpcap.c \
 pcap.c \
+rpcap-protocol.c \
 savefile.c \
 scanner.l \
 sf-pcap.c \
-sf-pcapng.c
+sf-pcapng.c \
+sockutils.c
 
 
 INCS=          pcap/pcap.h pcap/namedb.h pcap/funcattrs.h \
@@ -168,6 +166,8 @@
 COPTS.gencode.c+=      ${${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} >= 7:? -Wno-error=implicit-fallthrough :}
 COPTS.pcap.c+=         ${GCC_NO_FORMAT_TRUNCATION}
 COPTS.pcap-bpf.c+=     ${GCC_NO_STRINGOP_TRUNCATION}
+COPTS.pcap-new.c+=     ${GCC_NO_FORMAT_TRUNCATION}
+COPTS.pcap-rpcap.c+=   ${GCC_NO_FORMAT_TRUNCATION}
 
 CWARNFLAGS.clang+=     -Wno-format-extra-args \
                        -Wno-unneeded-internal-declaration
diff -r d138afff95dd -r 34b69547ea61 external/bsd/libpcap/lib/shlib_version
--- a/external/bsd/libpcap/lib/shlib_version    Sun Mar 29 15:38:29 2020 +0000
+++ b/external/bsd/libpcap/lib/shlib_version    Sun Mar 29 17:12:45 2020 +0000
@@ -1,5 +1,5 @@
-#      $NetBSD: shlib_version,v 1.6 2019/10/01 16:02:12 christos Exp $
+#      $NetBSD: shlib_version,v 1.7 2020/03/29 17:12:45 christos Exp $
 #      Remember to update distrib/sets/lists/base/shl.* when changing
 #
 major=8
-minor=0
+minor=1
diff -r d138afff95dd -r 34b69547ea61 external/bsd/libpcap/sbin/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/external/bsd/libpcap/sbin/Makefile        Sun Mar 29 17:12:45 2020 +0000
@@ -0,0 +1,5 @@
+# $NetBSD: Makefile,v 1.1 2020/03/29 17:12:45 christos Exp $
+
+SUBDIR=rpcapd
+
+.include <bsd.subdir.mk>
diff -r d138afff95dd -r 34b69547ea61 external/bsd/libpcap/sbin/Makefile.inc
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/external/bsd/libpcap/sbin/Makefile.inc    Sun Mar 29 17:12:45 2020 +0000
@@ -0,0 +1,2 @@
+# $NetBSD: Makefile.inc,v 1.1 2020/03/29 17:12:45 christos Exp $
+.include "../Makefile.inc"
diff -r d138afff95dd -r 34b69547ea61 external/bsd/libpcap/sbin/rpcapd/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/external/bsd/libpcap/sbin/rpcapd/Makefile Sun Mar 29 17:12:45 2020 +0000
@@ -0,0 +1,39 @@
+# $NetBSD: Makefile,v 1.1 2020/03/29 17:12:45 christos Exp $
+
+USE_FORT?=     yes     # network server
+
+.include <bsd.init.mk>
+
+BINDIR=        /usr/sbin
+.PATH:          ${SRCDIR}/rpcapd
+
+PROG=          rpcapd
+SRCS+=         daemon.c fileconf.c log.c rpcapd.c    
+
+MANADMININ+= rpcapd.manadmin.in 
+MANFILEIN+=  rpcapd-config.manfile.in
+
+MAN=    ${MANADMININ:S/manadmin.in/8/g} ${MANFILEIN:S/manfile.in/5/g}
+CLEANFILES+= ${MAN}
+
+.for i in ${MANADMININ}
+${i:S/manadmin.in/8/}: ${i} __sed
+.endfor
+
+.for i in ${MANFILEIN}  
+${i:S/manfile.in/5/}: ${i} __sed
+.endfor
+
+FILES=         rpcapd.socket rpcapd.inetd.conf rpcapd@.service
+FILESDIR=      /usr/share/examples/rpcapd
+
+CPPFLAGS+=     -pthread
+LDFLAGS+=      -pthread
+CPPFLAGS+=     -I${SRCDIR} -I${.CURDIR}/../../include
+CPPFLAGS+=     -DHAVE_CONFIG_H -D_OPENBSD_SOURCE
+CPPFLAGS+=     -DPCAP_DONT_INCLUDE_PCAP_BPF_H
+
+PROGDPLIBS+=   pcap ${.CURDIR}/../../lib \
+               crypt ${NETBSDSRCDIR}/lib/libcrypt
+
+.include <bsd.prog.mk>



Home | Main Index | Thread Index | Old Index