From Stephen Fisher:
authoretxrab <etxrab@f5534014-38df-0310-8fa8-9805f1628bb7>
Wed, 2 Aug 2006 17:01:38 +0000 (17:01 +0000)
committeretxrab <etxrab@f5534014-38df-0310-8fa8-9805f1628bb7>
Wed, 2 Aug 2006 17:01:38 +0000 (17:01 +0000)
The time protocol (port 37) dissector (packet-time.c) currently only supports
UDP.  The protocol has an identical implementation over TCP as well.  This
patch adds support to the dissector for TCP time in addition to the UDP time
packets

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@18822 f5534014-38df-0310-8fa8-9805f1628bb7

epan/dissectors/packet-time.c

index cf40c855e8ca7a9edf99f6693b6c6155ab57d6fe..076d1bccad5ccd0ee701a3b89b279c59dd035e7c 100644 (file)
@@ -37,7 +37,8 @@ static int hf_time_time = -1;
 
 static gint ett_time = -1;
 
-#define UDP_PORT_TIME    37
+/* This dissector works for TCP and UDP time packets */
+#define TIME_PORT 37
 
 static void
 dissect_time(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
@@ -59,8 +60,8 @@ dissect_time(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
     time_tree = proto_item_add_subtree(ti, ett_time);
 
     proto_tree_add_text(time_tree, tvb, 0, 0,
-                       pinfo->srcport==UDP_PORT_TIME? "Type: Response":"Type: Request");
-    if (pinfo->srcport == UDP_PORT_TIME) {
+                       pinfo->srcport==TIME_PORT ? "Type: Response":"Type: Request");
+    if (pinfo->srcport == TIME_PORT) {
       /* seconds since 1900-01-01 00:00:00 GMT, *not* 1970 */
       guint32 delta_seconds = tvb_get_ntohl(tvb, 0);
       proto_tree_add_uint_format(time_tree, hf_time_time, tvb, 0, 4,
@@ -95,5 +96,6 @@ proto_reg_handoff_time(void)
   dissector_handle_t time_handle;
 
   time_handle = create_dissector_handle(dissect_time, proto_time);
-  dissector_add("udp.port", UDP_PORT_TIME, time_handle);
+  dissector_add("udp.port", TIME_PORT, time_handle);
+  dissector_add("tcp.port", TIME_PORT, time_handle);
 }