1 diff -Naur ppp-2.4.4.orig/pppd/Makefile.linux ppp-2.4.4/pppd/Makefile.linux
2 --- ppp-2.4.4.orig/pppd/Makefile.linux 2009-05-07 22:31:54.000000000 -0400
3 +++ ppp-2.4.4/pppd/Makefile.linux 2009-05-07 22:33:12.000000000 -0400
5 # and that the kernel driver support PPP packet filtering.
8 +# Support for precompiled filters
11 # Uncomment the next line to enable multilink PPP (enabled by default)
12 # Linux distributions: Please leave multilink ENABLED in your builds
18 +ifdef PRECOMPILED_FILTER
19 +PPPDSRCS += pcap_pcc.c
20 +HEADERS += pcap_pcc.h
21 +PPPDOBJS += pcap_pcc.o
22 +LIBS += $(STAGING_DIR)/usr/lib/libpcap.a
23 +CFLAGS += -DPPP_FILTER -DPPP_PRECOMPILED_FILTER -I$(STAGING_DIR)/usr/include
27 PPPDSRCS += ipv6cp.c eui64.c
28 HEADERS += ipv6cp.h eui64.h
29 diff -Naur ppp-2.4.4.orig/pppd/options.c ppp-2.4.4/pppd/options.c
30 --- ppp-2.4.4.orig/pppd/options.c 2009-05-07 22:25:24.000000000 -0400
31 +++ ppp-2.4.4/pppd/options.c 2009-05-07 22:38:28.000000000 -0400
36 +#include <pcap-bpf.h>
38 * There have been 3 or 4 different names for this in libpcap CVS, but
39 * this seems to be what they have settled on...
41 static int loadplugin __P((char **));
44 +#ifdef PPP_PRECOMPILED_FILTER
45 +#include "pcap_pcc.h"
46 +static int setprecompiledpassfilter __P((char **));
47 +static int setprecompiledactivefilter __P((char **));
52 static int setpassfilter __P((char **));
53 static int setactivefilter __P((char **));
55 "set filter for active pkts", OPT_PRIO },
58 +#ifdef PPP_PRECOMPILED_FILTER
59 + { "precompiled-pass-filter", 1, setprecompiledpassfilter,
60 + "set precompiled filter for packets to pass", OPT_PRIO },
62 + { "precompiled-active-filter", 1, setprecompiledactivefilter,
63 + "set precompiled filter for active pkts", OPT_PRIO },
67 { "maxoctets", o_int, &maxoctets,
68 "Set connection traffic limit",
69 @@ -1456,6 +1472,29 @@
73 +#ifdef PPP_PRECOMPILED_FILTER
75 + * setprecompiledpassfilter - Set the pass filter for packets using a
76 + * precompiled expression
79 +setprecompiledpassfilter(argv)
82 + return pcap_pre_compiled (*argv, &pass_filter);
86 + * setactivefilter - Set the active filter for packets
89 +setprecompiledactivefilter(argv)
92 + return pcap_pre_compiled (*argv, &active_filter);
98 * setpassfilter - Set the pass filter for packets
99 diff -Naur ppp-2.4.4.orig/pppd/pcap_pcc.c ppp-2.4.4/pppd/pcap_pcc.c
100 --- ppp-2.4.4.orig/pppd/pcap_pcc.c 1969-12-31 19:00:00.000000000 -0500
101 +++ ppp-2.4.4/pppd/pcap_pcc.c 2009-05-07 22:33:12.000000000 -0400
104 +#include <pcap-bpf.h>
111 +int pcap_pre_compiled (char * fname, struct bpf_program *p)
114 + int line = 0, size = 0, index=0, ret=1;
115 + FILE *f = fopen (fname, "r");
118 + option_error("error opening precompiled active-filter '%s': %s",
119 + fname, strerror (errno));
122 + while (fgets (buf, 127, f))
137 + struct bpf_insn * insn = & p->bf_insns[index];
138 + unsigned code, jt, jf, k;
139 + if (sscanf (buf, "%u %u %u %u", &code, &jt, &jf, &k) != 4)
151 + if (sscanf (buf, "%u", &size) != 1)
156 + p->bf_insns = (struct bpf_insn *)
157 + malloc (size * sizeof (struct bpf_insn));
162 + option_error("error in precompiled active-filter,"
163 + " expected %d expressions, got %dn",
171 + option_error("error in precompiled active-filter"
172 + " expression line %s:%d (wrong size)\n",
177 diff -Naur ppp-2.4.4.orig/pppd/pcap_pcc.h ppp-2.4.4/pppd/pcap_pcc.h
178 --- ppp-2.4.4.orig/pppd/pcap_pcc.h 1969-12-31 19:00:00.000000000 -0500
179 +++ ppp-2.4.4/pppd/pcap_pcc.h 2009-05-07 22:33:12.000000000 -0400
186 +int pcap_pre_compiled (char * fname, struct bpf_program *p);
187 +#endif /* PCAP_PCC_H */