Ethereal-dev: [ethereal-dev] Bug-fixes and time-protocol extention for ethereal-0.8.3

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Dietmar Petras <dietmar.petras@xxxxxxx>
Date: Wed, 9 Feb 2000 15:33:33 +0100
Dear ethereal developers,

enclosed please find a patch that does the following:

* fix a bug in packet-tftp.c dissecting TFTP Option Acknowledgement
  packets. The is no Block-Id in TFTP Option Acknowledgements, as it is
  in TFTP Acknowledgements.
* Extension of manuf by ethernet addresses from ELSA (my company), a german
  vendor of ISDN routers, cable modems, etc.
* New dissector for Time Protocol [RFC 0868]. That protocol works on port
  37 of UDP and TCP. The implementation in this patch only dissects the
  more usual UDP version. It could print the time in a more fashion way,
  but thats for a later version.

Regards,

	Dietmar

---------------------------------------------------------------------------
Dr. Dietmar Petras     Senior Expert
ELSA AG                Engineering Consumer Communications
Sonnenweg 11           Phone: +49-(0)241-606-4649
52070 Aachen           Fax:   +49-(0)241-606-4699
Germany                EMail: DPetras@xxxxxxx
---------------------------------------------------------------------------

diff -Naur ethereal-0.8.3/packet-tftp.c ethereal-0.8.3.new/packet-tftp.c
--- ethereal-0.8.3/packet-tftp.c	Thu Jan 27 10:40:58 2000
+++ ethereal-0.8.3.new/packet-tftp.c	Wed Feb  9 12:38:57 2000
@@ -167,9 +167,6 @@
 	  case OACK:
 	    proto_tree_add_text(tftp_tree, offset, 2, "Option Acknowledgement");
 	    offset += 2;
-	    i1 = pntohs(pd+offset);
-	    proto_tree_add_text(tftp_tree, offset, 2, "Block = %u", i1);
-	    offset += 2;
 	    while (offset < pi.captured_len) {
 	      int i2;
 	      i1 = strlen(pd+offset);			/* length of option */
diff -Naur ethereal-0.8.3/manuf ethereal-0.8.3.new/manuf
--- ethereal-0.8.3/manuf	Wed Feb  9 15:25:48 2000
+++ ethereal-0.8.3.new/manuf	Wed Feb  9 14:32:51 2000
@@ -140,6 +140,7 @@
 00:90:27	Intel
 00:90:b1	Cisco
 00:a0:24	3Com
+00:a0:57	ELSA
 00:aa:00	Intel
 00:c0:4f	Dell
 00:c0:95	Znyx            # Network Appliance
diff -Naur ethereal-0.8.3/packet-time.c ethereal-0.8.3.new/packet-time.c
--- ethereal-0.8.3/packet-time.c	Wed Feb  9 15:28:26 2000
+++ ethereal-0.8.3.new/packet-time.c	Wed Feb  9 15:29:16 2000
@@ -0,0 +1,88 @@
+/* packet-time.c
+ * Routines for time packet dissection
+ *
+ * Richard Sharpe <rsharpe@xxxxxxxxxx>
+ * Craig Newell <CraigN@xxxxxxxxxxxxxxxx>
+ *	RFC2347 TIME Option Extension
+ *
+ * $Id: packet-time.c,v 1.9 2000/01/27 07:09:15 guy Exp $
+ *
+ * Ethereal - Network traffic analyzer
+ * By Gerald Combs <gerald@xxxxxxxx>
+ * Copyright 1998 Gerald Combs
+ *
+ * Copied from packet-tftp.c
+ * 
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "packet.h"
+
+static int proto_time = -1;
+static int hf_time_time = -1;
+
+static gint ett_time = -1;
+
+void
+dissect_time(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
+{
+  proto_tree	*time_tree;
+  proto_item	*ti;
+  
+  if (check_col(fd, COL_PROTOCOL))
+    col_add_str(fd, COL_PROTOCOL, "TIME");
+  
+  if (check_col(fd, COL_INFO)) {
+    col_add_fstr(fd, COL_INFO, "TIME %s", pi.srcport == 37? "Response":"Request");
+  }
+  
+  if (tree) {
+    
+    ti = proto_tree_add_item(tree, proto_time, offset, END_OF_FRAME, NULL);
+    time_tree = proto_item_add_subtree(ti, ett_time);
+    
+    proto_tree_add_text(time_tree, offset, 0,
+			pi.srcport==37? "Type: Response":"Type: Request");
+    if (pi.srcport == 37) { 
+      guint32 delta_seconds = pntohl(pd+offset);
+      proto_tree_add_text(time_tree, offset, 4,
+			  " %lu seconds since midnight 1 January 1900 GMT",
+			  delta_seconds);
+    }
+  }
+}
+
+void
+proto_register_time(void)
+{
+
+  static hf_register_info hf[] = {
+    { &hf_time_time,
+      { "Time", "time",
+	FT_UINT32, BASE_DEC, NULL, 0x0,
+      	"Seconds since 00:00 (midnight) 1 January 1900 GMT" }}
+  };
+  static gint *ett[] = {
+    &ett_time,
+  };
+
+  proto_time = proto_register_protocol("Time Protocol", "time");
+  proto_register_field_array(proto_time, hf, array_length(hf));
+  proto_register_subtree_array(ett, array_length(ett));
+}
diff -Naur ethereal-0.8.3/packet-udp.c ethereal-0.8.3.new/packet-udp.c
--- ethereal-0.8.3/packet-udp.c	Tue Feb  1 05:56:33 2000
+++ ethereal-0.8.3.new/packet-udp.c	Wed Feb  9 14:15:11 2000
@@ -66,6 +66,7 @@
 
 /* UDP Ports -> should go in packet-udp.h */
 
+#define UDP_PORT_TIME    37
 #define UDP_PORT_TACACS  49
 #define UDP_PORT_DNS     53
 #define UDP_PORT_BOOTPS  67
@@ -303,6 +304,9 @@
       /* This is the first point of call, but it adds a dynamic call */
       udp_hash_add(MAX(uh_sport, uh_dport), dissect_tftp);  /* Add to table */
       dissect_tftp(pd, offset, fd, tree);
+  } else if (PORT_IS(UDP_PORT_TIME)) {
+      /* This is the first point of call, but it adds a dynamic call */
+      dissect_time(pd, offset, fd, tree);
   } else if (PORT_IS(UDP_PORT_RADIUS) ||
 		PORT_IS(UDP_PORT_RADACCT) ||
 		PORT_IS(UDP_PORT_RADIUS_NEW) ||
diff -Naur ethereal-0.8.3/packet.h ethereal-0.8.3.new/packet.h
--- ethereal-0.8.3/packet.h	Tue Jan 25 11:43:37 2000
+++ ethereal-0.8.3.new/packet.h	Wed Feb  9 14:09:43 2000
@@ -401,6 +401,7 @@
 void dissect_tcp(const u_char *, int, frame_data *, proto_tree *);
 void dissect_telnet(const u_char *, int, frame_data *, proto_tree *);
 void dissect_tftp(const u_char *, int, frame_data *, proto_tree *);
+void dissect_time(const u_char *, int, frame_data *, proto_tree *);
 void dissect_tns(const u_char *, int, frame_data *, proto_tree *);
 void dissect_tr(const u_char *, int, frame_data *, proto_tree *);
 void dissect_trmac(const u_char *, int, frame_data *, proto_tree *);
diff -Naur ethereal-0.8.3/Makefile.am ethereal-0.8.3.new/Makefile.am
--- ethereal-0.8.3/Makefile.am	Tue Feb  1 05:56:31 2000
+++ ethereal-0.8.3.new/Makefile.am	Wed Feb  9 14:09:43 2000
@@ -150,6 +150,7 @@
 	packet-tcp.c   \
 	packet-telnet.c\
 	packet-tftp.c  \
+	packet-time.c  \
 	packet-tns.c \
 	packet-tns.h \
 	packet-tr.c    \
diff -Naur ethereal-0.8.3/Makefile.in ethereal-0.8.3.new/Makefile.in
--- ethereal-0.8.3/Makefile.in	Tue Feb  1 23:42:06 2000
+++ ethereal-0.8.3.new/Makefile.in	Wed Feb  9 14:09:43 2000
@@ -137,7 +137,7 @@
 # Any POSIX-compatible YACC should honor the -p flag
 YFLAGS = -d -p dfilter_
 
-DISSECTOR_SOURCES =  	packet-aarp.c  	packet-afs.c   	packet-afs.h   	packet-arp.c   	packet-arp.h   	packet-ascend.c 	packet-atalk.c 	packet-atalk.h 	packet-atm.c   	packet-auto_rp.c   	packet-bgp.c   	packet-bgp.h   	packet-bootp.c 	packet-bootparams.c 	packet-bootparams.h 	packet-bpdu.c  	packet-cdp.c   	packet-clip.c  	packet-data.c  	packet-dns.c   	packet-dns.h   	packet-eth.c   	packet-fddi.c  	packet-ftp.c   	packet-giop.c  	packet-gre.c   	packet-hsrp.c  	packet-http.c  	packet-icmpv6.c 	packet-icp.c   	packet-icq.c   	packet-imap.c   	packet-ip.c    	packet-ip.h    	packet-ipp.c   	packet-ipsec.c 	packet-ipv6.c  	packet-ipv6.h  	packet-ipx.c   	packet-ipx.h   	packet-irc.c   	packet-isakmp.c 	packet-isis.h  	packet-isis.c  	packet-isis-clv.h 	packet-isis-clv.c 	packet-isis-hello.h 	packet-isis-hello.c 	packet-isis-lsp.h 	packet-isis-lsp.c 	packet-isis-snp.h 	packet-isis-snp.c 	packet-isl.c   	packet-l2tp.c  	packet-lapb.c  	packet-lapd.c  	packet-ldap.c  	packet-l!
 lc.c   	packet-lpd.c   	packet-mapi.c  	packet-mount.c 	packet-mount.h 	packet-nbipx.c 	packet-nbns.c  	packet-ncp.c   	packet-ncp.h   	packet-netbios.c 	packet-netbios.h 	packet-nfs.c   	packet-nfs.h   	packet-nlm.c   	packet-nlm.h   	packet-nntp.c  	packet-ntp.c  	packet-ntp.h  	packet-null.c  	packet-osi.c   	packet-ospf.c  	packet-ospf.h  	packet-pim.c   	packet-pop.c   	packet-portmap.c   	packet-portmap.h   	packet-ppp.c   	packet-pppoe.c 	packet-pptp.c  	packet-q2931.c 	packet-q931.c  	packet-q931.h  	packet-radius.c 	packet-raw.c   	packet-rip.c   	packet-rip.h   	packet-ripng.c 	packet-ripng.h 	packet-rpc.c   	packet-rpc.h   	packet-rsvp.c  	packet-rsvp.h  	packet-rtsp.c  	packet-rx.c  	packet-rx.h  	packet-sap.c   	packet-sdp.c   	packet-smb.c   	packet-sna.c   	packet-sna.h   	packet-snmp.c		packet-snmp.h		packet-srvloc.c 	packet-sscop.c 	packet-stat.c   	packet-stat.h   	packet-tacacs.c 	packet-tcp.c   	packet-telnet.c 	packet-tftp.c  	packet-tns.c 	packet-tns.h!
  	packet-tr.c    	packet-trmac.c 	packet-udp.c   	packet-v120.c 	packe
t-vines.c 	packet-vines.h 	packet-vlan.c 	packet-vrrp.c 	packet-wccp.c 	packet-who.c 	packet-x25.c   	packet-yhoo.c  	packet-yhoo.h  	packet-ypbind.c 	packet-ypbind.h 	packet-ypserv.c 	packet-ypserv.h 	packet-ypxfr.c 	packet-ypxfr.h 
+DISSECTOR_SOURCES =  	packet-aarp.c  	packet-afs.c   	packet-afs.h   	packet-arp.c   	packet-arp.h   	packet-ascend.c 	packet-atalk.c 	packet-atalk.h 	packet-atm.c   	packet-auto_rp.c   	packet-bgp.c   	packet-bgp.h   	packet-bootp.c 	packet-bootparams.c 	packet-bootparams.h 	packet-bpdu.c  	packet-cdp.c   	packet-clip.c  	packet-data.c  	packet-dns.c   	packet-dns.h   	packet-eth.c   	packet-fddi.c  	packet-ftp.c   	packet-giop.c  	packet-gre.c   	packet-hsrp.c  	packet-http.c  	packet-icmpv6.c 	packet-icp.c   	packet-icq.c   	packet-imap.c   	packet-ip.c    	packet-ip.h    	packet-ipp.c   	packet-ipsec.c 	packet-ipv6.c  	packet-ipv6.h  	packet-ipx.c   	packet-ipx.h   	packet-irc.c   	packet-isakmp.c 	packet-isis.h  	packet-isis.c  	packet-isis-clv.h 	packet-isis-clv.c 	packet-isis-hello.h 	packet-isis-hello.c 	packet-isis-lsp.h 	packet-isis-lsp.c 	packet-isis-snp.h 	packet-isis-snp.c 	packet-isl.c   	packet-l2tp.c  	packet-lapb.c  	packet-lapd.c  	packet-ldap.c  	packet-l!
 lc.c   	packet-lpd.c   	packet-mapi.c  	packet-mount.c 	packet-mount.h 	packet-nbipx.c 	packet-nbns.c  	packet-ncp.c   	packet-ncp.h   	packet-netbios.c 	packet-netbios.h 	packet-nfs.c   	packet-nfs.h   	packet-nlm.c   	packet-nlm.h   	packet-nntp.c  	packet-ntp.c  	packet-ntp.h  	packet-null.c  	packet-osi.c   	packet-ospf.c  	packet-ospf.h  	packet-pim.c   	packet-pop.c   	packet-portmap.c   	packet-portmap.h   	packet-ppp.c   	packet-pppoe.c 	packet-pptp.c  	packet-q2931.c 	packet-q931.c  	packet-q931.h  	packet-radius.c 	packet-raw.c   	packet-rip.c   	packet-rip.h   	packet-ripng.c 	packet-ripng.h 	packet-rpc.c   	packet-rpc.h   	packet-rsvp.c  	packet-rsvp.h  	packet-rtsp.c  	packet-rx.c  	packet-rx.h  	packet-sap.c   	packet-sdp.c   	packet-smb.c   	packet-sna.c   	packet-sna.h   	packet-snmp.c		packet-snmp.h		packet-srvloc.c 	packet-sscop.c 	packet-stat.c   	packet-stat.h   	packet-tacacs.c 	packet-tcp.c   	packet-telnet.c 	packet-tftp.c  	packet-time.c  	packet-tns!
 .c 	packet-tns.h 	packet-tr.c    	packet-trmac.c 	packet-udp.c   	pack
et-v120.c 	packet-vines.c 	packet-vines.h 	packet-vlan.c 	packet-vrrp.c 	packet-wccp.c 	packet-who.c 	packet-x25.c   	packet-yhoo.c  	packet-yhoo.h  	packet-ypbind.c 	packet-ypbind.h 	packet-ypserv.c 	packet-ypserv.h 	packet-ypxfr.c 	packet-ypxfr.h 
 
 
 ETHEREAL_COMMON_SOURCES =  	alignment.h    	asn1.c         	asn1.h         	column.c       	column.h       	conversation.c 	conversation.h 	dfilter-int.h  	dfilter-grammar.y 	dfilter-scanner.l 	dfilter.c      	dfilter.h      	ethertype.c    	etypes.h       	follow.c       	follow.h       	inet_v6defs.h  	ipproto.c      	ipv4.c         	ipv4.h         	nlpid.h        	oui.h          	packet.c       	packet.h       	plugins.c      	plugins.h      	prefs.c        	prefs.h        	print.c        	print.h        	proto.c        	proto.h        	ps.c           	ps.h           	register.c     	register.h     	resolv.c       	resolv.h       	smb.h          	timestamp.h    	util.c         	util.h         	xdlc.c         	xdlc.h
@@ -269,7 +269,7 @@
 packet-ripng.o packet-rpc.o packet-rsvp.o packet-rtsp.o packet-rx.o \
 packet-sap.o packet-sdp.o packet-smb.o packet-sna.o packet-snmp.o \
 packet-srvloc.o packet-sscop.o packet-stat.o packet-tacacs.o \
-packet-tcp.o packet-telnet.o packet-tftp.o packet-tns.o packet-tr.o \
+packet-tcp.o packet-telnet.o packet-tftp.o packet-time.o packet-tns.o packet-tr.o \
 packet-trmac.o packet-udp.o packet-v120.o packet-vines.o packet-vlan.o \
 packet-vrrp.o packet-wccp.o packet-who.o packet-x25.o packet-yhoo.o \
 packet-ypbind.o packet-ypserv.o packet-ypxfr.o asn1.o column.o \
@@ -295,7 +295,7 @@
 packet-ripng.o packet-rpc.o packet-rsvp.o packet-rtsp.o packet-rx.o \
 packet-sap.o packet-sdp.o packet-smb.o packet-sna.o packet-snmp.o \
 packet-srvloc.o packet-sscop.o packet-stat.o packet-tacacs.o \
-packet-tcp.o packet-telnet.o packet-tftp.o packet-tns.o packet-tr.o \
+packet-tcp.o packet-telnet.o packet-tftp.o packet-time.o packet-tns.o packet-tr.o \
 packet-trmac.o packet-udp.o packet-v120.o packet-vines.o packet-vlan.o \
 packet-vrrp.o packet-wccp.o packet-who.o packet-x25.o packet-yhoo.o \
 packet-ypbind.o packet-ypserv.o packet-ypxfr.o asn1.o column.o \
@@ -323,7 +323,7 @@
 packet-ripng.o packet-rpc.o packet-rsvp.o packet-rtsp.o packet-rx.o \
 packet-sap.o packet-sdp.o packet-smb.o packet-sna.o packet-snmp.o \
 packet-srvloc.o packet-sscop.o packet-stat.o packet-tacacs.o \
-packet-tcp.o packet-telnet.o packet-tftp.o packet-tns.o packet-tr.o \
+packet-tcp.o packet-telnet.o packet-tftp.o packet-time.o packet-tns.o packet-tr.o \
 packet-trmac.o packet-udp.o packet-v120.o packet-vines.o packet-vlan.o \
 packet-vrrp.o packet-wccp.o packet-who.o packet-x25.o packet-yhoo.o \
 packet-ypbind.o packet-ypserv.o packet-ypxfr.o asn1.o column.o \
@@ -910,6 +910,8 @@
 packet-telnet.o: packet-telnet.c config.h packet.h wiretap/wtap.h \
 	proto.h ipv4.h
 packet-tftp.o: packet-tftp.c config.h packet.h wiretap/wtap.h proto.h \
+	ipv4.h
+packet-time.o: packet-time.c config.h packet.h wiretap/wtap.h proto.h \
 	ipv4.h
 packet-tns.o: packet-tns.c config.h packet.h wiretap/wtap.h proto.h \
 	ipv4.h packet-tns.h
diff -Naur ethereal-0.8.3/Makefile.nmake ethereal-0.8.3.new/Makefile.nmake
--- ethereal-0.8.3/Makefile.nmake	Tue Jan 25 11:43:08 2000
+++ ethereal-0.8.3.new/Makefile.nmake	Wed Feb  9 14:09:43 2000
@@ -107,6 +107,7 @@
 	packet-tcp.obj   \
 	packet-telnet.obj\
 	packet-tftp.obj  \
+	packet-time.obj  \
 	packet-tns.obj \
 	packet-tr.obj    \
 	packet-trmac.obj \

-- 
---------------------------------------------------------------------------
Dr. Dietmar Petras     Senior Expert
ELSA AG                Engineering Consumer Communications
Sonnenweg 11           Phone: +49-(0)241-606-4649
52070 Aachen           Fax:   +49-(0)241-606-4699
Germany                EMail: DPetras@xxxxxxx
---------------------------------------------------------------------------