aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStig Bjørlykke <stig@bjorlykke.org>2008-10-13 12:55:16 +0000
committerStig Bjørlykke <stig@bjorlykke.org>2008-10-13 12:55:16 +0000
commite08522f0dd5c6032b7a6688f64969971c0512f90 (patch)
tree1707da7973d5a5f06aee38e14b68179c18001738
parent49fe94aa3f38d512bc56f8dc3f5e299cb4feba6e (diff)
From Florian Lohoff (bug 2959):
rudp looks up the ciscosm dissector for every single packet. Make this a one time in proto_handoff and use the dissector handle. While at it - decode the checksum when there is one. An indicator is that the header length has space for the checksum. Additionally we have seen "stray bytes" after the checksum we can't explain. So decode them as data when there are some. svn path=/trunk/; revision=26427
-rw-r--r--plugins/ciscosm/packet-sm.c27
-rw-r--r--plugins/rudp/packet-rudp.c31
2 files changed, 45 insertions, 13 deletions
diff --git a/plugins/ciscosm/packet-sm.c b/plugins/ciscosm/packet-sm.c
index dfd2280472..abe547f3fd 100644
--- a/plugins/ciscosm/packet-sm.c
+++ b/plugins/ciscosm/packet-sm.c
@@ -107,8 +107,10 @@ const value_string sm_pdu_type_value[] = {
};
/* TODO: Change to useful name once known */
+#define SM_PROTOCOL_X100 0x0100
#define SM_PROTOCOL_X101 0x0101
#define SM_PROTOCOL_X114 0x0114
+#define SM_PROTOCOL_X122 0x0122
/* Initialize the protocol and registered fields */
@@ -130,6 +132,7 @@ static int hf_sm_tag = -1;
static gint ett_sm = -1;
static dissector_handle_t sdp_handle;
+static dissector_handle_t data_handle;
/* Code to actually dissect the packets */
static void
@@ -167,6 +170,20 @@ dissect_sm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
protocol = tvb_get_ntohs(tvb,offset);
offset = offset + 2;
switch(protocol){
+ case SM_PROTOCOL_X100:
+ case SM_PROTOCOL_X122:
+ /* Protocol 0x100/0x122 only contains a length and then an EISUP packet */
+ proto_tree_add_item(sm_tree, hf_sm_len, tvb, offset, 2, FALSE);
+ length = tvb_get_ntohs(tvb,offset);
+ offset = offset + 2;
+ proto_item_set_len(ti, 8);
+
+ /* This should be the EISUP dissector but we havent got one
+ * right now - so decode it as data for now ... */
+ next_tvb = tvb_new_subset(tvb, offset, length, length);
+ call_dissector(data_handle, next_tvb, pinfo, sm_tree);
+
+ break;
case SM_PROTOCOL_X101:
/* XXX Reveres enginered so this may not be correct!!!
* EISUP - used between Cisco HSI and Cisco PGW devices,
@@ -189,7 +206,7 @@ dissect_sm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
offset = offset + 1;
/* XXX Problem are tags 1 or two bytes???*/
proto_tree_add_item(sm_tree, hf_sm_tag, tvb, offset, 2, FALSE);
-
+
tag = tvb_get_ntohs(tvb,offset);
offset = offset +2;
if (tag== 0x01ac) {
@@ -219,7 +236,7 @@ dissect_sm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
offset = offset + 1;
/* XXX Problem are tags 1 or two bytes???*/
proto_tree_add_item(sm_tree, hf_sm_tag, tvb, offset, 2, FALSE);
-
+
tag = tvb_get_ntohs(tvb,offset);
offset = offset +2;
if (tag== 0x01ac) {
@@ -234,10 +251,11 @@ dissect_sm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
break;
default:
proto_tree_add_item(sm_tree, hf_sm_msg_id, tvb, offset, 2, FALSE);
- msg_type = tvb_get_ntohs(tvb,offset);
offset = offset +2;
+ msg_type = tvb_get_ntohs(tvb,offset);
proto_tree_add_uint_format(sm_tree, hf_sm_msg_type, tvb, offset, 2, msg_type,
- "Message type: %s (0x%0x)", val_to_str(msg_type, sm_pdu_type_value, "reserved"), msg_type);
+ "Message type: %s (0x%0x)", val_to_str(msg_type, sm_pdu_type_value, "reserved"),
+ msg_type);
msg_type = tvb_get_ntohs(tvb,offset);
offset = offset + 2;
proto_tree_add_item(sm_tree, hf_sm_channel, tvb, offset, 2, FALSE);
@@ -262,6 +280,7 @@ void
proto_reg_handoff_sm(void)
{
sdp_handle = find_dissector("sdp");
+ data_handle = find_dissector("data");
}
void
diff --git a/plugins/rudp/packet-rudp.c b/plugins/rudp/packet-rudp.c
index b38e1026d9..1aa250564a 100644
--- a/plugins/rudp/packet-rudp.c
+++ b/plugins/rudp/packet-rudp.c
@@ -76,11 +76,14 @@ static int hf_rudp_flags_0 = -1;
static int hf_rudp_hlen = -1;
static int hf_rudp_seq = -1;
static int hf_rudp_ack = -1;
-/* static int hf_rudp_cksum = -1; */
+static int hf_rudp_cksum = -1;
static gint ett_rudp = -1;
static gint ett_rudp_flags = -1;
+static dissector_handle_t sm_handle = NULL;
+static dissector_handle_t data_handle = NULL;
+
static void
dissect_rudp(tvbuff_t *tvb, packet_info *pinfo _U_ , proto_tree *tree)
@@ -121,11 +124,23 @@ dissect_rudp(tvbuff_t *tvb, packet_info *pinfo _U_ , proto_tree *tree)
proto_tree_add_item(rudp_tree, hf_rudp_hlen, tvb, 1, 1, FALSE);
proto_tree_add_item(rudp_tree, hf_rudp_seq, tvb, 2, 1, FALSE);
proto_tree_add_item(rudp_tree, hf_rudp_ack, tvb, 3, 1, FALSE);
+
+ /* If the header is more than 4 bytes the next 2 bytes are the checksum */
+ if (hlen > 4) {
+ proto_tree_add_item(rudp_tree, hf_rudp_cksum, tvb, 4, 2, FALSE);
+ }
+
+ /* If we have even more bytes their meaning is unknown - we have seen this
+ * in live captures */
+ if (hlen > 6) {
+ next_tvb = tvb_new_subset(tvb, 6, hlen-6, hlen-6);
+ call_dissector(data_handle, next_tvb, pinfo, rudp_tree);
+ }
}
next_tvb = tvb_new_subset(tvb, hlen, -1, -1);
- if (tvb_length(next_tvb) && find_dissector("sm"))
- call_dissector(find_dissector("sm"), next_tvb, pinfo, tree);
+ if (tvb_length(next_tvb) && sm_handle)
+ call_dissector(sm_handle, next_tvb, pinfo, tree);
}
void
@@ -193,16 +208,11 @@ proto_register_rudp(void)
FT_UINT8, BASE_DEC, NULL, 0x0,
"Acknowledgement Number", HFILL }
},
- /*
-
- A checksum is specified in the RFC, but Cisco don't use one.
-
{ &hf_rudp_cksum,
{ "Checksum", "rudp.cksum",
- FT_UINT16, 8, NULL, 0x0,
+ FT_UINT16, BASE_HEX, NULL, 0x0,
"", HFILL }
},
- */
};
@@ -246,4 +256,7 @@ proto_reg_handoff_rudp(void) {
}
dissector_add("udp.port", udp_port, rudp_handle);
+
+ sm_handle = find_dissector("sm");
+ data_handle = find_dissector("data");
}