From c9bebbd325e567333486a90b92d16ee464a4458a Mon Sep 17 00:00:00 2001
From: Stefan Sperling <ssperling@sysmocom.de>
Date: Fri, 16 Mar 2018 15:59:01 +0100
Subject: add a regression test for TLV parsing with repeated IEs

Since commit bf383a1d83661af26ccd6521c49b655fb22531d4 tlv_parse()
will return the first occurrence of a repeated IE. Add a test to
verify this behaviour. This test passes with the current code and
fails if bf383a1d83661af26ccd6521c49b655fb22531d4 is reverted.

While here, fix lies in documentation about the return value of tlv_parse()
and fix a typo in another comment.

Change-Id: I041f38548c5e4236920991d6c681c1c1e04de9ca
Related: OS#2904
---
 src/gsm/tlv_parser.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'src')

diff --git a/src/gsm/tlv_parser.c b/src/gsm/tlv_parser.c
index b8c7149f..f6939713 100644
--- a/src/gsm/tlv_parser.c
+++ b/src/gsm/tlv_parser.c
@@ -48,7 +48,7 @@
 struct tlv_definition tvlv_att_def;
 struct tlv_definition vtvlv_gan_att_def;
 
-/*! Dump pasred TLV structure to stdout */
+/*! Dump parsed TLV structure to stdout */
 int tlv_dump(struct tlv_parsed *dec)
 {
 	int i;
@@ -227,7 +227,7 @@ tlv:		/* GSM TS 04.07 11.2.4: Type 4 TLV */
  *  \param[in] buf_len length of the input data buffer
  *  \param[in] lv_tag an initial LV tag at the start of the buffer
  *  \param[in] lv_tag2 a second initial LV tag following the \a lv_tag
- *  \returns number of bytes consumed by the TLV entry / IE parsed; negative in case of error
+ *  \returns number of TLV entries parsed; negative in case of error
  */
 int tlv_parse(struct tlv_parsed *dec, const struct tlv_definition *def,
 	      const uint8_t *buf, int buf_len, uint8_t lv_tag,
-- 
cgit v1.2.3