Wireshark-dev: [Wireshark-dev] [PATCH] Added options declared in DSLForum TR-111 to STUN decode
From: Zach Chadwick <zachad@xxxxxxxxxx>
Date: Tue, 29 May 2007 14:50:03 -0400
Hi Wireshark-Dev,

TR-111, from the DSL-Forum adds two options to STUN (RFC 3489) to help with TR-069 enabled devices traverse firewalls. TR-111 can be read here: http://www.dslforum.org/techwork/tr/*TR-111*.pdf

This patch adds support for decoding the two optional STUN attributes used by TR-111. One is simply a zero-length attribute, and the other a string attribute. Also attached is an example .cap file containing a STUN packet with these options. The .diff was generated from the top of the svn tree, the file modified was ./epan/dissectors/packet-stun.c (revision 21922)


Thanks for including this patch!

-Zach Chadwick
 QA Cafe


Index: epan/dissectors/packet-stun.c
===================================================================
--- epan/dissectors/packet-stun.c	(revision 21922)
+++ epan/dissectors/packet-stun.c	(working copy)
@@ -67,9 +67,9 @@
 static int stun_att_magic_cookie = -1;
 static int stun_att_bandwidth = -1;
 static int stun_att_data = -1;
+static int stun_att_connection_request_binding = -1;
 
 
-
 /* Message Types */
 #define BINDING_REQUEST			0x0001
 #define BINDING_RESPONSE		0x0101
@@ -88,6 +88,7 @@
 #define SET_ACTIVE_DESTINATION_RESPONSE	0x0106
 #define SET_ACTIVE_DESTINATION_ERROR_RESPONSE	0x0116
 
+
 /* Attribute Types */
 #define MAPPED_ADDRESS		0x0001
 #define RESPONSE_ADDRESS	0x0002
@@ -113,6 +114,8 @@
 #define XOR_MAPPED_ADDRESS	0x8020
 #define XOR_ONLY		0x0021
 #define SERVER			0x8022
+#define CONNECTION_REQUEST_BINDING      0xc001
+#define BINDING_CHANGE                  0xc002
 
 
 
@@ -179,6 +182,8 @@
 	{XOR_MAPPED_ADDRESS, "XOR_MAPPED_ADDRESS"},
 	{XOR_ONLY, "XOR_ONLY"},
 	{SERVER, "SERVER"},
+	{CONNECTION_REQUEST_BINDING, "CONNECTION-REQUEST-BINDING"},
+	{BINDING_CHANGE, "BINDING-CHANGE"},
 	{0x00, NULL}
 };
 
@@ -423,6 +428,10 @@
 					proto_tree_add_item(att_tree, stun_att_family, tvb, offset+1, 1, FALSE);
 					break;
 
+				case CONNECTION_REQUEST_BINDING:
+					proto_tree_add_item(att_tree, stun_att_connection_request_binding, tvb, offset, att_length, FALSE);
+					break;				    
+
 				default:
 					break;
 			}
@@ -552,6 +561,10 @@
 			{ "Data",	"stun.att.data",	FT_BYTES,
 			BASE_HEX,	NULL,	0x0, 	"",	HFILL }
 		},
+		{ &stun_att_connection_request_binding,
+		        { "Connection Request Binding", "stun.att.connection.request.binding", FT_STRING,
+			  BASE_NONE,      NULL, 0x0,    "",     HFILL }
+		},
 	};
 
 /* Setup protocol subtree array */

Attachment: stun_example.cap
Description: Binary data