Change in libosmo-netif[master]: Migrate from osmo_ipa_idtag_parse() to ipa_ccm_id_resp_parse()

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Wed Aug 1 11:40:51 UTC 2018


Harald Welte has uploaded this change for review. ( https://gerrit.osmocom.org/10296


Change subject: Migrate from osmo_ipa_idtag_parse() to ipa_ccm_id_resp_parse()
......................................................................

Migrate from osmo_ipa_idtag_parse() to ipa_ccm_id_resp_parse()

In libosmocore Change-ID I1834d90fbcdbfcb05f5b8cfe39bfe9543737ef8f
we have introduced ipa_ccm_id_resp_parse() as a bugfixed replacement
of ipa_ccm_idtag_parse().

The main difference is that the returned "value" parts now have
a correct reported "length", whereas before this commit they all
reported a one-byte too-long "length" for each IE.

Let's use this opportunity to remove the copy+pasted
osmo_ipa_idtag_parse() function from the libosmo-netif codebase.

Change-Id: I4626d247626543e032593bf226b6c233f6678562
---
M include/osmocom/netif/ipa.h
M src/ipa.c
2 files changed, 1 insertion(+), 32 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/96/10296/1

diff --git a/include/osmocom/netif/ipa.h b/include/osmocom/netif/ipa.h
index 0a29f01..0d1085f 100644
--- a/include/osmocom/netif/ipa.h
+++ b/include/osmocom/netif/ipa.h
@@ -27,7 +27,6 @@
 struct tlv_parsed;
 
 int osmo_ipa_rcvmsg_base(struct msgb *msg, struct osmo_fd *bfd, int server);
-int osmo_ipa_idtag_parse(struct tlv_parsed *dec, unsigned char *buf, int len);
 int osmo_ipa_parse_unitid(const char *str, struct ipaccess_unit *unit_data);
 
 int ipaccess_send_pong(int fd);
diff --git a/src/ipa.c b/src/ipa.c
index 3888457..197a47f 100644
--- a/src/ipa.c
+++ b/src/ipa.c
@@ -130,35 +130,6 @@
 	return 0;
 }
 
-int osmo_ipa_idtag_parse(struct tlv_parsed *dec, unsigned char *buf, int len)
-{
-	uint8_t t_len;
-	uint8_t t_tag;
-	uint8_t *cur = buf;
-
-	memset(dec, 0, sizeof(*dec));
-
-	while (len >= 2) {
-		len -= 2;
-		t_len = *cur++;
-		t_tag = *cur++;
-
-		if (t_len > len + 1) {
-			LOGP(DLMI, LOGL_ERROR, "The tag does not fit: %d\n", t_len);
-			return -EINVAL;
-		}
-
-		DEBUGPC(DLMI, "%s='%s' ", ipaccess_idtag_name(t_tag), cur);
-
-		dec->lv[t_tag].len = t_len;
-		dec->lv[t_tag].val = cur;
-
-		cur += t_len;
-		len -= t_len;
-	}
-	return 0;
-}
-
 int osmo_ipa_parse_unitid(const char *str, struct ipaccess_unit *unit_data)
 {
 	unsigned long ul;
@@ -368,8 +339,7 @@
 
 	DEBUGP(DLINP, "ID_RESP\n");
 	/* parse tags, search for Unit ID */
-	ret = osmo_ipa_idtag_parse(&tlvp, (uint8_t *)msg->l2h + 2,
-					msgb_l2len(msg)-2);
+	ret = ipa_ccm_id_resp_parse(&tlvp, (const uint8_t *)msg->l2h + 1, msgb_l2len(msg)-1);
 	if (ret < 0) {
 		LOGP(DLINP, LOGL_ERROR, "IPA response message "
 			"with malformed TLVs\n");

-- 
To view, visit https://gerrit.osmocom.org/10296
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I4626d247626543e032593bf226b6c233f6678562
Gerrit-Change-Number: 10296
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180801/4b9c32a5/attachment.htm>


More information about the gerrit-log mailing list