]> The Tcpdump Group git mirrors - libpcap/commitdiff
Don't put bpf_filter_with_aux_data() in a public header file.
authorGuy Harris <[email protected]>
Sat, 1 Sep 2018 02:53:01 +0000 (19:53 -0700)
committerGuy Harris <[email protected]>
Sat, 1 Sep 2018 02:53:17 +0000 (19:53 -0700)
Don't put struct bpf_aux_data there, either.

bpf_filter_with_aux_data() is an internal-only routine, and struct
bpf_aux_data is a data structure subject to change in the future; don't
make them public, so that we *can* change it in the future without
having to worry about breaking APIs or ABIs.

(Note to any upstream packager of libpcap: if you've made it public,
so that it's exported by a shared libary, that was a mistake, so undo
it.)

bpf_filter.c
pcap-int.h
pcap/bpf.h

index ebf118f42d829586a2df6ba28e96f42c7d6d990f..93c337643ee8baf327202fd481c484a8a198562f 100644 (file)
@@ -44,7 +44,6 @@
 
 #include <pcap/pcap-inttypes.h>
 #include "pcap-types.h"
-#include "varattrs.h"
 #include "extract.h"
 
 #define EXTRACT_SHORT  EXTRACT_BE_U_2
@@ -56,7 +55,7 @@
 #include <sys/time.h>
 #endif /* _WIN32 */
 
-#include <pcap/bpf.h>
+#include <pcap-int.h>
 
 #include <stdlib.h>
 
index 210368228beca4b56b1e39ec3b75f819bd59df46..ca204b4d8f6b52291158d3cd9946b8be5c38e770 100644 (file)
@@ -478,6 +478,28 @@ int        add_addr_to_if(pcap_if_list_t *, const char *, bpf_u_int32,
 pcap_t *pcap_open_offline_common(char *ebuf, size_t size);
 void   sf_cleanup(pcap_t *p);
 
+/*
+ * Internal interfaces for doing user-mode filtering of packets and
+ * validating filter programs.
+ */
+/*
+ * Auxiliary data, for use when interpreting a filter intended for the
+ * Linux kernel when the kernel rejects the filter (requiring us to
+ * run it in userland).  It contains VLAN tag information.
+ */
+struct bpf_aux_data {
+       u_short vlan_tag_present;
+       u_short vlan_tag;
+};
+
+/*
+ * Filtering routine that takes the auxiliary data as an additional
+ * argument.
+ */
+extern u_int bpf_filter_with_aux_data(const struct bpf_insn *pc,
+    const u_char *p, u_int wirelen, u_int buflen,
+    const struct bpf_aux_data *aux_data);
+
 /*
  * Internal interfaces for both "pcap_create()" and routines that
  * open savefiles.
index 742a3428e1fbc879e558f4a2d42fd8213d7f945c..6cb5b7d21c08c5c62895b98b4c25e940eb4dc516 100644 (file)
@@ -238,16 +238,6 @@ struct bpf_insn {
        bpf_u_int32 k;
 };
 
-/*
- * Auxiliary data, for use when interpreting a filter intended for the
- * Linux kernel when the kernel rejects the filter (requiring us to
- * run it in userland).  It contains VLAN tag information.
- */
-struct bpf_aux_data {
-       u_short vlan_tag_present;
-       u_short vlan_tag;
-};
-
 /*
  * Macros for insn array initializers.
  */
@@ -264,7 +254,6 @@ struct bpf_aux_data {
 #if !defined(__NetBSD__) && !defined(__QNX__)
   PCAP_API u_int       bpf_filter(const struct bpf_insn *, const u_char *, u_int, u_int);
 #endif
-extern u_int bpf_filter_with_aux_data(const struct bpf_insn *, const u_char *, u_int, u_int, const struct bpf_aux_data *);
 PCAP_API int   bpf_validate(const struct bpf_insn *f, int len);
 PCAP_API char  *bpf_image(const struct bpf_insn *, int);
 PCAP_API void  bpf_dump(const struct bpf_program *, int);