summaryrefslogtreecommitdiff
path: root/netsniff-ng.c
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2014-05-12 09:09:26 +0200
committerTobias Klauser <tklauser@distanz.ch>2014-05-12 09:12:08 +0200
commitf2154ee8285abee46028afff19e6bf2cb4794efc (patch)
treeadf381482dc3682c8fa5b7ee8764ad5b71307826 /netsniff-ng.c
parent9a40de458b3884d9f526172110392501f075bd87 (diff)
bpf: Zero out socket filter in bpf_parse_rules()
Instead of memsetting the struct sock_filter every time before we call bpf_parse_rules(), do it there directly. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Diffstat (limited to 'netsniff-ng.c')
-rw-r--r--netsniff-ng.c7
1 files changed, 0 insertions, 7 deletions
diff --git a/netsniff-ng.c b/netsniff-ng.c
index bee7f98..c126115 100644
--- a/netsniff-ng.c
+++ b/netsniff-ng.c
@@ -209,8 +209,6 @@ static void pcap_to_xmit(struct ctx *ctx)
panic("Error prepare reading pcap!\n");
}
- fmemset(&bpf_ops, 0, sizeof(bpf_ops));
-
if (ctx->rfraw) {
ctx->device_trans = xstrdup(ctx->device_out);
xfree(ctx->device_out);
@@ -354,8 +352,6 @@ static void receive_to_xmit(struct ctx *ctx)
rx_sock = pf_socket();
tx_sock = pf_socket();
- fmemset(&bpf_ops, 0, sizeof(bpf_ops));
-
ifindex_in = device_ifindex(ctx->device_in);
ifindex_out = device_ifindex(ctx->device_out);
@@ -546,7 +542,6 @@ static void read_pcap(struct ctx *ctx)
}
fmemset(&fm, 0, sizeof(fm));
- fmemset(&bpf_ops, 0, sizeof(bpf_ops));
bpf_parse_rules(ctx->filter, &bpf_ops, ctx->link_type);
if (ctx->dump_bpf)
@@ -880,8 +875,6 @@ static void recv_only_or_dump(struct ctx *ctx)
ctx->link_type = LINKTYPE_IEEE802_11;
}
- fmemset(&bpf_ops, 0, sizeof(bpf_ops));
-
ifindex = device_ifindex(ctx->device_in);
size = ring_size(ctx->device_in, ctx->reserve_size);