From fce8544c7e93b1001784e7e3607f4ef0eae56bee Mon Sep 17 00:00:00 2001 From: Daniel Borkmann Date: Wed, 10 Jul 2013 16:30:03 +0200 Subject: dissector: print hex_ascii combination in unkown linktypes Commit f5c10ae4e3 ("dissector: do not panic on unknown hatype") let netsniff-ng not panic anymore on unkown ha types, but without explicitly starting netsniff-ng in hex or ascii printing mode, no dissection will happen. This patch fixes this situation so that at least ascii_hex() will be called in case the link type is not known to us. Signed-off-by: Daniel Borkmann --- dissector.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'dissector.c') diff --git a/dissector.c b/dissector.c index 8662424..549ce1e 100644 --- a/dissector.c +++ b/dissector.c @@ -61,9 +61,8 @@ static void dissector_main(struct pkt_buff *pkt, struct protocol *start, void dissector_entry_point(uint8_t *packet, size_t len, int linktype, int mode) { - bool skip_dissecting = false; struct protocol *proto_start, *proto_end; - struct pkt_buff *pkt = NULL; + struct pkt_buff *pkt; if (mode == PRINT_NONE) return; @@ -82,12 +81,12 @@ void dissector_entry_point(uint8_t *packet, size_t len, int linktype, int mode) proto_end = dissector_get_ieee80211_exit_point(); break; default: - skip_dissecting = true; + proto_start = &none_ops; + proto_end = NULL; break; }; - if (!skip_dissecting) - dissector_main(pkt, proto_start, proto_end); + dissector_main(pkt, proto_start, proto_end); switch (mode) { case PRINT_HEX: -- cgit v1.2.3-54-g00ecf