aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-lsd.c
diff options
context:
space:
mode:
authorAlexis La Goutte <alexis.lagoutte@gmail.com>2019-08-08 10:27:17 +0200
committerAnders Broman <a.broman58@gmail.com>2019-11-10 07:35:09 +0000
commitfd35374226a3127920ba5e97075c192ed34c59b4 (patch)
treece2ce487f810225e0684b809f26a31b8fdbd78c2 /epan/dissectors/packet-lsd.c
parent059e02b704b31019e685ce8f9eab1e9f94c39466 (diff)
lsd: Add cookie field (optional)
Bug: 15971 Change-Id: I6d55ffebcdc2e417d922731bddae407474c47505 Reviewed-on: https://code.wireshark.org/review/34210 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-lsd.c')
-rw-r--r--epan/dissectors/packet-lsd.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/epan/dissectors/packet-lsd.c b/epan/dissectors/packet-lsd.c
index 450ca3b1b7..890bf6393a 100644
--- a/epan/dissectors/packet-lsd.c
+++ b/epan/dissectors/packet-lsd.c
@@ -28,6 +28,7 @@ static int hf_lsd_header = -1;
static int hf_lsd_host = -1;
static int hf_lsd_port = -1;
static int hf_lsd_infohash = -1;
+static int hf_lsd_cookie = -1;
static gint ett_lsd = -1;
@@ -118,6 +119,17 @@ dissect_lsd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
if (!parse_string_field(lsd_tree, hf_lsd_infohash, pinfo, tvb, offset, &next_offset, &linelen))
return offset+linelen;
+ offset = next_offset;
+ linelen = tvb_find_line_end(tvb, offset, -1, &next_offset, FALSE);
+ if (linelen < 0)
+ return offset+linelen;
+ /* Cookie is optionnal */
+ if (tvb_strncaseeql(tvb, offset, "cookie", strlen("cookie") == 0))
+ {
+ if (!parse_string_field(lsd_tree, hf_lsd_cookie, pinfo, tvb, offset, &next_offset, &linelen))
+ return offset+linelen;
+ }
+
return tvb_captured_length(tvb);
}
@@ -153,6 +165,10 @@ proto_register_lsd(void)
{ "Infohash", "lsd.infohash",
FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }
},
+ { &hf_lsd_cookie,
+ { "cookie", "lsd.cookie",
+ FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }
+ },
};
static gint *ett[] = {