summaryrefslogtreecommitdiff
blob: df4b85b055dc7820d2eb479bf7036319c98f4d30 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
--- ipppd/options.c.orig	2005-08-07 15:47:50.000000000 +0200
+++ ipppd/options.c	2005-08-21 00:01:06.000000000 +0200
@@ -2633,6 +2633,10 @@
 
 #ifdef IPPP_FILTER
 
+#if !defined(DLT_PPP_WITHDIRECTION) && defined(DLT_PPP_WITH_DIRECTION)
+#define DLT_PPP_WITHDIRECTION DLT_PPP_WITH_DIRECTION
+#endif
+	
 #ifndef DLT_PPP_PPPD
 #define DLT_PPP_PPPD	DLT_PPP
 #warning "please update your pcap version to support in/outbound DLT_PPP_PPPD filter"
@@ -2646,9 +2650,17 @@
     int argc;
     char **argv;
 {
-    if (pcap_compile_nopcap(65535, DLT_PPP_PPPD, &pass_filter, *argv, 1, netmask) == 0)
+    pcap_t* pc = pcap_open_dead (DLT_PPP_WITHDIRECTION, PPP_HDRLEN);
+    if (!pc) {
+        option_error("error in pass-filter expression: pcap_open_dead failed\n");
+        return 0;
+    }
+    if (pcap_compile(pc, &pass_filter, *argv, 1, netmask) == 0) {
+        pcap_close(pc);
         return 1;
+    }
     option_error("error in pass-filter expression.\n");
+    pcap_close(pc);
     return 0;
 }
 
@@ -2660,9 +2672,17 @@
     int argc;
     char **argv;
 {
-    if (pcap_compile_nopcap(65535, DLT_PPP_PPPD, &active_filter, *argv, 1, netmask) == 0)
+    pcap_t* pc = pcap_open_dead (DLT_PPP_WITHDIRECTION, PPP_HDRLEN);
+    if (!pc) {
+        option_error("error in active-filter expression: pcap_open_dead failed\n");
+        return 0;
+    }
+    if (pcap_compile(pc, &active_filter, *argv, 1, netmask) == 0) {
+        pcap_close(pc);
         return 1;
+    }
     option_error("error in active-filter expression.\n");
+    pcap_close(pc);
     return 0;
 }
 #endif /* IPPP_FILTER */