diff options
author | dsainty <dsainty@pkgsrc.org> | 2009-09-07 04:08:54 +0000 |
---|---|---|
committer | dsainty <dsainty@pkgsrc.org> | 2009-09-07 04:08:54 +0000 |
commit | 8996c64b0d8451a9fe307306fa5566e843f943f1 (patch) | |
tree | ac136a1864bb1f48ce3aba9ef6aee8413270940d /net/pppd | |
parent | 8c9cb3a58aee667468ae895bbbdd4c57ec82f3fb (diff) | |
download | pkgsrc-8996c64b0d8451a9fe307306fa5566e843f943f1.tar.gz |
Linux doesn't support direction-specific filters. Conform to the new
set_filters() interface introduced by Pkgsrc, but generate errors if
the outbound filters are defined.
Compile tested only (but it does at least compile!), on Linux with
/usr/include/pcap-bpf.h. No functional change on systems that previously
successfully built.
Diffstat (limited to 'net/pppd')
-rw-r--r-- | net/pppd/distinfo | 3 | ||||
-rw-r--r-- | net/pppd/patches/patch-bq | 59 |
2 files changed, 61 insertions, 1 deletions
diff --git a/net/pppd/distinfo b/net/pppd/distinfo index 9b5b0277061..95050f71885 100644 --- a/net/pppd/distinfo +++ b/net/pppd/distinfo @@ -1,4 +1,4 @@ -$NetBSD: distinfo,v 1.9 2009/08/06 15:41:54 dsainty Exp $ +$NetBSD: distinfo,v 1.10 2009/09/07 04:08:54 dsainty Exp $ SHA1 (ppp-2.4.3.tar.gz) = 5e2789f4dedc81943fa9f94c840cccc2407056f7 RMD160 (ppp-2.4.3.tar.gz) = 845821496bacb07d93bb7572a171854853ef722b @@ -45,3 +45,4 @@ SHA1 (patch-bm) = 27743760f1a5c385b5b17c0568e0736d5c3b08bb SHA1 (patch-bn) = 2527e7f82874ad3ffaa2585bb7939fbd62ee291a SHA1 (patch-bo) = 58edaa6a2a9d542da32f2fab678a01132235a9e0 SHA1 (patch-bp) = 34b533ae19a9006f5d09fdbe299ac30e693c20d0 +SHA1 (patch-bq) = bd0db5b52214b29ac858ae96018fc2d96cd4a82b diff --git a/net/pppd/patches/patch-bq b/net/pppd/patches/patch-bq new file mode 100644 index 00000000000..92621581acb --- /dev/null +++ b/net/pppd/patches/patch-bq @@ -0,0 +1,59 @@ +$NetBSD: patch-bq,v 1.1 2009/09/07 04:08:54 dsainty Exp $ + +Linux doesn't support direction-specific filters. Conform to the new +set_filters() interface, but generate errors if the outbound filters are +defined. + +--- pppd/sys-linux.c.orig 2009-09-07 15:42:24.000000000 +1200 ++++ pppd/sys-linux.c 2009-09-07 15:50:01.000000000 +1200 +@@ -1293,23 +1293,38 @@ + /* + * set_filters - set the active and pass filters in the kernel driver. + */ +-int set_filters(struct bpf_program *pass, struct bpf_program *active) ++int set_filters(struct bpf_program *pass_in, struct bpf_program *pass_out, ++ struct bpf_program *active_in, struct bpf_program *active_out) + { + struct sock_fprog fp; + +- fp.len = pass->bf_len; +- fp.filter = (struct sock_filter *) pass->bf_insns; +- if (ioctl(ppp_dev_fd, PPPIOCSPASS, &fp) < 0) { +- if (errno == ENOTTY) +- warn("kernel does not support PPP filtering"); +- else +- error("Couldn't set pass-filter in kernel: %m"); ++ if (pass_in->bf_len > 0) { ++ fp.len = pass_in->bf_len; ++ fp.filter = (struct sock_filter *) pass_in->bf_insns; ++ if (ioctl(ppp_dev_fd, PPPIOCSPASS, &fp) < 0) { ++ if (errno == ENOTTY) ++ warn("kernel does not support PPP filtering"); ++ else ++ error("Couldn't set pass-filter in kernel: %m"); ++ return 0; ++ } ++ } ++ if (pass_out->bf_len > 0) { ++ error("Linux doesn't support pass-filter-out, " ++ "use pass-filter-in for both directions."); + return 0; + } +- fp.len = active->bf_len; +- fp.filter = (struct sock_filter *) active->bf_insns; +- if (ioctl(ppp_dev_fd, PPPIOCSACTIVE, &fp) < 0) { +- error("Couldn't set active-filter in kernel: %m"); ++ if (active_in->bf_len > 0) { ++ fp.len = active_in->bf_len; ++ fp.filter = (struct sock_filter *) active_in->bf_insns; ++ if (ioctl(ppp_dev_fd, PPPIOCSACTIVE, &fp) < 0) { ++ error("Couldn't set active-filter in kernel: %m"); ++ return 0; ++ } ++ } ++ if (active_out->bf_len > 0) { ++ error("Linux doesn't support active-filter-out, " ++ "use active-filter-in for both directions."); + return 0; + } + return 1; |