Module Name: src Committed By: christos Date: Mon Sep 2 15:34:08 UTC 2024
Modified Files: src/sys/net: bpf_filter.c dlt.h Log Message: merge changes from libpcap-1.10.5 To generate a diff of this commit: cvs rdiff -u -r1.72 -r1.73 src/sys/net/bpf_filter.c cvs rdiff -u -r1.24 -r1.25 src/sys/net/dlt.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/net/bpf_filter.c diff -u src/sys/net/bpf_filter.c:1.72 src/sys/net/bpf_filter.c:1.73 --- src/sys/net/bpf_filter.c:1.72 Thu Aug 17 11:16:33 2023 +++ src/sys/net/bpf_filter.c Mon Sep 2 11:34:08 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: bpf_filter.c,v 1.72 2023/08/17 15:16:33 christos Exp $ */ +/* $NetBSD: bpf_filter.c,v 1.73 2024/09/02 15:34:08 christos Exp $ */ /*- * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: bpf_filter.c,v 1.72 2023/08/17 15:16:33 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: bpf_filter.c,v 1.73 2024/09/02 15:34:08 christos Exp $"); #if 0 #if !(defined(lint) || defined(KERNEL)) @@ -211,7 +211,7 @@ bpf_filter(const struct bpf_insn *pc, co u_int bpf_filter_ext(const bpf_ctx_t *bc, const struct bpf_insn *pc, bpf_args_t *args) #else -__strong_alias(pcap_filter, bpf_filter) +__strong_alias(pcapint_filter, bpf_filter) u_int bpf_filter(const struct bpf_insn *pc, const u_char *p, u_int wirelen, u_int buflen) @@ -610,7 +610,7 @@ bpf_validate(const struct bpf_insn *f, i int bpf_validate_ext(const bpf_ctx_t *bc, const struct bpf_insn *f, int signed_len) #else -__strong_alias(pcap_validate_filter, bpf_validate) +__strong_alias(pcapint_validate_filter, bpf_validate) int bpf_validate(const struct bpf_insn *f, int signed_len) #endif Index: src/sys/net/dlt.h diff -u src/sys/net/dlt.h:1.24 src/sys/net/dlt.h:1.25 --- src/sys/net/dlt.h:1.24 Thu Aug 17 11:17:05 2023 +++ src/sys/net/dlt.h Mon Sep 2 11:34:08 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: dlt.h,v 1.24 2023/08/17 15:17:05 christos Exp $ */ +/* $NetBSD: dlt.h,v 1.25 2024/09/02 15:34:08 christos Exp $ */ /*- * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997 @@ -60,7 +60,12 @@ /* * These are the types that are the same on all platforms, and that * have been defined by <net/bpf.h> for ages. + * + * DLT_LOW_MATCHING_MIN is the lowest such value; DLT_LOW_MATCHING_MAX + * is the highest such value. */ +#define DLT_LOW_MATCHING_MIN 0 + #define DLT_NULL 0 /* BSD loopback encapsulation */ #define DLT_EN10MB 1 /* Ethernet (10Mb) */ #define DLT_EN3MB 2 /* Experimental Ethernet (3Mb) */ @@ -73,6 +78,25 @@ #define DLT_PPP 9 /* Point-to-point Protocol */ #define DLT_FDDI 10 /* FDDI */ + /* + * In case the code that includes this file (directly or indirectly) + * has also included OS files that happen to define DLT_LOW_MATCHING_MAX, + * with a different value (perhaps because that OS hasn't picked up + * the latest version of our DLT definitions), we undefine the + * previous value of DLT_LOW_MATCHING_MAX. + * + * (They shouldn't, because only those 10 values were assigned in + * the Good Old Days, before DLT_ code assignment became a bit of + * a free-for-all. Perhaps 11 is DLT_ATM_RFC1483 everywhere 11 + * is used at all, but 12 is DLT_RAW on some platforms but not + * OpenBSD, and the fun continues for several other values.) + */ +#ifdef DLT_LOW_MATCHING_MAX +#undef DLT_LOW_MATCHING_MAX +#endif + +#define DLT_LOW_MATCHING_MAX DLT_FDDI /* highest value in this "matching" range */ + /* * These are types that are different on some platforms, and that * have been defined by <net/bpf.h> for ages. We use #ifdefs to @@ -80,7 +104,9 @@ * libpcap <net/bpf.h> * * XXX - DLT_ATM_RFC1483 is 13 in BSD/OS, and DLT_RAW is 14 in BSD/OS, - * but I don't know what the right #define is for BSD/OS. + * but I don't know what the right #define is for BSD/OS. The last + * release was in October 2003; if anybody cares about making this + * work on BSD/OS, give us a pull request for a change to make it work. */ #define DLT_ATM_RFC1483 11 /* LLC-encapsulated ATM */ @@ -188,12 +214,10 @@ * anything and doesn't appear to have ever used it for anything.) * * We define it as 18 on those platforms; it is, unfortunately, used - * for DLT_CIP in Suse 6.3, so we don't define it as DLT_PFSYNC - * in general. As the packet format for it, like that for - * DLT_PFLOG, is not only OS-dependent but OS-version-dependent, - * we don't support printing it in tcpdump except on OSes that - * have the relevant header files, so it's not that useful on - * other platforms. + * for DLT_CIP in SUSE 6.3, so we don't define it as 18 on all + * platforms. We define it as 121 on FreeBSD and as the same + * value that we assigned to LINKTYPE_PFSYNC on all remaining + * platforms. */ #if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__) || defined(__APPLE__) #define DLT_PFSYNC 18 @@ -238,10 +262,10 @@ * and the LINKTYPE_ value that appears in capture files, are the * same. * - * DLT_MATCHING_MIN is the lowest such value; DLT_MATCHING_MAX is + * DLT_HIGH_MATCHING_MIN is the lowest such value; DLT_HIGH_MATCHING_MAX is * the highest such value. */ -#define DLT_MATCHING_MIN 104 +#define DLT_HIGH_MATCHING_MIN 104 /* * This value was defined by libpcap 0.5; platforms that have defined @@ -1021,9 +1045,9 @@ #define DLT_AOS 222 /* - * Wireless HART (Highway Addressable Remote Transducer) + * WirelessHART (Highway Addressable Remote Transducer) * From the HART Communication Foundation - * IES/PAS 62591 + * IEC/PAS 62591 * * Requested by Sam Roberts <vieuxt...@gmail.com>. */ @@ -1558,15 +1582,15 @@ /* * In case the code that includes this file (directly or indirectly) - * has also included OS files that happen to define DLT_MATCHING_MAX, + * has also included OS files that happen to define DLT_HIGH_MATCHING_MAX, * with a different value (perhaps because that OS hasn't picked up * the latest version of our DLT definitions), we undefine the - * previous value of DLT_MATCHING_MAX. + * previous value of DLT_HIGH_MATCHING_MAX. */ -#ifdef DLT_MATCHING_MAX -#undef DLT_MATCHING_MAX +#ifdef DLT_HIGH_MATCHING_MAX +#undef DLT_HIGH_MATCHING_MAX #endif -#define DLT_MATCHING_MAX 289 /* highest value in the "matching" range */ +#define DLT_HIGH_MATCHING_MAX 289 /* highest value in the "matching" range */ /* * DLT and savefile link type values are split into a class and