dissector-skinny: Update skinny dissector to fix ServerRes Message

ServerRes message does not follow other message when it comes to
provinding the list of ip-addresses. The type of ip-address (IPv4
or IPv6 does not depend on the protocol version but the length of
the message.

Fix: ipv4 address displayed as ip-address

Change-Id: Ie16f81c9482b30a80da37b9327b09e933d7808f8
Reviewed-on: https://code.wireshark.org/review/10513
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
This commit is contained in:
Diederik de Groot 2015-09-13 12:26:23 +02:00 committed by Pascal Quantin
parent f2c5dee77c
commit cf49f71c59
3 changed files with 56 additions and 15 deletions

View File

@ -4880,6 +4880,8 @@ handle_RegisterRejectMessage(ptvcursor_t *cursor, packet_info * pinfo _U_)
static void
handle_ServerResMessage(ptvcursor_t *cursor, packet_info * pinfo _U_)
{
guint32 hdr_data_length = tvb_get_letohl(ptvcursor_tvbuff(cursor), 0);
{
/* start struct : server / size: 48 */
guint32 counter_1 = 0;
@ -4901,18 +4903,35 @@ handle_ServerResMessage(ptvcursor_t *cursor, packet_info * pinfo _U_)
}
ptvcursor_pop_subtree(cursor); /* end for loop tree: serverTcpListenPort */
}
{
/* start struct : serverIpAddr / size: 20 */
guint32 counter_1 = 0;
ptvcursor_add_text_with_subtree(cursor, SUBTREE_UNDEFINED_LENGTH, ett_skinny_tree, "serverIpAddr [max:5]");
for (counter_1 = 0; counter_1 < 5; counter_1++) {
ptvcursor_add_text_with_subtree(cursor, SUBTREE_UNDEFINED_LENGTH, ett_skinny_tree, "serverIpAddr [%d / %d]", counter_1 + 1, 5);
dissect_skinny_ipv4or6(cursor, hf_skinny_stationIpAddr_ipv4, hf_skinny_stationIpAddr_ipv6, pinfo);
if (hdr_data_length < 293) {
{
/* start struct : serverIpAddr / size: 4 */
guint32 counter_2 = 0;
ptvcursor_add_text_with_subtree(cursor, SUBTREE_UNDEFINED_LENGTH, ett_skinny_tree, "serverIpAddr [max:5]");
for (counter_2 = 0; counter_2 < 5; counter_2++) {
ptvcursor_add_text_with_subtree(cursor, SUBTREE_UNDEFINED_LENGTH, ett_skinny_tree, "serverIpAddr [%d / %d]", counter_2 + 1, 5);
ptvcursor_add(cursor, hf_skinny_stationIpAddr, 4, ENC_BIG_ENDIAN);
ptvcursor_pop_subtree(cursor);
/* end for loop tree: serverIpAddr */
}
ptvcursor_pop_subtree(cursor);
/* end for loop tree: serverIpAddr */
/* end struct: serverIpAddr */
}
}
if (hdr_data_length > 292) {
{
/* start struct : serverIpAddr / size: 20 */
guint32 counter_2 = 0;
ptvcursor_add_text_with_subtree(cursor, SUBTREE_UNDEFINED_LENGTH, ett_skinny_tree, "serverIpAddr [max:5]");
for (counter_2 = 0; counter_2 < 5; counter_2++) {
ptvcursor_add_text_with_subtree(cursor, SUBTREE_UNDEFINED_LENGTH, ett_skinny_tree, "serverIpAddr [%d / %d]", counter_2 + 1, 5);
dissect_skinny_ipv4or6(cursor, hf_skinny_stationIpAddr_ipv4, hf_skinny_stationIpAddr_ipv6, pinfo);
ptvcursor_pop_subtree(cursor);
/* end for loop tree: serverIpAddr */
}
ptvcursor_pop_subtree(cursor);
/* end struct: serverIpAddr */
}
ptvcursor_pop_subtree(cursor);
/* end struct: serverIpAddr */
}
}

View File

@ -812,7 +812,7 @@
<message comment="" direction="dev2pbx" dynamic="no" name="OpenReceiveChannelAckMessage" opcode="0x0022" status="no" type="MediaControl">
<fields>
<enum comment="" name="openReceiveChannelStatus" subtype="MediaStatus" type="uint32"/>
<ipv4or6 comment="" name="ipAddr" subtype="IpAddress" type="ipaddr"/>
<ipv4or6 comment="" name="ipAddr" subtype="IPV4orV6Address" type="ipaddr"/>
<integer comment="" name="portNumber" subtype="uint32" type="ipport" use_param="ipAddr"/>
<integer comment="PassThrough PartyId" name="passThruPartyID" type="uint32"/>
</fields>
@ -2186,7 +2186,7 @@
<fields>
<integer comment="Conference ID" name="conferenceID" type="uint32"/>
<integer comment="PassThrough PartyId" name="passThruPartyID" type="uint32"/>
<ipv4or6 comment="" name="remoteIpAddr" subtype="IpAddress" type="ipaddr"/>
<ipv4or6 comment="" name="remoteIpAddr" subtype="IPV4orV6Address" type="ipaddr"/>
<integer comment="" name="remotePortNumber" subtype="uint32" type="ipport" use_param="remoteIpAddr"/>
<integer comment="" name="millisecondPacketSize" type="uint32"/>
<enum comment="" declare="yes" name="compressionType" subtype="Media_PayloadType" type="uint32"/>
@ -2540,14 +2540,23 @@
</fields>
</message>
<message comment="" direction="pbx2dev" dynamic="no" name="ServerResMessage" opcode="0x009e" status="no" type="RegistrationAndManagement">
<fields beginversion="0" endversion="22">
<fields>
<struct comment="" name="server" size="5" subtype="ServerIdentifier" type="struct">
<fields>
<string comment="" name="ServerName" size="48" type="char"/>
</fields>
</struct>
<integer comment="" name="serverTcpListenPort" size="5" type="uint32"/>
<struct comment="" name="serverIpAddr" size="5" subtype="IpAddress" type="struct">
</fields>
<fields size_lt="293">
<struct comment="Server IPv4 Address" name="serverIpAddr" size="5" subtype="IPv4Address" type="struct">
<fields>
<ip comment="ipaddress in big endian" endianness="big" name="stationIpAddr" type="ipv4"/>
</fields>
</struct>
</fields>
<fields beginversion="0" endversion="22" size_gt="292">
<struct comment="Server IP Address (IPv4or6)" name="serverIpAddr" size="5" subtype="IPV4orV6Address" type="struct">
<fields>
<ipv4or6 comment="ipaddress in big endian" endianness="big" name="stationIpAddr" size="16" subtype="uint8" type="ipaddr"/>
</fields>
@ -2707,7 +2716,7 @@
<fields beginversion="11">
<integer comment="" name="mixingMode" type="uint32"/>
<integer comment="" name="partyDirection" type="uint32"/>
<ipv4or6 comment="" name="sourceIpAddr" subtype="IpAddress" type="ipaddr"/>
<ipv4or6 comment="" name="sourceIpAddr" subtype="IPV4orV6Address" type="ipaddr"/>
<integer comment="" name="sourcePortNumber" subtype="uint32" type="ipport" use_param="sourceIpAddr"/>
</fields>
<fields beginversion="16">

View File

@ -174,6 +174,11 @@ def xml2obj(src):
ret += self.indent_out("{\n")
self.incr_indent()
for fields in self.fields:
if fields.size_lt:
if self.basemessage.declared is None or "hdr_data_length" not in self.basemessage.declared:
ret += self.indent_out("guint32 hdr_data_length = tvb_get_letohl(ptvcursor_tvbuff(cursor), 0);\n")
self.basemessage.declared.append("hdr_data_length")
declarations += 1
if fields.size_gt:
if self.basemessage.declared is None or "hdr_data_length" not in self.basemessage.declared:
ret += self.indent_out("guint32 hdr_data_length = tvb_get_letohl(ptvcursor_tvbuff(cursor), 0);\n")
@ -232,6 +237,10 @@ def xml2obj(src):
ret += 'hdr_version <= V%s_MSG_TYPE) {\n' %self.endversion
self.incr_indent()
if self.size_lt:
ret += self.indent_out('if (hdr_data_length < %s) {\n' %self.size_lt)
self.incr_indent()
if self.size_gt:
ret += self.indent_out('if (hdr_data_length > %s) {\n' %self.size_gt)
self.incr_indent()
@ -240,6 +249,10 @@ def xml2obj(src):
for field in self._children:
ret += '%s' %(field.dissect())
if self.size_lt:
self.decr_indent()
ret += self.indent_out('}\n')
if self.size_gt:
self.decr_indent()
ret += self.indent_out('}\n')