summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZheng Da <zhengda1936@gmail.com>2009-07-31 18:35:53 +0200
committerThomas Schwinge <schwinge@nic-nac-project.de>2009-10-14 09:53:39 +0200
commiteaf8602d9c8e9058cadc66acea5b4ad92fd808e3 (patch)
treed5b9644ca7af310b00632a74e9b8584b95327d95
parente87eb2a97594f692fe249d3ad30911deb0bc61c5 (diff)
Apply patch #6851: fix a bug in BPF
* net_io.c (net_filter): Correct the amount of data of a packet accepted by BPF.
-rw-r--r--device/net_io.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/device/net_io.c b/device/net_io.c
index a6f842e..2311599 100644
--- a/device/net_io.c
+++ b/device/net_io.c
@@ -771,13 +771,16 @@ net_filter(kmsg, send_list)
if ((infp->filter[0] & NETF_TYPE_MASK) == NETF_BPF) {
ret_count = bpf_do_filter(infp, net_kmsg(kmsg)->packet
+ sizeof(struct packet_header),
- count, net_kmsg(kmsg)->header,
+ count - sizeof(struct packet_header),
+ net_kmsg(kmsg)->header,
ifp->if_header_size, &hash_headp,
&entp);
if (entp == (net_hash_entry_t) 0)
dest = infp->rcv_port;
else
dest = entp->rcv_port;
+ if (ret_count)
+ ret_count += sizeof(struct packet_header);
} else {
ret_count = net_do_filter(infp, net_kmsg(kmsg)->packet, count,
net_kmsg(kmsg)->header);