diff options
-rw-r--r-- | bpf.c | 2 | ||||
-rw-r--r-- | netsniff-ng.c | 7 |
2 files changed, 2 insertions, 7 deletions
@@ -720,6 +720,8 @@ void bpf_parse_rules(char *rulefile, struct sock_fprog *bpf, uint32_t link_type) struct sock_filter sf_single = { 0x06, 0, 0, 0xFFFFFFFF }; FILE *fp; + fmemset(bpf, 0, sizeof(*bpf)); + if (rulefile == NULL) { bpf->len = 1; bpf->filter = xmalloc(sizeof(sf_single)); 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); |