diff options
author | guy <guy@f5534014-38df-0310-8fa8-9805f1628bb7> | 2003-10-01 21:15:45 +0000 |
---|---|---|
committer | guy <guy@f5534014-38df-0310-8fa8-9805f1628bb7> | 2003-10-01 21:15:45 +0000 |
commit | e38b5f65aa5b57c79373bc45f59020a70a37d137 (patch) | |
tree | 558a5308cd5ce49108b776e524858b833369eba0 /packet-srvloc.c | |
parent | af20ae28552fc9659dac3b589b4f1a77c32a1d01 (diff) |
The PDU length is 3 bytes long in SLPv2.
The minimum number of bytes of SLP we have to reassemble is 5 - it's
nominally 4 for SLPv1, but we don't have a way of asking for 1 byte (the
version) and then saying "I need N bytes of header to get the PDU
length, and an SLPv1 packet less than 12 bytes long is bogus anyway.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@8584 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'packet-srvloc.c')
-rw-r--r-- | packet-srvloc.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/packet-srvloc.c b/packet-srvloc.c index eb30224b36..e0807c6fb0 100644 --- a/packet-srvloc.c +++ b/packet-srvloc.c @@ -9,7 +9,7 @@ * In particular I have not had an opportunity to see how it * responds to SRVLOC over TCP. * - * $Id: packet-srvloc.c,v 1.42 2003/08/18 18:06:06 guy Exp $ + * $Id: packet-srvloc.c,v 1.43 2003/10/01 21:15:45 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -962,8 +962,13 @@ get_srvloc_pdu_len(tvbuff_t *tvb, int offset) { /* * Get the length of the SRVLOC packet. + * It starts at offset+2, but it's 2 bytes in SLPv1 and 3 bytes + * in SLPv2. */ - return tvb_get_ntohs(tvb, offset + 2); + if (tvb_get_guint8(tvb, offset) == 2) + return tvb_get_ntoh24(tvb, offset + 2); + else + return tvb_get_ntohs(tvb, offset + 2); } static void @@ -988,7 +993,15 @@ dissect_srvloc_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) static void dissect_srvloc_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - tcp_dissect_pdus(tvb, pinfo, tree, srvloc_desegment, 0, get_srvloc_pdu_len, + /* + * XXX - in SLPv1, the fixed length need only be 4, as the length + * is 2 bytes long; however, it must be 5 for SLPv2, as the length + * is 3 bytes long, and there's probably no harm in asking for 5 + * bytes, as even SLPv1 packets start with a 12-byte header, + * and if the packet has a length that's 4 or less, it's bogus, + * and we can't handle a length < 4 anyway. + */ + tcp_dissect_pdus(tvb, pinfo, tree, srvloc_desegment, 5, get_srvloc_pdu_len, dissect_srvloc_pdu); } |