diff options
author | rbalint <rbalint@f5534014-38df-0310-8fa8-9805f1628bb7> | 2010-09-12 01:13:42 +0000 |
---|---|---|
committer | rbalint <rbalint@f5534014-38df-0310-8fa8-9805f1628bb7> | 2010-09-12 01:13:42 +0000 |
commit | eac412473d98f446febe71f1b89c7cdd50409d10 (patch) | |
tree | b1df9b5bf0c0e110dae312676a517a79798e6e91 /epan/dissectors/packet-sll.c | |
parent | efcb2b50d4f55890310daadbb688a74768bdaef9 (diff) |
Decode SLL payloads using a dissector table based on sll.ltype.
The idea and the original patch came from Sebastian Reichel
<elektranox@gmail.com> in
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=594390
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@34101 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'epan/dissectors/packet-sll.c')
-rw-r--r-- | epan/dissectors/packet-sll.c | 49 |
1 files changed, 10 insertions, 39 deletions
diff --git a/epan/dissectors/packet-sll.c b/epan/dissectors/packet-sll.c index fe49d212f7..d6c1c9c79c 100644 --- a/epan/dissectors/packet-sll.c +++ b/epan/dissectors/packet-sll.c @@ -76,13 +76,6 @@ static const value_string packet_type_vals[] = { { 0, NULL } }; -/* - * The LINUX_SLL_ values for "sll_protocol". - */ -#define LINUX_SLL_P_802_3 0x0001 /* Novell 802.3 frames without 802.2 LLC header */ -#define LINUX_SLL_P_802_2 0x0004 /* 802.2 frames (not D/I/X Ethernet) */ -#define LINUX_SLL_P_PPPHDLC 0x0007 /* PPP HDLC frames */ - static const value_string ltype_vals[] = { { LINUX_SLL_P_802_3, "Raw 802.3" }, { LINUX_SLL_P_802_2, "802.2 LLC" }, @@ -90,10 +83,8 @@ static const value_string ltype_vals[] = { { 0, NULL } }; +static dissector_table_t sll_linux_dissector_table; static dissector_table_t gre_dissector_table; -static dissector_handle_t ipx_handle; -static dissector_handle_t llc_handle; -static dissector_handle_t ppphdlc_handle; static dissector_handle_t data_handle; void @@ -237,33 +228,9 @@ dissect_sll(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_uint(fh_tree, hf_sll_ltype, tvb, 14, 2, protocol); - switch (protocol) { - - case LINUX_SLL_P_802_2: - /* - * 802.2 LLC. - */ - call_dissector(llc_handle, next_tvb, pinfo, tree); - break; - - case LINUX_SLL_P_802_3: - /* - * Novell IPX inside 802.3 with no 802.2 LLC - * header. - */ - call_dissector(ipx_handle, next_tvb, pinfo, tree); - break; - - case LINUX_SLL_P_PPPHDLC: - /* - * PPP HDLC - */ - call_dissector(ppphdlc_handle, next_tvb, pinfo, tree); - break; - - default: + if(!dissector_try_port(sll_linux_dissector_table, protocol, + next_tvb, pinfo, tree)) { call_dissector(data_handle, next_tvb, pinfo, tree); - break; } } else { switch (hatype) { @@ -340,6 +307,13 @@ proto_register_sll(void) "SLL", "sll" ); proto_register_field_array(proto_sll, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + + sll_linux_dissector_table = register_dissector_table ( + "sll.ltype", + "Linux protocol type", + FT_UINT16, + BASE_HEX + ); } void @@ -351,9 +325,6 @@ proto_reg_handoff_sll(void) * Get handles for the IPX and LLC dissectors. */ gre_dissector_table = find_dissector_table("gre.proto"); - llc_handle = find_dissector("llc"); - ipx_handle = find_dissector("ipx"); - ppphdlc_handle = find_dissector("ppp_hdlc"); data_handle = find_dissector("data"); sll_handle = create_dissector_handle(dissect_sll, proto_sll); |