diff options
author | Diederik de Groot <ddegroot@talon.nl> | 2015-09-13 12:26:23 +0200 |
---|---|---|
committer | Pascal Quantin <pascal.quantin@gmail.com> | 2015-09-13 19:24:00 +0000 |
commit | cf49f71c59b4b418ae04e4b70cac63f7f0b902ed (patch) | |
tree | 9a40a6037876c97a90b10b09d089d868b07b0e42 | |
parent | f2c5dee77c877e854460788c9f29342d4adb5499 (diff) |
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>
-rw-r--r-- | epan/dissectors/packet-skinny.c | 39 | ||||
-rw-r--r-- | tools/SkinnyProtocolOptimized.xml | 19 | ||||
-rwxr-xr-x | tools/parse_xml2skinny_dissector.py | 13 |
3 files changed, 56 insertions, 15 deletions
diff --git a/epan/dissectors/packet-skinny.c b/epan/dissectors/packet-skinny.c index 176e175676..2edae7b931 100644 --- a/epan/dissectors/packet-skinny.c +++ b/epan/dissectors/packet-skinny.c @@ -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 */ } } diff --git a/tools/SkinnyProtocolOptimized.xml b/tools/SkinnyProtocolOptimized.xml index 36d9b9a5b1..91485b1b4a 100644 --- a/tools/SkinnyProtocolOptimized.xml +++ b/tools/SkinnyProtocolOptimized.xml @@ -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"> diff --git a/tools/parse_xml2skinny_dissector.py b/tools/parse_xml2skinny_dissector.py index c1b3ae5c8a..dedbf22ddf 100755 --- a/tools/parse_xml2skinny_dissector.py +++ b/tools/parse_xml2skinny_dissector.py @@ -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') |