summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2016-12-16 11:47:58 +0100
committerTobias Klauser <tklauser@distanz.ch>2016-12-16 11:47:58 +0100
commit074f8fc82ff26bb02c3c09f6ed71bca77e08e020 (patch)
treee94d6c37189436a21e8bd780c35ab1d85463737d
parent3608cf700a27240e343d1173f5782a0398102c16 (diff)
bpf: Fix confusing panic() message
When using a filter with netsniff-ng without libpcap support, e.g. $ netsniff-ng --in eth0 tcp or udp we get the error: Cannot compile filter tcp or udp which isn't correct and might be confusing for the user as the intention wasn't to specify a filter file but a filter string. Correct the error message accordingly. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
-rw-r--r--bpf.h2
-rw-r--r--bpf_comp.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/bpf.h b/bpf.h
index bbd05c1..3b0fef5 100644
--- a/bpf.h
+++ b/bpf.h
@@ -27,7 +27,7 @@ static inline void bpf_try_compile(const char *rulefile,
struct sock_fprog *bpf __maybe_unused,
uint32_t link_type __maybe_unused)
{
- panic("Cannot open file %s!\n", rulefile);
+ panic("No libpcap support, cannot compile filter: %s\n", rulefile);
}
#endif
static inline void bpf_release(struct sock_fprog *bpf)
diff --git a/bpf_comp.c b/bpf_comp.c
index 3434daf..eca2507 100644
--- a/bpf_comp.c
+++ b/bpf_comp.c
@@ -21,7 +21,7 @@ void bpf_try_compile(const char *rulefile, struct sock_fprog *bpf, uint32_t link
ret = pcap_compile_nopcap(65535, link_type, &_bpf, rulefile, 1, 0xffffffff);
if (ret < 0)
- panic("Cannot compile filter %s\n", rulefile);
+ panic("Cannot compile filter: %s\n", rulefile);
bpf->len = _bpf.bf_len;
bpf->filter = xrealloc(bpf->filter, bpf->len * sizeof(*out));