Ethereal-dev: [Ethereal-dev] Diameter over SCTP finished

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

From: David Frascone <dave@xxxxxxxxxxxx>
Date: Fri, 23 Feb 2001 13:12:26 -0600
Couple of features added (prints out command type based on the flags), 
dictionary file (packet-diameter-defs.h) brought more up-to-date.

Attached are the diffs, and some captured SCTP traffic to dissect.  (Traffic
was captured with snoop)
? dump1
? tcpdump.out
? sctp.out
? %1
? ethereal.out
? testone.out
? diameter.dump2
? diameter.dump3
? diff.out
? diameter.dump4
? diameter.dump5
? diameter.tcpdump.dump
? diameter.badicv
? diffs.out
Index: packet-diameter-defs.h
===================================================================
RCS file: /cvsroot/ethereal/packet-diameter-defs.h,v
retrieving revision 1.2
diff -u -r1.2 packet-diameter-defs.h
--- packet-diameter-defs.h	2001/02/19 23:14:01	1.2
+++ packet-diameter-defs.h	2001/02/23 19:08:49
@@ -3,7 +3,7 @@
  * WARNING:  This file was automatically generated by dict2h.pl.  Modifications
  *           will be erased by next invocation of dictionary parser.
  *
- * Generated: Fri Feb  9 14:03:07 2001
+ * Generated: Fri Feb 23 13:04:15 2001
  */
 
 #ifndef _PACKET_DIAMETER_DEFS_H
@@ -117,9 +117,9 @@
 #define DIAMETER_ATT_PROXY_ADDRESS 289
 #define DIAMETER_ATT_PROXY_INFO 284
 #define DIAMETER_ATT_PROXY_STATE 33
-#define DIAMETER_ATT_REDIRECT_HOST 292
 #define DIAMETER_ATT_REDIRECT_HOST_ADDRESS 278
 #define DIAMETER_ATT_REDIRECT_HOST_PORT 277
+#define DIAMETER_ATT_REDIRECT_HOST 292
 #define DIAMETER_ATT_RESULT_CODE 268
 #define DIAMETER_ATT_ROUTE_RECORD 282
 #define DIAMETER_ATT_ROUTING_REALM 283
@@ -141,24 +141,24 @@
 #define DIAMETER_ATT_ACCOUNTING_SESSION_TIME 46
 #define DIAMETER_ATT_MIP_REG_REQUEST 320
 #define DIAMETER_ATT_MIP_REG_REPLY 321
+#define DIAMETER_ATT_MIP_MN_AAA_SPI 341
+#define DIAMETER_ATT_MIP_AUTH_INPUT_DATA_LENGTH 338
+#define DIAMETER_ATT_MIP_AUTHENTICATOR_LENGTH 339
+#define DIAMETER_ATT_MIP_AUTHENTICATOR_OFFSET 340
 #define DIAMETER_ATT_MIP_MN_AAA_AUTH 322
 #define DIAMETER_ATT_MIP_MOBILE_NODE_ADDRESS 333
 #define DIAMETER_ATT_MIP_HOME_AGENT_ADDRESS 334
 #define DIAMETER_ATT_MIP_PREVIOUS_FA_NAI 335
 #define DIAMETER_ATT_MIP_PREVIOUS_FA_ADDR 336
-#define DIAMETER_ATT_MIP_MN_AAA_SPI 341
-#define DIAMETER_ATT_MIP_AUTH_INPUT_DATA_LENGTH 338
-#define DIAMETER_ATT_MIP_AUTHENTICATOR_LENGTH 339
-#define DIAMETER_ATT_MIP_AUTHENTICATOR_OFFSET 340
 #define DIAMETER_ATT_MIP_FEATURE_VECTOR 337
+#define DIAMETER_ATT_MIP_PEER_SPI 342
+#define DIAMETER_ATT_MIP_SESSION_KEY 343
 #define DIAMETER_ATT_MIP_MN_TO_FA_KEY 325
 #define DIAMETER_ATT_MIP_MN_TO_HA_KEY 331
 #define DIAMETER_ATT_MIP_FA_TO_MN_KEY 326
 #define DIAMETER_ATT_MIP_FA_TO_HA_KEY 328
 #define DIAMETER_ATT_MIP_HA_TO_FA_KEY 329
 #define DIAMETER_ATT_MIP_HA_TO_MN_KEY 332
-#define DIAMETER_ATT_MIP_PEER_SPI 999
-#define DIAMETER_ATT_MIP_SESSION_KEY 999
 #define DIAMETER_ATT_MIP_FA_MN_PREFERRED_SPI 324
 #define DIAMETER_ATT_MIP_FA_HA_PREFERRED_SPI 327
 #define DIAMETER_ATT_FILTER_RULE 400
@@ -208,7 +208,7 @@
 #define DIAMETER_ATT_SOURCE_SUBNET 1039
 #define DIAMETER_ATT_DESTINATION_SUBNET 1040
 #define DIAMETER_ATT_MAX_QOS_RATE 1041
-#define DIAMETER_ATT_EXAMPLE_AVP 99999
+#define DIAMETER_ATT_EXAMPLE_AVP 999999
 
 
             /* Attribute to String table */
@@ -321,9 +321,9 @@
    {DIAMETER_ATT_PROXY_ADDRESS, "Proxy-Address"},
    {DIAMETER_ATT_PROXY_INFO, "Proxy-Info"},
    {DIAMETER_ATT_PROXY_STATE, "Proxy-State"},
-   {DIAMETER_ATT_REDIRECT_HOST, "Redirect-Host"},
    {DIAMETER_ATT_REDIRECT_HOST_ADDRESS, "Redirect-Host-Address"},
    {DIAMETER_ATT_REDIRECT_HOST_PORT, "Redirect-Host-Port"},
+   {DIAMETER_ATT_REDIRECT_HOST, "Redirect-Host"},
    {DIAMETER_ATT_RESULT_CODE, "Result-Code"},
    {DIAMETER_ATT_ROUTE_RECORD, "Route-Record"},
    {DIAMETER_ATT_ROUTING_REALM, "Routing-Realm"},
@@ -345,24 +345,24 @@
    {DIAMETER_ATT_ACCOUNTING_SESSION_TIME, "Accounting-Session-Time"},
    {DIAMETER_ATT_MIP_REG_REQUEST, "MIP-Reg-Request"},
    {DIAMETER_ATT_MIP_REG_REPLY, "MIP-Reg-Reply"},
+   {DIAMETER_ATT_MIP_MN_AAA_SPI, "MIP-MN-AAA-SPI"},
+   {DIAMETER_ATT_MIP_AUTH_INPUT_DATA_LENGTH, "MIP-Auth-Input-Data-Length"},
+   {DIAMETER_ATT_MIP_AUTHENTICATOR_LENGTH, "MIP-Authenticator-Length"},
+   {DIAMETER_ATT_MIP_AUTHENTICATOR_OFFSET, "MIP-Authenticator-Offset"},
    {DIAMETER_ATT_MIP_MN_AAA_AUTH, "MIP-MN-AAA-Auth"},
    {DIAMETER_ATT_MIP_MOBILE_NODE_ADDRESS, "MIP-Mobile-Node-Address"},
    {DIAMETER_ATT_MIP_HOME_AGENT_ADDRESS, "MIP-Home-Agent-Address"},
    {DIAMETER_ATT_MIP_PREVIOUS_FA_NAI, "MIP-Previous-FA-NAI"},
    {DIAMETER_ATT_MIP_PREVIOUS_FA_ADDR, "MIP-Previous-FA-Addr"},
-   {DIAMETER_ATT_MIP_MN_AAA_SPI, "MIP-MN-AAA-SPI"},
-   {DIAMETER_ATT_MIP_AUTH_INPUT_DATA_LENGTH, "MIP-Auth-Input-Data-Length"},
-   {DIAMETER_ATT_MIP_AUTHENTICATOR_LENGTH, "MIP-Authenticator-Length"},
-   {DIAMETER_ATT_MIP_AUTHENTICATOR_OFFSET, "MIP-Authenticator-Offset"},
    {DIAMETER_ATT_MIP_FEATURE_VECTOR, "MIP-Feature-Vector"},
+   {DIAMETER_ATT_MIP_PEER_SPI, "MIP-Peer-SPI"},
+   {DIAMETER_ATT_MIP_SESSION_KEY, "MIP-Session-Key"},
    {DIAMETER_ATT_MIP_MN_TO_FA_KEY, "MIP-MN-to-FA-Key"},
    {DIAMETER_ATT_MIP_MN_TO_HA_KEY, "MIP-MN-to-HA-Key"},
    {DIAMETER_ATT_MIP_FA_TO_MN_KEY, "MIP-FA-to-MN-Key"},
    {DIAMETER_ATT_MIP_FA_TO_HA_KEY, "MIP-FA-to-HA-Key"},
    {DIAMETER_ATT_MIP_HA_TO_FA_KEY, "MIP-HA-to-FA-Key"},
    {DIAMETER_ATT_MIP_HA_TO_MN_KEY, "MIP-HA-to-MN-Key"},
-   {DIAMETER_ATT_MIP_PEER_SPI, "MIP-Peer-SPI"},
-   {DIAMETER_ATT_MIP_SESSION_KEY, "MIP-Session-Key"},
    {DIAMETER_ATT_MIP_FA_MN_PREFERRED_SPI, "MIP-FA-MN-Preferred-SPI"},
    {DIAMETER_ATT_MIP_FA_HA_PREFERRED_SPI, "MIP-FA-HA-Preferred-SPI"},
    {DIAMETER_ATT_FILTER_RULE, "Filter-Rule"},
@@ -526,16 +526,16 @@
    { DIAMETER_ATT_PLAINTEXT_DATA_LENGTH, DIAMETER_INTEGER32 },
    { DIAMETER_ATT_PROXY_ADDRESS, DIAMETER_ADDRESS },
    { DIAMETER_ATT_PROXY_INFO, DIAMETER_DATA },
-   { DIAMETER_ATT_PROXY_STATE, DIAMETER_DATA },
-   { DIAMETER_ATT_REDIRECT_HOST, DIAMETER_DATA },
+   { DIAMETER_ATT_PROXY_STATE, DIAMETER_GROUPED },
    { DIAMETER_ATT_REDIRECT_HOST_ADDRESS, DIAMETER_ADDRESS },
    { DIAMETER_ATT_REDIRECT_HOST_PORT, DIAMETER_INTEGER32 },
+   { DIAMETER_ATT_REDIRECT_HOST, DIAMETER_GROUPED },
    { DIAMETER_ATT_RESULT_CODE, DIAMETER_INTEGER32 },
    { DIAMETER_ATT_ROUTE_RECORD, DIAMETER_STRING },
    { DIAMETER_ATT_ROUTING_REALM, DIAMETER_STRING },
    { DIAMETER_ATT_SESSION_ID, DIAMETER_DATA },
    { DIAMETER_ATT_SESSION_TIMEOUT, DIAMETER_INTEGER32 },
-   { DIAMETER_ATT_TIMESTAMP, DIAMETER_TIME },
+   { DIAMETER_ATT_TIMESTAMP, DIAMETER_INTEGER32 },
    { DIAMETER_ATT_USER_NAME, DIAMETER_STRING },
    { DIAMETER_ATT_VENDOR_ID, DIAMETER_INTEGER32 },
    { DIAMETER_ATT_ACCOUNTING_AUTHENTICATION_TYPE, DIAMETER_INTEGER32 },
@@ -551,23 +551,24 @@
    { DIAMETER_ATT_ACCOUNTING_SESSION_TIME, DIAMETER_INTEGER32 },
    { DIAMETER_ATT_MIP_REG_REQUEST, DIAMETER_DATA },
    { DIAMETER_ATT_MIP_REG_REPLY, DIAMETER_DATA },
-   { DIAMETER_ATT_MIP_MOBILE_NODE_ADDRESS, DIAMETER_ADDRESS },
-   { DIAMETER_ATT_MIP_HOME_AGENT_ADDRESS, DIAMETER_ADDRESS },
-   { DIAMETER_ATT_MIP_PREVIOUS_FA_NAI, DIAMETER_STRING },
-   { DIAMETER_ATT_MIP_PREVIOUS_FA_ADDR, DIAMETER_ADDRESS },
    { DIAMETER_ATT_MIP_MN_AAA_SPI, DIAMETER_INTEGER32 },
    { DIAMETER_ATT_MIP_AUTH_INPUT_DATA_LENGTH, DIAMETER_INTEGER32 },
    { DIAMETER_ATT_MIP_AUTHENTICATOR_LENGTH, DIAMETER_INTEGER32 },
    { DIAMETER_ATT_MIP_AUTHENTICATOR_OFFSET, DIAMETER_INTEGER32 },
+   { DIAMETER_ATT_MIP_MN_AAA_AUTH, DIAMETER_GROUPED },
+   { DIAMETER_ATT_MIP_MOBILE_NODE_ADDRESS, DIAMETER_ADDRESS },
+   { DIAMETER_ATT_MIP_HOME_AGENT_ADDRESS, DIAMETER_ADDRESS },
+   { DIAMETER_ATT_MIP_PREVIOUS_FA_NAI, DIAMETER_STRING },
+   { DIAMETER_ATT_MIP_PREVIOUS_FA_ADDR, DIAMETER_ADDRESS },
    { DIAMETER_ATT_MIP_FEATURE_VECTOR, DIAMETER_INTEGER32 },
-   { DIAMETER_ATT_MIP_MN_TO_FA_KEY, DIAMETER_DATA },
-   { DIAMETER_ATT_MIP_MN_TO_HA_KEY, DIAMETER_DATA },
-   { DIAMETER_ATT_MIP_FA_TO_MN_KEY, DIAMETER_DATA },
-   { DIAMETER_ATT_MIP_FA_TO_HA_KEY, DIAMETER_DATA },
-   { DIAMETER_ATT_MIP_HA_TO_FA_KEY, DIAMETER_DATA },
-   { DIAMETER_ATT_MIP_HA_TO_MN_KEY, DIAMETER_DATA },
    { DIAMETER_ATT_MIP_PEER_SPI, DIAMETER_INTEGER32 },
    { DIAMETER_ATT_MIP_SESSION_KEY, DIAMETER_DATA },
+   { DIAMETER_ATT_MIP_MN_TO_FA_KEY, DIAMETER_DATA },
+   { DIAMETER_ATT_MIP_MN_TO_HA_KEY, DIAMETER_DATA },
+   { DIAMETER_ATT_MIP_FA_TO_MN_KEY, DIAMETER_GROUPED },
+   { DIAMETER_ATT_MIP_FA_TO_HA_KEY, DIAMETER_GROUPED },
+   { DIAMETER_ATT_MIP_HA_TO_FA_KEY, DIAMETER_GROUPED },
+   { DIAMETER_ATT_MIP_HA_TO_MN_KEY, DIAMETER_GROUPED },
    { DIAMETER_ATT_MIP_FA_MN_PREFERRED_SPI, DIAMETER_INTEGER32 },
    { DIAMETER_ATT_MIP_FA_HA_PREFERRED_SPI, DIAMETER_INTEGER32 },
    { DIAMETER_ATT_FILTER_RULE, DIAMETER_STRING },
@@ -597,7 +598,7 @@
    { DIAMETER_ATT_VOIP_CHALLENGE, DIAMETER_DATA },
    { DIAMETER_ATT_VOIP_RESPONSE, DIAMETER_DATA },
    { DIAMETER_ATT_VOIP_SESSION_LENGTH, DIAMETER_INTEGER32 },
-   { DIAMETER_ATT_SUN_PING_TIMESTAMP, DIAMETER_TIME },
+   { DIAMETER_ATT_SUN_PING_TIMESTAMP, DIAMETER_INTEGER32 },
    { DIAMETER_ATT_COMMENT, DIAMETER_STRING },
    { DIAMETER_ATT_XVALUE, DIAMETER_INTEGER32 },
    { DIAMETER_ATT_XSTRING, DIAMETER_STRING },
Index: packet-diameter.c
===================================================================
RCS file: /cvsroot/ethereal/packet-diameter.c,v
retrieving revision 1.19
diff -u -r1.19 packet-diameter.c
--- packet-diameter.c	2001/02/20 08:10:14	1.19
+++ packet-diameter.c	2001/02/23 19:08:51
@@ -71,12 +71,8 @@
 
 #define  NTP_TIME_DIFF                   (2208988800UL)
 
-#undef SCTP_DISSECTORS_ENABLED
-
 #define TCP_PORT_DIAMETER	1812
-#ifdef SCTP_DISSECTORS_ENABLED
 #define SCTP_PORT_DIAMETER	1812
-#endif
 
 static int proto_diameter = -1;
 static int hf_diameter_length = -1;
@@ -112,9 +108,7 @@
 
 static char gbl_diameterString[200];
 static int gbl_diameterTcpPort=TCP_PORT_DIAMETER;
-#ifdef SCTP_DISSECTORS_ENABLED
 static int gbl_diameterSctpPort=SCTP_PORT_DIAMETER;
-#endif
 
 typedef struct _e_diameterhdr {
 	guint8 reserved;
@@ -153,6 +147,7 @@
 static gchar *rd_value_to_str(e_avphdr *avph,const u_char *input, int length);
 static void dissect_avps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
 static guint32 match_numval(guint32 val, const value_value_pair *vs);
+static gchar *DetermineMessageType(char flagsVer);
 
 /* Code to actually dissect the packets */
 
@@ -208,8 +203,9 @@
 
 	if (check_col(pinfo->fd, COL_INFO)) {
 		col_add_fstr(pinfo->fd, COL_INFO,
-		    "%s%s(%d) vendor=%d (id=%d) EIR=%d%d%d",
+		    "%s%s: %s(%d) vendor=%d (id=%d) EIR=%d%d%d",
 		    (BadPacket)?"***** Bad Packet!: ":"",
+		    DetermineMessageType(dh.flagsVer),
 		    codestrval, dh.commandCode, dh.vendorId,
 		    dh.identifier,
 		    (dh.flagsVer & DIAM_FLAGS_E)?1:0,
@@ -235,11 +231,12 @@
 		    hf_diameter_flags,
 		    tvb, offset, 1,
 		    dh.flagsVer,
-		    "Packet flags: 0x%02x  E:%d I:%d R:%d",
+		    "Packet flags: 0x%02x  E:%d I:%d R:%d (%s)",
 		    (dh.flagsVer&0xf8)>>3,
 		    (dh.flagsVer & DIAM_FLAGS_E)?1:0,
 		    (dh.flagsVer & DIAM_FLAGS_I)?1:0,
-		    (dh.flagsVer & DIAM_FLAGS_R)?1:0);
+		    (dh.flagsVer & DIAM_FLAGS_R)?1:0,
+		    DetermineMessageType(dh.flagsVer));
 
 		/* Version */
 		proto_tree_add_uint(diameter_tree,
@@ -699,30 +696,49 @@
 	return buffer;
 } /* rd value to str */
 
+static gchar *
+DetermineMessageType(char flagsVer)
+{
+	/* Get rid of version */
+	flagsVer = flagsVer >> 3;
+
+	/* Mask out reserved bits */
+	flagsVer = flagsVer & 0x7;
+
+	switch (flagsVer) {
+	case 0x0: /* Indication */
+		return "Indication";
+	case 0x4: /* Request */
+		return "Request";
+	case 0x1: /* Answer */
+		return "Answer";
+	case 0x6: /* Query */
+		return "Query";
+	case 0x3: /* Reply */
+		return "Reply";
+	default:
+		return "Illegal Command Type";
+	}
+} /* DetermineMessageType */
+
 
 void
 proto_reg_handoff_diameter(void)
 {
 	static int Initialized=FALSE;
 	static int TcpPort=0;
-#ifdef SCTP_DISSECTORS_ENABLED
 	static int SctpPort=0;
-#endif
+
 	if (Initialized) {
 		dissector_delete("tcp.port", TcpPort, dissect_diameter);
-#ifdef SCTP_DISSECTORS_ENABLED
-		dissector_delete("sctp.srcport", SctpPort, dissect_diameter);
-		dissector_delete("sctp.destport", SctpPort, dissect_diameter);
-#endif
+		dissector_delete("sctp.port", SctpPort, dissect_diameter);
 	} else {
 		Initialized=TRUE;
 	}
 
 	/* set port for future deletes */
 	TcpPort=gbl_diameterTcpPort;
-#ifdef SCTP_DISSECTORS_ENABLED
 	SctpPort=gbl_diameterSctpPort;
-#endif
 
 	strcpy(gbl_diameterString, "Diameter Protocol");
 
@@ -730,12 +746,8 @@
 		gbl_diameterTcpPort); */
 	dissector_add("tcp.port", gbl_diameterTcpPort, dissect_diameter,
 	    proto_diameter);
-#ifdef SCTP_DISSECTORS_ENABLED
-	dissector_add("sctp.srcport", gbl_diameterSctpPort,
-	    dissect_diameter, proto_diameter);
-	dissector_add("sctp.destport", gbl_diameterSctpPort,
+	dissector_add("sctp.port", gbl_diameterSctpPort,
 	    dissect_diameter, proto_diameter);
-#endif
 }
 
 /* registration with the filtering engine */
@@ -835,11 +847,9 @@
 				       "Set the TCP port for DIAMETER messages",
 				       10,
 				       &gbl_diameterTcpPort);
-#ifdef SCTP_DISSECTORS_ENABLED
 	prefs_register_uint_preference(diameter_module, "sctp.port",
 				       "DIAMETER SCTP Port",
 				       "Set the SCTP port for DIAMETER messages",
 				       10,
 				       &gbl_diameterSctpPort);
-#endif
 }

Attachment: sctp.out
Description: Binary data