Ethereal-dev: Re: [Ethereal-dev] Small diameter patches
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: Tue, 10 Apr 2001 14:22:28 -0500
Woops . . attaching the context diffs this time :) On Tue, Apr 10, 2001 at 01:57:02PM -0500, David Frascone wrote: > This patch makes the following smallchanges to the Diameter dissector: > > o Two uint types -> time types so they are displayed properly. > o The identifier -> hop-by-hop and end-to-end identifiers, per the > new specification. > o Added g_warnings on bad packets, so the reason for the packet not > being displayed is shown. > > I'll understand if it's too late for this to make the release. > > > -Dave
Index: packet-diameter-defs.h
===================================================================
RCS file: /cvsroot/ethereal/packet-diameter-defs.h,v
retrieving revision 1.3
diff -c -r1.3 packet-diameter-defs.h
*** packet-diameter-defs.h 2001/02/23 19:26:26 1.3
--- packet-diameter-defs.h 2001/04/10 19:19:57
***************
*** 535,541 ****
{ DIAMETER_ATT_ROUTING_REALM, DIAMETER_STRING },
{ DIAMETER_ATT_SESSION_ID, DIAMETER_DATA },
{ DIAMETER_ATT_SESSION_TIMEOUT, DIAMETER_INTEGER32 },
! { DIAMETER_ATT_TIMESTAMP, DIAMETER_INTEGER32 },
{ DIAMETER_ATT_USER_NAME, DIAMETER_STRING },
{ DIAMETER_ATT_VENDOR_ID, DIAMETER_INTEGER32 },
{ DIAMETER_ATT_ACCOUNTING_AUTHENTICATION_TYPE, DIAMETER_INTEGER32 },
--- 535,541 ----
{ 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_USER_NAME, DIAMETER_STRING },
{ DIAMETER_ATT_VENDOR_ID, DIAMETER_INTEGER32 },
{ DIAMETER_ATT_ACCOUNTING_AUTHENTICATION_TYPE, DIAMETER_INTEGER32 },
***************
*** 598,604 ****
{ 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_INTEGER32 },
{ DIAMETER_ATT_COMMENT, DIAMETER_STRING },
{ DIAMETER_ATT_XVALUE, DIAMETER_INTEGER32 },
{ DIAMETER_ATT_XSTRING, DIAMETER_STRING },
--- 598,604 ----
{ 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_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.20
diff -c -r1.20 packet-diameter.c
*** packet-diameter.c 2001/02/23 19:26:26 1.20
--- packet-diameter.c 2001/04/10 19:20:00
***************
*** 77,83 ****
static int proto_diameter = -1;
static int hf_diameter_length = -1;
static int hf_diameter_code = -1;
! static int hf_diameter_id =-1;
static int hf_diameter_reserved = -1;
static int hf_diameter_flags = -1;
static int hf_diameter_version = -1;
--- 77,84 ----
static int proto_diameter = -1;
static int hf_diameter_length = -1;
static int hf_diameter_code = -1;
! static int hf_diameter_hopbyhopid =-1;
! static int hf_diameter_endtoendid =-1;
static int hf_diameter_reserved = -1;
static int hf_diameter_flags = -1;
static int hf_diameter_version = -1;
***************
*** 114,120 ****
guint8 reserved;
guint8 flagsVer;
guint16 pktLength;
! guint32 identifier;
guint32 commandCode;
guint32 vendorId;
} e_diameterhdr;
--- 115,122 ----
guint8 reserved;
guint8 flagsVer;
guint16 pktLength;
! guint32 hopByHopId;
! guint32 endToEndId;
guint32 commandCode;
guint32 vendorId;
} e_diameterhdr;
***************
*** 180,186 ****
/* Fix byte ordering in our static structure */
dh.pktLength = ntohs(dh.pktLength);
! dh.identifier = ntohl(dh.identifier);
dh.commandCode = ntohl(dh.commandCode);
dh.vendorId = ntohl(dh.vendorId);
--- 182,189 ----
/* Fix byte ordering in our static structure */
dh.pktLength = ntohs(dh.pktLength);
! dh.hopByHopId = ntohl(dh.hopByHopId);
! dh.endToEndId = ntohl(dh.endToEndId);
dh.commandCode = ntohl(dh.commandCode);
dh.vendorId = ntohl(dh.vendorId);
***************
*** 192,213 ****
/* Short packet. Should have at LEAST one avp */
if (dh.pktLength < MIN_DIAMETER_SIZE) {
BadPacket = TRUE;
}
/* And, check our reserved flags/version */
if (dh.reserved || (dh.flagsVer & DIAM_FLAGS_RESERVED) ||
((dh.flagsVer & 0x7) != 1)) {
BadPacket = TRUE;
}
if (check_col(pinfo->fd, COL_INFO)) {
col_add_fstr(pinfo->fd, COL_INFO,
! "%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,
(dh.flagsVer & DIAM_FLAGS_I)?1:0,
(dh.flagsVer & DIAM_FLAGS_R)?1:0);
--- 195,219 ----
/* Short packet. Should have at LEAST one avp */
if (dh.pktLength < MIN_DIAMETER_SIZE) {
+ g_warning("DIAMETER: Packet too short: %d bytes less than min size (%d bytes))",
+ dh.pktLength, MIN_DIAMETER_SIZE);
BadPacket = TRUE;
}
/* And, check our reserved flags/version */
if (dh.reserved || (dh.flagsVer & DIAM_FLAGS_RESERVED) ||
((dh.flagsVer & 0x7) != 1)) {
+ g_warning("DIAMETER: Bad packet: Bad Flags or Version");
BadPacket = TRUE;
}
if (check_col(pinfo->fd, COL_INFO)) {
col_add_fstr(pinfo->fd, COL_INFO,
! "%s%s: %s(%d) vendor=%d (hop-id=%d) (end-id=%d) EIR=%d%d%d",
(BadPacket)?"***** Bad Packet!: ":"",
DetermineMessageType(dh.flagsVer),
codestrval, dh.commandCode, dh.vendorId,
! dh.hopByHopId, dh.endToEndId,
(dh.flagsVer & DIAM_FLAGS_E)?1:0,
(dh.flagsVer & DIAM_FLAGS_I)?1:0,
(dh.flagsVer & DIAM_FLAGS_R)?1:0);
***************
*** 253,263 ****
offset, 2, dh.pktLength);
offset +=2;
! /* Identifier */
! proto_tree_add_uint(diameter_tree, hf_diameter_id,
! tvb, offset, 4, dh.identifier);
offset += 4;
/* Command Code */
proto_tree_add_uint(diameter_tree, hf_diameter_code,
tvb, offset, 4, dh.commandCode);
--- 259,274 ----
offset, 2, dh.pktLength);
offset +=2;
! /* Hop-by-hop Identifier */
! proto_tree_add_uint(diameter_tree, hf_diameter_hopbyhopid,
! tvb, offset, 4, dh.hopByHopId);
offset += 4;
+ /* End-to-end Identifier */
+ proto_tree_add_uint(diameter_tree, hf_diameter_endtoendid,
+ tvb, offset, 4, dh.endToEndId);
+ offset += 4;
+
/* Command Code */
proto_tree_add_uint(diameter_tree, hf_diameter_code,
tvb, offset, 4, dh.commandCode);
***************
*** 337,342 ****
--- 348,355 ----
/* Check for short packet */
if (packetLength < MIN_AVP_SIZE) {
+ g_warning("DIAMETER: AVP Payload too short: %d bytes less than min size (%d bytes))",
+ packetLength, MIN_AVP_SIZE);
BadPacket = TRUE;
/* Don't even bother trying to parse a short packet. */
return;
***************
*** 363,374 ****
--- 376,391 ----
/* Check for bad length */
if (avph.avp_length < MIN_AVP_SIZE ||
(avph.avp_length > packetLength)) {
+ g_warning("DIAMETER: AVP payload size invalid: avp_length: %d bytes, min: %d bytes, packetLen: %d",
+ avph.avp_length, MIN_AVP_SIZE, packetLength);
BadPacket = TRUE;
}
/* Check for bad flags */
if (avph.avp_reserved ||
(avph.avp_flags & AVP_FLAGS_RESERVED)) {
+ g_warning("DIAMETER: Invalid AVP: avph.avp_reserved = 0x%x, avph.avp_flags = 0x%x, resFl=0x%x",
+ avph.avp_reserved, avph.avp_flags, AVP_FLAGS_RESERVED);
BadPacket = TRUE;
}
***************
*** 383,388 ****
--- 400,407 ----
/* Check for out of bounds */
if (packetLength < 0) {
+ g_warning("DIAMETER: Bad AVP: Bad new length (%d bytes)",
+ packetLength);
BadPacket = TRUE;
}
***************
*** 767,776 ****
"" }},
{ &hf_diameter_length,
{ "Length","diameter.length", FT_UINT16, BASE_DEC, NULL, 0x0,
- "" }},
- { &hf_diameter_id,
- { "Identifier", "diameter.id", FT_UINT32, BASE_HEX, NULL, 0x0,
"" }},
{ &hf_diameter_code,
{ "Command Code","diameter.code", FT_UINT32, BASE_DEC,
VALS(diameter_command_code_vals), 0x0, "" }},
--- 786,798 ----
"" }},
{ &hf_diameter_length,
{ "Length","diameter.length", FT_UINT16, BASE_DEC, NULL, 0x0,
"" }},
+ { &hf_diameter_hopbyhopid,
+ { "Hop-by-Hop Identifier", "diameter.hopbyhopid", FT_UINT32,
+ BASE_HEX, NULL, 0x0, "" }},
+ { &hf_diameter_endtoendid,
+ { "End-to-End Identifier", "diameter.endtoendid", FT_UINT32,
+ BASE_HEX, NULL, 0x0, "" }},
{ &hf_diameter_code,
{ "Command Code","diameter.code", FT_UINT32, BASE_DEC,
VALS(diameter_command_code_vals), 0x0, "" }},
- Follow-Ups:
- Re: [Ethereal-dev] Small diameter patches
- From: Guy Harris
- Re: [Ethereal-dev] Small diameter patches
- References:
- [Ethereal-dev] Small diameter patches
- From: David Frascone
- [Ethereal-dev] Small diameter patches
- Prev by Date: Re: [Ethereal-dev] ip defragment, virtual packets
- Next by Date: Re: [Ethereal-dev] Small diameter patches
- Previous by thread: [Ethereal-dev] Small diameter patches
- Next by thread: Re: [Ethereal-dev] Small diameter patches
- Index(es):





