diff options
-rw-r--r-- | epan/dissectors/packet-brdwlk.c | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-epl.c | 22 | ||||
-rw-r--r-- | epan/dissectors/packet-fc.c | 18 | ||||
-rw-r--r-- | epan/dissectors/packet-ieee80211.c | 30 | ||||
-rw-r--r-- | epan/dissectors/packet-mdshdr.c | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-ptpip.c | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-wol.c | 32 |
7 files changed, 66 insertions, 42 deletions
diff --git a/epan/dissectors/packet-brdwlk.c b/epan/dissectors/packet-brdwlk.c index ed426dbd50..2d676838d5 100644 --- a/epan/dissectors/packet-brdwlk.c +++ b/epan/dissectors/packet-brdwlk.c @@ -364,7 +364,7 @@ dissect_brdwlk(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } next_tvb = tvb_new_subset(tvb, 2, len, reported_len); - call_dissector(fc_dissector_handle, next_tvb, pinfo, tree); + call_dissector_with_data(fc_dissector_handle, next_tvb, pinfo, tree, GUINT_TO_POINTER((guint)ETHERTYPE_BRDWALK)); } static void diff --git a/epan/dissectors/packet-epl.c b/epan/dissectors/packet-epl.c index 7ec75f560d..3cf2ef2f05 100644 --- a/epan/dissectors/packet-epl.c +++ b/epan/dissectors/packet-epl.c @@ -686,11 +686,10 @@ elp_version( gchar *result, guint32 version ) /* Code to actually dissect the packets */ static int -dissect_epl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) +dissect_eplpdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean udpencap) { guint8 epl_mtyp, epl_src, epl_dest; const gchar *src_str, *dest_str; - gboolean udpencap = FALSE; /* static epl_info_t mi; */ /* Set up structures needed to add the protocol subtree and manage it */ proto_item *ti; @@ -704,16 +703,14 @@ dissect_epl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) } /* Make entries in Protocol column and Info column on summary display */ - if (pinfo->ethertype == ETHERTYPE_EPL_V2) + if (!udpencap) { col_set_str(pinfo->cinfo, COL_PROTOCOL, "EPL"); - udpencap = FALSE; } else { /* guess that this is an EPL frame encapsulated into an UDP datagram */ col_set_str(pinfo->cinfo, COL_PROTOCOL, "EPL/UDP"); - udpencap = TRUE; } /* @@ -858,6 +855,17 @@ dissect_epl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) return offset; } +static int +dissect_epl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) +{ + return dissect_eplpdu(tvb, pinfo, tree, FALSE); +} + +static int +dissect_epludp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) +{ + return dissect_eplpdu(tvb, pinfo, tree, TRUE); +} const gchar* @@ -2349,8 +2357,10 @@ proto_register_epl(void) void proto_reg_handoff_epl(void) { + dissector_handle_t epl_udp_handle = new_create_dissector_handle( dissect_epludp, proto_epl ); + dissector_add_uint("ethertype", ETHERTYPE_EPL_V2, epl_handle); - dissector_add_uint("udp.port", UDP_PORT_EPL, epl_handle); + dissector_add_uint("udp.port", UDP_PORT_EPL, epl_udp_handle); } /* diff --git a/epan/dissectors/packet-fc.c b/epan/dissectors/packet-fc.c index de4fa4a41a..5a60f14dc5 100644 --- a/epan/dissectors/packet-fc.c +++ b/epan/dissectors/packet-fc.c @@ -686,7 +686,7 @@ static const value_string fc_els_proto_val[] = { /* Code to actually dissect the packets */ static void -dissect_fc_helper (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean is_ifcp) +dissect_fc_helper (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean is_ifcp, guint ethertype) { /* Set up structures needed to add the protocol subtree and manage it */ proto_item *ti=NULL, *hidden_item; @@ -1087,13 +1087,13 @@ dissect_fc_helper (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean * and are never fragmented and so we ignore the frag_size assertion for * these frames. */ - if ((pinfo->ethertype == ETHERTYPE_UNK) || (pinfo->ethertype == ETHERTYPE_FCFT)) { + if ((ethertype == ETHERTYPE_UNK) || (ethertype == ETHERTYPE_FCFT)) { if ((frag_size < MDSHDR_TRAILER_SIZE) || ((frag_size == MDSHDR_TRAILER_SIZE) && (ftype != FC_FTYPE_LINKCTL) && (ftype != FC_FTYPE_BLS) && (ftype != FC_FTYPE_OHMS))) THROW(ReportedBoundsError); frag_size -= MDSHDR_TRAILER_SIZE; - } else if (pinfo->ethertype == ETHERTYPE_BRDWALK) { + } else if (ethertype == ETHERTYPE_BRDWALK) { if ((frag_size <= 8) || ((frag_size == MDSHDR_TRAILER_SIZE) && (ftype != FC_FTYPE_LINKCTL) && (ftype != FC_FTYPE_BLS) && (ftype != FC_FTYPE_OHMS))) @@ -1229,15 +1229,17 @@ dissect_fc_helper (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean tap_queue_packet(fc_tap, pinfo, &fchdr); } -static void -dissect_fc (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +static int +dissect_fc (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) { - dissect_fc_helper (tvb, pinfo, tree, FALSE); + dissect_fc_helper (tvb, pinfo, tree, FALSE, GPOINTER_TO_UINT(data)); + return tvb_length(tvb); } + static void dissect_fc_ifcp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - dissect_fc_helper (tvb, pinfo, tree, TRUE); + dissect_fc_helper (tvb, pinfo, tree, TRUE, 0); } static void @@ -1526,7 +1528,7 @@ proto_register_fc(void) /* Register the protocol name and description */ proto_fc = proto_register_protocol ("Fibre Channel", "FC", "fc"); - fc_handle = register_dissector ("fc", dissect_fc, proto_fc); + fc_handle = new_register_dissector ("fc", dissect_fc, proto_fc); register_dissector ("fc_ifcp", dissect_fc_ifcp, proto_fc); fc_tap = register_tap("fc"); diff --git a/epan/dissectors/packet-ieee80211.c b/epan/dissectors/packet-ieee80211.c index 4a6d531548..216aa87273 100644 --- a/epan/dissectors/packet-ieee80211.c +++ b/epan/dissectors/packet-ieee80211.c @@ -13587,7 +13587,7 @@ static void dissect_ieee80211_common (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean fixed_length_header, gint fcs_len, gboolean wlan_broken_fc, gboolean datapad, - gboolean is_ht) + gboolean is_ht, gboolean is_centrino) { guint16 fcf, flags, frame_type_subtype, ctrl_fcf, ctrl_type_subtype; guint16 seq_control; @@ -14962,7 +14962,7 @@ dissect_ieee80211_common (tvbuff_t *tvb, packet_info *pinfo, } /* Davide Schiera (2006-11-21) ---------------------------------- */ - if ((pinfo->ethertype != ETHERTYPE_CENTRINO_PROMISC) && (wlan_ignore_wep == WLAN_IGNORE_WEP_NO)) { + if ((!is_centrino) && (wlan_ignore_wep == WLAN_IGNORE_WEP_NO)) { /* Some wireless drivers (such as Centrino) WEP payload already decrypted */ call_dissector(data_handle, next_tvb, pinfo, tree); goto end_of_wlan; @@ -15218,7 +15218,17 @@ static void dissect_ieee80211 (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { dissect_ieee80211_common (tvb, pinfo, tree, FALSE, - pinfo->pseudo_header->ieee_802_11.fcs_len, FALSE, FALSE, FALSE); + pinfo->pseudo_header->ieee_802_11.fcs_len, FALSE, FALSE, FALSE, FALSE); +} + +/* + * Dissect 802.11 with a variable-length link-layer header. + */ +static void +dissect_ieee80211_centrino(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) +{ + dissect_ieee80211_common (tvb, pinfo, tree, FALSE, + pinfo->pseudo_header->ieee_802_11.fcs_len, FALSE, FALSE, FALSE, TRUE); } /* @@ -15228,7 +15238,7 @@ static void dissect_ieee80211_datapad (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { dissect_ieee80211_common (tvb, pinfo, tree, FALSE, - pinfo->pseudo_header->ieee_802_11.fcs_len, FALSE, TRUE, FALSE); + pinfo->pseudo_header->ieee_802_11.fcs_len, FALSE, TRUE, FALSE, FALSE); } /* @@ -15239,7 +15249,7 @@ dissect_ieee80211_datapad (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) static void dissect_ieee80211_bsfc (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - dissect_ieee80211_common (tvb, pinfo, tree, FALSE, 0, TRUE, FALSE, FALSE); + dissect_ieee80211_common (tvb, pinfo, tree, FALSE, 0, TRUE, FALSE, FALSE, FALSE); } /* @@ -15249,7 +15259,7 @@ dissect_ieee80211_bsfc (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) static void dissect_ieee80211_fixed (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - dissect_ieee80211_common (tvb, pinfo, tree, TRUE, 0, FALSE, FALSE, FALSE); + dissect_ieee80211_common (tvb, pinfo, tree, TRUE, 0, FALSE, FALSE, FALSE, FALSE); } /* @@ -15261,7 +15271,7 @@ static void dissect_ieee80211_ht (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { dissect_ieee80211_common (tvb, pinfo, tree, FALSE, - pinfo->pseudo_header->ieee_802_11.fcs_len, FALSE, FALSE, TRUE); + pinfo->pseudo_header->ieee_802_11.fcs_len, FALSE, FALSE, TRUE, FALSE); } static void @@ -21931,7 +21941,7 @@ proto_register_ieee80211 (void) void proto_reg_handoff_ieee80211(void) { - dissector_handle_t data_encap_handle; + dissector_handle_t data_encap_handle, centrino_handle; /* * Get handles for the LLC, IPX and Ethernet dissectors. @@ -21943,7 +21953,9 @@ proto_reg_handoff_ieee80211(void) ieee80211_handle = find_dissector("wlan"); dissector_add_uint("wtap_encap", WTAP_ENCAP_IEEE_802_11, ieee80211_handle); - dissector_add_uint("ethertype", ETHERTYPE_CENTRINO_PROMISC, ieee80211_handle); + + centrino_handle = create_dissector_handle( dissect_ieee80211_centrino, proto_wlan ); + dissector_add_uint("ethertype", ETHERTYPE_CENTRINO_PROMISC, centrino_handle); /* Register handoff to Aruba GRE */ dissector_add_uint("gre.proto", GRE_ARUBA_8200, ieee80211_handle); diff --git a/epan/dissectors/packet-mdshdr.c b/epan/dissectors/packet-mdshdr.c index 9d8513f9d4..4bf7c9ac01 100644 --- a/epan/dissectors/packet-mdshdr.c +++ b/epan/dissectors/packet-mdshdr.c @@ -240,7 +240,7 @@ dissect_mdshdr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Call the Fibre Channel dissector */ if (fc_dissector_handle) { - call_dissector(fc_dissector_handle, next_tvb, pinfo, tree); + call_dissector_with_data(fc_dissector_handle, next_tvb, pinfo, tree, GUINT_TO_POINTER((guint)ETHERTYPE_FCFT)); } else { call_dissector(data_handle, next_tvb, pinfo, tree); diff --git a/epan/dissectors/packet-ptpip.c b/epan/dissectors/packet-ptpip.c index 4a6b6488f7..4d55cbae57 100644 --- a/epan/dissectors/packet-ptpip.c +++ b/epan/dissectors/packet-ptpip.c @@ -623,7 +623,7 @@ void proto_reg_handoff_ptpIP( void ) { dissector_handle_t ptpIP_handle; - /* Use new_create_dissector_handle() to indicate that dissect_wol() + /* Use new_create_dissector_handle() to indicate that dissect_ptpIP() * returns the number of bytes it dissected (or 0 if it thinks the packet * does not belong to PROTONAME). */ diff --git a/epan/dissectors/packet-wol.c b/epan/dissectors/packet-wol.c index 465a2fcea5..8a87c68a9e 100644 --- a/epan/dissectors/packet-wol.c +++ b/epan/dissectors/packet-wol.c @@ -62,26 +62,19 @@ #include <epan/addr_resolv.h> #include <epan/etypes.h> -/* IF PROTO exposes code to other dissectors, then it must be exported - in a header file. If not, a header file is not needed at all. */ -/* #include "packet-wol.h" */ - /* Initialize the protocol and registered fields */ static int proto_wol = -1; static int hf_wol_sync = -1; static int hf_wol_mac = -1; static int hf_wol_passwd = -1; -/* Global sample preference ("controls" display of numbers) */ -/* static gboolean gPREF_HEX = FALSE; */ - /* Initialize the subtree pointers */ static gint ett_wol = -1; static gint ett_wol_macblock = -1; /* Code to actually dissect the packets */ static int -dissect_wol(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) +dissect_wol_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) { guint len; gint offset; @@ -259,14 +252,22 @@ dissect_wol(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) 6, passwd, "%s", passwd); } -/* If this protocol has a sub-dissector call it here, see section 1.8 */ + return (len); +} -/* Return the amount of data this dissector was able to dissect */ - if ( pinfo->ethertype == ETHERTYPE_WOL ) - return (len); +static int +dissect_wol(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) +{ + return dissect_wol_pdu(tvb, pinfo, tree, data); +} - /* Heuristic dissectors return TRUE/FALSE. */ - return (TRUE); +static gboolean +dissect_wolheur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) +{ + if (dissect_wol_pdu(tvb, pinfo, tree, data) > 0) + return TRUE; + + return FALSE; } @@ -306,7 +307,6 @@ proto_register_wol(void) proto_register_subtree_array(ett, array_length(ett)); } - /* If this dissector uses sub-dissector registration add a registration routine. This exact format is required because a script is used to find these routines and create the code that calls these routines. @@ -333,7 +333,7 @@ proto_reg_handoff_wol(void) * we'll miss some, but how else to do this ... add a thousand of * these dissector_add_uint()'s and heur_dissector_add()'s??? */ dissector_add_uint("ethertype", ETHERTYPE_WOL, wol_handle); - heur_dissector_add("udp", dissect_wol, proto_wol); + heur_dissector_add("udp", dissect_wolheur, proto_wol); } /* |