Ethereal-dev: [Ethereal-dev] Patches to tftp ...

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

From: Richard Sharpe <sharpe@xxxxxxxxxx>
Date: Fri, 02 Nov 2001 22:55:37 +1030
Hi,

Since I cannot get access to the CVS tree at the moment, I am posting
these here ...

Who took away my access?

--
Richard Sharpe, rsharpe@xxxxxxxxxx, LPIC-1
www.samba.org, www.ethereal.com, SAMS Teach Yourself Samba
in 24 Hours, Special Edition, Using Samba

--- packet-tftp.c	Sun Sep 30 23:04:27 2001
+++ packet-tftp.c.new	Fri Nov  2 13:01:40 2001
@@ -137,7 +137,7 @@
 
 	if (check_col(pinfo->fd, COL_INFO)) {
 
-	  col_add_fstr(pinfo->fd, COL_INFO, "TFTP %s",
+	  col_add_fstr(pinfo->fd, COL_INFO, "%s",
 	    val_to_str(opcode, tftp_opcode_vals, "Unknown (0x%04x)"));
 
 	}
@@ -157,11 +157,19 @@
 	    i1 = tvb_strsize(tvb, offset);
 	    proto_tree_add_item(tftp_tree, hf_tftp_source_file,
 			    tvb, offset, i1, FALSE);
+	    if (check_col(pinfo->fd, COL_INFO)) {
+	      col_append_fstr(pinfo->fd, COL_INFO, ", File: %s",
+			      tvb_get_ptr(tvb, offset, i1));
+	    }
 	    offset += i1;
 
 	    i1 = tvb_strsize(tvb, offset);
 	    ti = proto_tree_add_item(tftp_tree, hf_tftp_transfer_type,
 			    tvb, offset, i1, FALSE);
+	    if (check_col(pinfo->fd, COL_INFO)) {
+	      col_append_fstr(pinfo->fd, COL_INFO, ", Transfer type: %s",
+			      tvb_get_ptr(tvb, offset, i1));
+	    }
 	    offset += i1;
 
 	    tftp_dissect_options(tvb, offset, tftp_tree);
@@ -170,11 +178,19 @@
 	    i1 = tvb_strsize(tvb, offset);
 	    proto_tree_add_item(tftp_tree, hf_tftp_destination_file,
 			    tvb, offset, i1, FALSE);
+	    if (check_col(pinfo->fd, COL_INFO)) {
+	      col_append_fstr(pinfo->fd, COL_INFO, ", File: %s",
+			      tvb_get_ptr(tvb, offset, i1));
+	    }
 	    offset += i1;
 
 	    i1 = tvb_strsize(tvb, offset);
 	    ti = proto_tree_add_item(tftp_tree, hf_tftp_transfer_type,
 			    tvb, offset, i1, FALSE);
+	    if (check_col(pinfo->fd, COL_INFO)) {
+	      col_append_fstr(pinfo->fd, COL_INFO, ", Transfer type: %s",
+			      tvb_get_ptr(tvb, offset, i1));
+	    }
 	    offset += i1;
 
 	    tftp_dissect_options(tvb, offset, tftp_tree);
@@ -182,6 +198,10 @@
 	  case TFTP_DATA:
 	    proto_tree_add_item(tftp_tree, hf_tftp_blocknum, tvb, offset, 2,
 	    		    FALSE);
+	    if (check_col(pinfo->fd, COL_INFO)) {
+	      col_append_fstr(pinfo->fd, COL_INFO, ", Block: %i",
+			      tvb_get_ntohs(tvb, offset));
+	    }
 	    offset += 2;
 
 	    proto_tree_add_text(tftp_tree, tvb, offset, tvb_length_remaining(tvb, offset),
@@ -190,10 +210,18 @@
 	  case TFTP_ACK:
 	    proto_tree_add_item(tftp_tree, hf_tftp_blocknum, tvb, offset, 2,
 	    		    FALSE);
+	    if (check_col(pinfo->fd, COL_INFO)) {
+	      col_append_fstr(pinfo->fd, COL_INFO, ", Block: %i",
+			      tvb_get_ntohs(tvb, offset));
+	    }
 	    break;
 	  case TFTP_ERROR:
 	    proto_tree_add_item(tftp_tree, hf_tftp_error_code, tvb, offset, 2,
 			    FALSE);
+	    if (check_col(pinfo->fd, COL_INFO)) {
+	      col_append_fstr(pinfo->fd, COL_INFO, ", Code: %i",
+			      tvb_get_ntohs(tvb, offset));
+	    }
 	    offset += 2;
 
 	    i1 = tvb_strsize(tvb, offset);