forked from osmocom/wireshark
- Fix problems with parsing sctpprim headers
- Add dissection of nbap (as encap or inside sctp primitive) svn path=/trunk/; revision=19664
This commit is contained in:
parent
3ce4a70412
commit
d55c609c55
|
@ -192,10 +192,11 @@ static gboolean find_sctpprim_variant1_data_offset(tvbuff_t *tvb, int *data_offs
|
|||
int offset = *data_offset;
|
||||
|
||||
/* Get the sctpprim command code. */
|
||||
guint8 tag = tvb_get_guint8(tvb, offset++);
|
||||
guint8 first_tag = tvb_get_guint8(tvb, offset++);
|
||||
guint8 tag;
|
||||
|
||||
/* Only accept interested in data requests or indications */
|
||||
switch (tag)
|
||||
switch (first_tag)
|
||||
{
|
||||
case 0x04: /* data request */
|
||||
case 0x62: /* data indication */
|
||||
|
@ -204,17 +205,24 @@ static gboolean find_sctpprim_variant1_data_offset(tvbuff_t *tvb, int *data_offs
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
/* Length field. msb set indicates 2 bytes */
|
||||
if (tvb_get_guint8(tvb, offset) & 0x80)
|
||||
if (first_tag == 0x04)
|
||||
{
|
||||
offset += 2;
|
||||
/* Overall length field. msb set indicates 2 bytes */
|
||||
if (tvb_get_guint8(tvb, offset) & 0x80)
|
||||
{
|
||||
offset += 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
offset++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
offset++;
|
||||
offset += 3;
|
||||
}
|
||||
|
||||
/* Skip any other TLC fields before reach payload */
|
||||
/* Skip any other fields before reach payload */
|
||||
while (tvb_length_remaining(tvb, offset) > 2)
|
||||
{
|
||||
/* Look at next tag */
|
||||
|
@ -228,10 +236,29 @@ static gboolean find_sctpprim_variant1_data_offset(tvbuff_t *tvb, int *data_offs
|
|||
}
|
||||
else
|
||||
{
|
||||
/* Read length in next byte */
|
||||
length = tvb_get_guint8(tvb, offset++);
|
||||
/* Skip the following value */
|
||||
offset += length;
|
||||
if (first_tag == 0x62)
|
||||
{
|
||||
switch (tag)
|
||||
{
|
||||
case 0x0a: /* dest port */
|
||||
case 0x1e: /* strseqnum */
|
||||
case 0x0d:
|
||||
offset += 2;
|
||||
continue;
|
||||
case 0x1d:
|
||||
case 0x09:
|
||||
case 0x0c:
|
||||
offset += 4;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Read length in next byte */
|
||||
length = tvb_get_guint8(tvb, offset++);
|
||||
/* Skip the following value */
|
||||
offset += length;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -282,6 +309,9 @@ static gboolean find_sctpprim_variant3_data_offset(tvbuff_t *tvb, int *data_offs
|
|||
/* 2-byte length field */
|
||||
offset += 2;
|
||||
|
||||
/* Skip 2-byte length field */
|
||||
offset += 2;
|
||||
|
||||
/* Data is here!!! */
|
||||
*data_offset = offset;
|
||||
return TRUE;
|
||||
|
@ -372,6 +402,16 @@ dissector_handle_t look_for_dissector(char *protocol_name)
|
|||
{
|
||||
return find_dissector("rtp");
|
||||
}
|
||||
else
|
||||
if (strcmp(protocol_name, "sipt") == 0)
|
||||
{
|
||||
return find_dissector("sip");
|
||||
}
|
||||
else
|
||||
if (strncmp(protocol_name, "nbap_sctp", strlen("nbap_sctp")) == 0)
|
||||
{
|
||||
return find_dissector("nbap");
|
||||
}
|
||||
|
||||
/* Try for an exact match */
|
||||
else
|
||||
|
@ -696,6 +736,9 @@ dissect_catapult_dct2000(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
case DCT2000_ENCAP_MTP2:
|
||||
protocol_handle = find_dissector("mtp2");
|
||||
break;
|
||||
case DCT2000_ENCAP_NBAP:
|
||||
protocol_handle = find_dissector("nbap");
|
||||
break;
|
||||
case DCT2000_ENCAP_UNHANDLED:
|
||||
/* Show context.port in src or dest column as appropriate */
|
||||
if (check_col(pinfo->cinfo, COL_DEF_SRC) && direction == 0)
|
||||
|
|
|
@ -949,8 +949,17 @@ gboolean parse_line(gint line_length, gint *seconds, gint *useconds,
|
|||
*encap = DCT2000_ENCAP_MTP2;
|
||||
}
|
||||
else
|
||||
if ((strcmp(protocol_name, "nbap") == 0) ||
|
||||
(strcmp(protocol_name, "nbap_r4") == 0) ||
|
||||
(strncmp(protocol_name, "nbap_sscfuni", strlen("nbap_sscfuni")) == 0))
|
||||
{
|
||||
/* Not a supported board port protocol/encap, but can show as raw data anyway */
|
||||
/* The entire message in these cases is nbap, so use an encap value. */
|
||||
*encap = DCT2000_ENCAP_NBAP;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Not a supported board port protocol/encap, but can show as raw data or
|
||||
in some cases find protocol embedded inside primitive */
|
||||
*encap = DCT2000_ENCAP_UNHANDLED;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,3 +27,4 @@ int catapult_dct2000_dump_can_write_encap(int encap);
|
|||
#define DCT2000_ENCAP_UNHANDLED 0
|
||||
#define DCT2000_ENCAP_SSCOP 101
|
||||
#define DCT2000_ENCAP_MTP2 102
|
||||
#define DCT2000_ENCAP_NBAP 103
|
||||
|
|
Loading…
Reference in New Issue