[Midnightbsd-cvs] src [11152] trunk/contrib/tcpdump: patch for midnightbsd

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Wed Jun 27 08:47:36 EDT 2018


Revision: 11152
          http://svnweb.midnightbsd.org/src/?rev=11152
Author:   laffer1
Date:     2018-06-27 08:47:34 -0400 (Wed, 27 Jun 2018)
Log Message:
-----------
patch for midnightbsd

Modified Paths:
--------------
    trunk/contrib/tcpdump/parsenfsfh.c
    trunk/contrib/tcpdump/tcpdump.c

Modified: trunk/contrib/tcpdump/parsenfsfh.c
===================================================================
--- trunk/contrib/tcpdump/parsenfsfh.c	2018-06-27 00:45:58 UTC (rev 11151)
+++ trunk/contrib/tcpdump/parsenfsfh.c	2018-06-27 12:47:34 UTC (rev 11152)
@@ -150,7 +150,7 @@
 	    fhtype = FHT_DECOSF;
 #endif
 #if	defined(__NetBSD__) || defined(__FreeBSD__) || defined(__DragonFly__) \
-     || defined(__OpenBSD__)
+     || defined(__OpenBSD__) || defined(__MidnightBSD__)
 	    fhtype = FHT_BSD44;
 #endif
 	}

Modified: trunk/contrib/tcpdump/tcpdump.c
===================================================================
--- trunk/contrib/tcpdump/tcpdump.c	2018-06-27 00:45:58 UTC (rev 11151)
+++ trunk/contrib/tcpdump/tcpdump.c	2018-06-27 12:47:34 UTC (rev 11152)
@@ -68,7 +68,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <limits.h>
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
 #include <sys/capsicum.h>
 #include <sys/ioccom.h>
 #include <sys/types.h>
@@ -76,7 +76,7 @@
 #include <net/bpf.h>
 #include <fcntl.h>
 #include <libgen.h>
-#endif	/* __FreeBSD__ */
+#endif	/* __MidnightBSD__ */
 #ifndef WIN32
 #include <sys/wait.h>
 #include <sys/resource.h>
@@ -393,7 +393,7 @@
 	char	*CurrentFileName;
 	pcap_t	*pd;
 	pcap_dumper_t *p;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
 	int	dirfd;
 #endif
 };
@@ -684,7 +684,7 @@
 	return ret;
 }
 
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
 /*
  * Ensure that, on a dump file's descriptor, we have all the rights
  * necessary to make the standard I/O library work with an fdopen()ed
@@ -784,10 +784,10 @@
 #endif
 	int status;
 	FILE *VFile;
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
 	cap_rights_t rights;
 	int cansandbox;
-#endif	/* __FreeBSD__ */
+#endif	/* __MidnightBSD__ */
 
 #ifdef WIN32
 	if(wsockinit() != 0) return 1;
@@ -1276,7 +1276,7 @@
 		pd = pcap_open_offline(RFileName, ebuf);
 		if (pd == NULL)
 			error("%s", ebuf);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
 		cap_rights_init(&rights, CAP_READ);
 		if (cap_rights_limit(fileno(pcap_file(pd)), &rights) < 0 &&
 		    errno != ENOSYS) {
@@ -1381,7 +1381,7 @@
 			         *cp != '\0')
 				error("%s: %s\n(%s)", device,
 				    pcap_statustostr(status), cp);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
 			else if (status == PCAP_ERROR_RFMON_NOTSUP &&
 			    strncmp(device, "wlan", 4) == 0) {
 				char parent[8], newdev[8];
@@ -1552,7 +1552,7 @@
 
 	if (pcap_setfilter(pd, &fcode) < 0)
 		error("%s", pcap_geterr(pd));
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
 	if (RFileName == NULL && VFileName == NULL) {
 		static const unsigned long cmds[] = { BIOCGSTATS, BIOCROTZBUF };
 
@@ -1593,11 +1593,11 @@
 #endif
 		if (p == NULL)
 			error("%s", pcap_geterr(pd));
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
 		set_dumper_capsicum_rights(p);
 #endif
 		if (Cflag != 0 || Gflag != 0) {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
 			dumpinfo.WFileName = strdup(basename(WFileName));
 			dumpinfo.dirfd = open(dirname(WFileName),
 			    O_DIRECTORY | O_RDONLY);
@@ -1615,7 +1615,7 @@
 			    errno != ENOSYS) {
 				error("unable to limit dump descriptor fcntls");
 			}
-#else	/* !__FreeBSD__ */
+#else	/* !__MidnightBSD__ */
 			dumpinfo.WFileName = WFileName;
 #endif
 			callback = dump_packet_and_trunc;
@@ -1689,11 +1689,11 @@
 	}
 #endif /* WIN32 */
 
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
 	cansandbox = (nflag && VFileName == NULL && zflag == NULL);
 	if (cansandbox && cap_enter() < 0 && errno != ENOSYS)
 		error("unable to enter the capability mode");
-#endif	/* __FreeBSD__ */
+#endif	/* __MidnightBSD__ */
 
 	do {
 		status = pcap_loop(pd, cnt, callback, pcap_userdata);
@@ -1734,7 +1734,7 @@
 				pd = pcap_open_offline(RFileName, ebuf);
 				if (pd == NULL)
 					error("%s", ebuf);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
 				cap_rights_init(&rights, CAP_READ);
 				if (cap_rights_limit(fileno(pcap_file(pd)),
 				    &rights) < 0 && errno != ENOSYS) {
@@ -1937,7 +1937,7 @@
 
 		/* If the time is greater than the specified window, rotate */
 		if (t - Gflag_time >= Gflag) {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
 			FILE *fp;
 			int fd;
 #endif
@@ -1988,7 +1988,7 @@
 			capng_update(CAPNG_ADD, CAPNG_EFFECTIVE, CAP_DAC_OVERRIDE);
 			capng_apply(CAPNG_EFFECTIVE);
 #endif /* HAVE_CAP_NG_H */
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
 			fd = openat(dump_info->dirfd,
 			    dump_info->CurrentFileName,
 			    O_CREAT | O_WRONLY | O_TRUNC, 0644);
@@ -2002,7 +2002,7 @@
 				    dump_info->CurrentFileName);
 			}
 			dump_info->p = pcap_dump_fopen(dump_info->pd, fp);
-#else	/* !__FreeBSD__ */
+#else	/* !__MidnightBSD__ */
 			dump_info->p = pcap_dump_open(dump_info->pd, dump_info->CurrentFileName);
 #endif
 #ifdef HAVE_CAP_NG_H
@@ -2011,7 +2011,7 @@
 #endif /* HAVE_CAP_NG_H */
 			if (dump_info->p == NULL)
 				error("%s", pcap_geterr(pd));
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
 			set_dumper_capsicum_rights(dump_info->p);
 #endif
 		}
@@ -2023,7 +2023,7 @@
 	 * file could put it over Cflag.
 	 */
 	if (Cflag != 0 && pcap_dump_ftell(dump_info->p) > Cflag) {
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
 		FILE *fp;
 		int fd;
 #endif
@@ -2050,7 +2050,7 @@
 		if (dump_info->CurrentFileName == NULL)
 			error("dump_packet_and_trunc: malloc");
 		MakeFilename(dump_info->CurrentFileName, dump_info->WFileName, Cflag_count, WflagChars);
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
 		fd = openat(dump_info->dirfd, dump_info->CurrentFileName,
 		    O_CREAT | O_WRONLY | O_TRUNC, 0644);
 		if (fd < 0) {
@@ -2063,12 +2063,12 @@
 			    dump_info->CurrentFileName);
 		}
 		dump_info->p = pcap_dump_fopen(dump_info->pd, fp);
-#else	/* !__FreeBSD__ */
+#else	/* !__MidnightBSD__ */
 		dump_info->p = pcap_dump_open(dump_info->pd, dump_info->CurrentFileName);
 #endif
 		if (dump_info->p == NULL)
 			error("%s", pcap_geterr(pd));
-#ifdef __FreeBSD__
+#ifdef __MidnightBSD__
 		set_dumper_capsicum_rights(dump_info->p);
 #endif
 	}



More information about the Midnightbsd-cvs mailing list