2004-03-25 11:21:07 +00:00
|
|
|
/* packet-rudp.c
|
|
|
|
* Routines for Reliable UDP Protocol.
|
|
|
|
* Copyright 2004, Duncan Sargeant <dunc-ethereal@rcpt.to>
|
|
|
|
*
|
2006-05-21 05:12:17 +00:00
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
2004-03-25 11:21:07 +00:00
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
|
|
|
* Copied from packet-data.c, README.developer, and various other files.
|
|
|
|
*
|
2018-02-12 11:23:27 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
2004-03-25 11:21:07 +00:00
|
|
|
|
|
|
|
|
|
|
|
* Reliable UDP is a lightweight protocol for providing TCP-like flow
|
|
|
|
* control over UDP. Cisco published an PFC a long time ago, and
|
|
|
|
* their actual implementation is slightly different, having no
|
|
|
|
* checksum field.
|
|
|
|
*
|
|
|
|
* I've cheated here - RUDP could be used for anything, but I've only
|
|
|
|
* seen it used to switched telephony calls, so we just call the Cisco SM
|
|
|
|
* dissector from here.
|
|
|
|
*
|
|
|
|
* Here are some links:
|
2011-10-21 02:10:19 +00:00
|
|
|
*
|
2004-03-25 11:21:07 +00:00
|
|
|
* http://www.watersprings.org/pub/id/draft-ietf-sigtran-reliable-udp-00.txt
|
|
|
|
* http://www.javvin.com/protocolRUDP.html
|
|
|
|
* http://www.cisco.com/univercd/cc/td/doc/product/access/sc/rel7/omts/omts_apb.htm#30052
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2012-09-20 02:03:38 +00:00
|
|
|
#include "config.h"
|
2004-03-25 11:21:07 +00:00
|
|
|
|
|
|
|
#include <epan/packet.h>
|
2006-08-10 01:59:41 +00:00
|
|
|
|
2013-12-12 06:11:05 +00:00
|
|
|
|
|
|
|
void proto_register_rudp(void);
|
|
|
|
|
2006-08-10 01:59:41 +00:00
|
|
|
void proto_reg_handoff_rudp(void);
|
2004-03-25 11:21:07 +00:00
|
|
|
|
|
|
|
static int proto_rudp = -1;
|
|
|
|
|
|
|
|
static int hf_rudp_flags = -1;
|
|
|
|
static int hf_rudp_flags_syn = -1;
|
|
|
|
static int hf_rudp_flags_ack = -1;
|
|
|
|
static int hf_rudp_flags_eak = -1;
|
|
|
|
static int hf_rudp_flags_rst = -1;
|
|
|
|
static int hf_rudp_flags_nul = -1;
|
|
|
|
static int hf_rudp_flags_chk = -1;
|
|
|
|
static int hf_rudp_flags_tcs = -1;
|
|
|
|
static int hf_rudp_flags_0 = -1;
|
|
|
|
static int hf_rudp_hlen = -1;
|
|
|
|
static int hf_rudp_seq = -1;
|
|
|
|
static int hf_rudp_ack = -1;
|
2008-10-13 12:55:16 +00:00
|
|
|
static int hf_rudp_cksum = -1;
|
2004-03-25 11:21:07 +00:00
|
|
|
|
|
|
|
static gint ett_rudp = -1;
|
|
|
|
static gint ett_rudp_flags = -1;
|
|
|
|
|
2008-10-13 12:55:16 +00:00
|
|
|
static dissector_handle_t sm_handle = NULL;
|
2004-03-25 11:21:07 +00:00
|
|
|
|
2015-11-18 01:16:06 +00:00
|
|
|
static int
|
|
|
|
dissect_rudp(tvbuff_t *tvb, packet_info *pinfo _U_ , proto_tree *tree, void* data _U_)
|
2004-03-25 11:21:07 +00:00
|
|
|
{
|
2015-11-25 20:18:02 +00:00
|
|
|
tvbuff_t * next_tvb;
|
|
|
|
proto_tree *rudp_tree;
|
|
|
|
proto_item *ti;
|
2004-03-25 11:21:07 +00:00
|
|
|
guint8 hlen;
|
2015-11-25 20:18:02 +00:00
|
|
|
static const int * flags[] = {
|
|
|
|
&hf_rudp_flags_syn,
|
|
|
|
&hf_rudp_flags_ack,
|
|
|
|
&hf_rudp_flags_eak,
|
|
|
|
&hf_rudp_flags_rst,
|
|
|
|
&hf_rudp_flags_nul,
|
|
|
|
&hf_rudp_flags_chk,
|
|
|
|
&hf_rudp_flags_tcs,
|
|
|
|
&hf_rudp_flags_0,
|
|
|
|
NULL
|
|
|
|
};
|
2004-03-30 19:36:50 +00:00
|
|
|
|
2004-03-25 11:21:07 +00:00
|
|
|
hlen = tvb_get_guint8(tvb, 1);
|
|
|
|
|
2009-08-09 06:26:46 +00:00
|
|
|
col_set_str(pinfo->cinfo, COL_PROTOCOL, "RUDP");
|
2009-08-09 07:36:13 +00:00
|
|
|
col_clear(pinfo->cinfo, COL_INFO);
|
2004-03-25 11:21:07 +00:00
|
|
|
|
2015-11-25 20:18:02 +00:00
|
|
|
ti = proto_tree_add_item(tree, proto_rudp, tvb, 0, hlen, ENC_NA);
|
|
|
|
rudp_tree = proto_item_add_subtree(ti, ett_rudp);
|
2004-03-25 11:21:07 +00:00
|
|
|
|
2015-11-25 20:18:02 +00:00
|
|
|
proto_tree_add_bitmask(rudp_tree, tvb, 0, hf_rudp_flags, ett_rudp_flags, flags, ENC_BIG_ENDIAN);
|
2004-03-25 11:21:07 +00:00
|
|
|
|
2015-11-25 20:18:02 +00:00
|
|
|
proto_tree_add_item(rudp_tree, hf_rudp_hlen, tvb, 1, 1, ENC_BIG_ENDIAN);
|
|
|
|
proto_tree_add_item(rudp_tree, hf_rudp_seq, tvb, 2, 1, ENC_BIG_ENDIAN);
|
|
|
|
proto_tree_add_item(rudp_tree, hf_rudp_ack, tvb, 3, 1, ENC_BIG_ENDIAN);
|
2008-10-13 12:55:16 +00:00
|
|
|
|
2015-11-25 20:18:02 +00:00
|
|
|
/* If the header is more than 4 bytes the next 2 bytes are the checksum */
|
|
|
|
if (hlen > 4) {
|
2016-07-11 03:47:28 +00:00
|
|
|
proto_tree_add_checksum(rudp_tree, tvb, 4, hf_rudp_cksum, -1, NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
|
2015-11-25 20:18:02 +00:00
|
|
|
}
|
2008-10-13 12:55:16 +00:00
|
|
|
|
2015-11-25 20:18:02 +00:00
|
|
|
/* If we have even more bytes their meaning is unknown - we have seen this
|
|
|
|
* in live captures */
|
|
|
|
if (hlen > 6) {
|
|
|
|
next_tvb = tvb_new_subset_length(tvb, 6, hlen-6);
|
2016-03-20 00:33:14 +00:00
|
|
|
call_data_dissector(next_tvb, pinfo, rudp_tree);
|
2004-03-25 11:21:07 +00:00
|
|
|
}
|
|
|
|
|
2009-08-16 12:36:22 +00:00
|
|
|
next_tvb = tvb_new_subset_remaining(tvb, hlen);
|
2015-06-23 00:05:37 +00:00
|
|
|
if (tvb_captured_length(next_tvb) && sm_handle)
|
2008-10-13 12:55:16 +00:00
|
|
|
call_dissector(sm_handle, next_tvb, pinfo, tree);
|
2015-11-18 01:16:06 +00:00
|
|
|
|
|
|
|
return tvb_captured_length(tvb);
|
2004-03-25 11:21:07 +00:00
|
|
|
}
|
|
|
|
|
2004-04-25 11:14:01 +00:00
|
|
|
void
|
2004-04-25 11:20:43 +00:00
|
|
|
proto_register_rudp(void)
|
2004-03-25 11:21:07 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
static hf_register_info hf[] = {
|
|
|
|
{ &hf_rudp_flags,
|
|
|
|
{ "RUDP Header flags", "rudp.flags",
|
|
|
|
FT_UINT8, BASE_DEC, NULL, 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL }
|
2004-03-25 11:21:07 +00:00
|
|
|
},
|
|
|
|
{ &hf_rudp_flags_syn,
|
|
|
|
{ "Syn", "rudp.flags.syn",
|
|
|
|
FT_BOOLEAN, 8, NULL, 0x80,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL }
|
2004-03-25 11:21:07 +00:00
|
|
|
},
|
|
|
|
{ &hf_rudp_flags_ack,
|
|
|
|
{ "Ack", "rudp.flags.ack",
|
2004-03-25 23:09:18 +00:00
|
|
|
FT_BOOLEAN, 8, NULL, 0x40,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL }
|
2004-03-25 11:21:07 +00:00
|
|
|
},
|
|
|
|
{ &hf_rudp_flags_eak,
|
|
|
|
{ "Eak", "rudp.flags.eak",
|
2004-03-25 23:09:18 +00:00
|
|
|
FT_BOOLEAN, 8, NULL, 0x20,
|
|
|
|
"Extended Ack", HFILL }
|
2004-03-25 11:21:07 +00:00
|
|
|
},
|
|
|
|
{ &hf_rudp_flags_rst,
|
|
|
|
{ "RST", "rudp.flags.rst",
|
2004-03-25 23:09:18 +00:00
|
|
|
FT_BOOLEAN, 8, NULL, 0x10,
|
|
|
|
"Reset flag", HFILL }
|
2004-03-25 11:21:07 +00:00
|
|
|
},
|
|
|
|
{ &hf_rudp_flags_nul,
|
|
|
|
{ "NULL", "rudp.flags.nul",
|
2004-03-25 23:09:18 +00:00
|
|
|
FT_BOOLEAN, 8, NULL, 0x08,
|
|
|
|
"Null flag", HFILL }
|
2004-03-25 11:21:07 +00:00
|
|
|
},
|
|
|
|
{ &hf_rudp_flags_chk,
|
|
|
|
{ "CHK", "rudp.flags.chk",
|
2004-03-25 23:09:18 +00:00
|
|
|
FT_BOOLEAN, 8, NULL, 0x04,
|
|
|
|
"Checksum is on header or body", HFILL }
|
2004-03-25 11:21:07 +00:00
|
|
|
},
|
|
|
|
{ &hf_rudp_flags_tcs,
|
|
|
|
{ "TCS", "rudp.flags.tcs",
|
2004-03-25 23:09:18 +00:00
|
|
|
FT_BOOLEAN, 8, NULL, 0x02,
|
|
|
|
"Transfer Connection System", HFILL }
|
2004-03-25 11:21:07 +00:00
|
|
|
},
|
|
|
|
{ &hf_rudp_flags_0,
|
|
|
|
{ "0", "rudp.flags.0",
|
2004-03-25 23:09:18 +00:00
|
|
|
FT_BOOLEAN, 8, NULL, 0x01,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL }
|
2004-03-25 11:21:07 +00:00
|
|
|
},
|
|
|
|
{ &hf_rudp_hlen,
|
|
|
|
{ "Header Length", "rudp.hlen",
|
2004-03-25 23:09:18 +00:00
|
|
|
FT_UINT8, BASE_DEC, NULL, 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL }
|
2004-03-25 11:21:07 +00:00
|
|
|
},
|
|
|
|
{ &hf_rudp_seq,
|
|
|
|
{ "Seq", "rudp.seq",
|
2004-03-25 23:09:18 +00:00
|
|
|
FT_UINT8, BASE_DEC, NULL, 0x0,
|
|
|
|
"Sequence Number", HFILL }
|
2004-03-25 11:21:07 +00:00
|
|
|
},
|
|
|
|
{ &hf_rudp_ack,
|
|
|
|
{ "Ack", "rudp.ack",
|
2004-03-25 23:09:18 +00:00
|
|
|
FT_UINT8, BASE_DEC, NULL, 0x0,
|
|
|
|
"Acknowledgement Number", HFILL }
|
2004-03-25 11:21:07 +00:00
|
|
|
},
|
|
|
|
{ &hf_rudp_cksum,
|
|
|
|
{ "Checksum", "rudp.cksum",
|
2008-10-13 12:55:16 +00:00
|
|
|
FT_UINT16, BASE_HEX, NULL, 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL }
|
2004-03-25 11:21:07 +00:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/* Setup protocol subtree array */
|
|
|
|
static gint *ett[] = {
|
|
|
|
&ett_rudp,
|
|
|
|
&ett_rudp_flags,
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2016-10-05 20:33:54 +00:00
|
|
|
proto_rudp = proto_register_protocol ("Reliable UDP", "RUDP", "rudp");
|
2004-03-25 11:21:07 +00:00
|
|
|
|
|
|
|
proto_register_field_array(proto_rudp, hf, array_length(hf));
|
|
|
|
proto_register_subtree_array(ett, array_length(ett));
|
|
|
|
}
|
|
|
|
|
2004-04-25 11:14:01 +00:00
|
|
|
void
|
|
|
|
proto_reg_handoff_rudp(void) {
|
2004-03-25 11:21:07 +00:00
|
|
|
|
2016-10-05 20:33:54 +00:00
|
|
|
dissector_handle_t rudp_handle;
|
2004-03-25 11:21:07 +00:00
|
|
|
|
2016-10-05 20:33:54 +00:00
|
|
|
/* Disable rudp by default. The previously hardcoded value of
|
|
|
|
* 7000 (used by Cisco) collides with afs and as the draft states:
|
|
|
|
* "RUDP doesn't place any restrictions on which UDP port numbers are used.
|
|
|
|
* Valid port numbers are ports not defined in RFC 1700."
|
|
|
|
*/
|
|
|
|
/* FIXME: The proper solution would be to convert this dissector into
|
|
|
|
* heuristic dissector, but it isn't complete anyway.
|
|
|
|
*/
|
|
|
|
|
|
|
|
rudp_handle = create_dissector_handle(dissect_rudp, proto_rudp);
|
|
|
|
dissector_add_for_decode_as_with_preference("udp.port", rudp_handle);
|
|
|
|
sm_handle = find_dissector_add_dependency("sm", proto_rudp);
|
2004-03-25 11:21:07 +00:00
|
|
|
}
|
2014-10-04 15:28:35 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Editor modelines - http://www.wireshark.org/tools/modelines.html
|
|
|
|
*
|
|
|
|
* Local variables:
|
|
|
|
* c-basic-offset: 8
|
|
|
|
* tab-width: 8
|
|
|
|
* indent-tabs-mode: t
|
|
|
|
* End:
|
|
|
|
*
|
|
|
|
* vi: set shiftwidth=8 tabstop=8 noexpandtab:
|
|
|
|
* :indentSize=8:tabSize=8:noTabs=false:
|
|
|
|
*/
|