forked from osmocom/wireshark
STUN: Check the Fingerprint (CRC32)
This commit is contained in:
parent
7f5089ba40
commit
37d3c7add2
|
@ -54,6 +54,7 @@
|
|||
#include <epan/packet.h>
|
||||
#include <epan/expert.h>
|
||||
#include <epan/to_str.h>
|
||||
#include <epan/crc32-tvb.h>
|
||||
#include <wsutil/ws_roundup.h>
|
||||
#include "packet-tcp.h"
|
||||
|
||||
|
@ -180,6 +181,7 @@ static int hf_stun_att_password = -1;
|
|||
static int hf_stun_att_padding = -1;
|
||||
static int hf_stun_att_hmac = -1;
|
||||
static int hf_stun_att_crc32 = -1;
|
||||
static int hf_stun_att_crc32_status = -1;
|
||||
static int hf_stun_att_error_class = -1;
|
||||
static int hf_stun_att_error_number = -1;
|
||||
static int hf_stun_att_error_reason = -1;
|
||||
|
@ -245,6 +247,7 @@ static expert_field ei_stun_short_packet = EI_INIT;
|
|||
static expert_field ei_stun_wrong_msglen = EI_INIT;
|
||||
static expert_field ei_stun_long_attribute = EI_INIT;
|
||||
static expert_field ei_stun_unknown_attribute = EI_INIT;
|
||||
static expert_field ei_stun_fingerprint_bad = EI_INIT;
|
||||
|
||||
/* Structure containing transaction specific information */
|
||||
typedef struct _stun_transaction_t {
|
||||
|
@ -1517,7 +1520,7 @@ dissect_stun_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboole
|
|||
case FINGERPRINT:
|
||||
if (att_length < 4)
|
||||
break;
|
||||
proto_tree_add_item(att_tree, hf_stun_att_crc32, tvb, offset, att_length, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_checksum(att_tree, tvb, offset, hf_stun_att_crc32, hf_stun_att_crc32_status, &ei_stun_fingerprint_bad, pinfo, crc32_ccitt_tvb(tvb, offset-4) ^ 0x5354554e, ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY);
|
||||
break;
|
||||
|
||||
case ICE_CONTROLLED:
|
||||
|
@ -1945,6 +1948,10 @@ proto_register_stun(void)
|
|||
{ "CRC-32", "stun.att.crc32", FT_UINT32,
|
||||
BASE_HEX, NULL, 0x0, NULL, HFILL }
|
||||
},
|
||||
{ &hf_stun_att_crc32_status,
|
||||
{ "CRC-32 Status", "stun.att.crc32.status", FT_UINT8,
|
||||
BASE_NONE, VALS(proto_checksum_vals), 0x0, NULL, HFILL }
|
||||
},
|
||||
{ &hf_stun_att_error_class,
|
||||
{ "Error Class","stun.att.error.class", FT_UINT8,
|
||||
BASE_DEC, NULL, 0x07, NULL, HFILL}
|
||||
|
@ -2206,6 +2213,9 @@ proto_register_stun(void)
|
|||
|
||||
{ &ei_stun_unknown_attribute,
|
||||
{ "stun.unknown_attribute", PI_UNDECODED, PI_WARN, "Attribute unknown", EXPFILL }},
|
||||
|
||||
{ &ei_stun_fingerprint_bad,
|
||||
{ "stun.att.crc32.bad", PI_CHECKSUM, PI_WARN, "Bad Fingerprint", EXPFILL }},
|
||||
};
|
||||
|
||||
module_t *stun_module;
|
||||
|
|
Loading…
Reference in New Issue