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
This commit is contained in:
parent
d5a35ed932
commit
da5f41cdad
|
@ -46,10 +46,10 @@ stream_server_LDADD = $(top_builddir)/src/libosmonetif.la \
|
|||
$(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_LIBS)
|
||||
|
||||
rs232_read_SOURCES = rs232-read.c
|
||||
rs232_read_LDADD = $(top_builddir)/src/libosmonetif.la $(LIBOSMOCORE_LIBS)
|
||||
rs232_read_LDADD = $(top_builddir)/src/libosmonetif.la $(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_LIBS)
|
||||
|
||||
rs232_write_SOURCES = rs232-write.c
|
||||
rs232_write_LDADD = $(top_builddir)/src/libosmonetif.la $(LIBOSMOCORE_LIBS)
|
||||
rs232_write_LDADD = $(top_builddir)/src/libosmonetif.la $(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_LIBS)
|
||||
|
||||
rtp_udp_test_client_SOURCES = rtp-udp-test-client.c
|
||||
rtp_udp_test_client_LDADD = $(top_builddir)/src/libosmonetif.la \
|
||||
|
|
|
@ -27,7 +27,6 @@ struct osmo_fd;
|
|||
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);
|
||||
|
|
32
src/ipa.c
32
src/ipa.c
|
@ -130,35 +130,6 @@ int osmo_ipa_process_msg(struct msgb *msg)
|
|||
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 @@ osmo_ipa_parse_msg_id_resp(struct msgb *msg, struct ipaccess_unit *unit_data)
|
|||
|
||||
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");
|
||||
|
|
|
@ -5,13 +5,13 @@ check_PROGRAMS = osmux/osmux_test osmux/osmux_test2 jibuf/jibuf_test
|
|||
check_HEADERS =
|
||||
|
||||
osmux_osmux_test_SOURCES = osmux/osmux_test.c
|
||||
osmux_osmux_test_LDADD = $(LIBOSMOCORE_LIBS) $(top_builddir)/src/libosmonetif.la
|
||||
osmux_osmux_test_LDADD = $(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_LIBS) $(top_builddir)/src/libosmonetif.la
|
||||
|
||||
osmux_osmux_test2_SOURCES = osmux/osmux_test2.c
|
||||
osmux_osmux_test2_LDADD = $(LIBOSMOCORE_LIBS) $(top_builddir)/src/libosmonetif.la
|
||||
osmux_osmux_test2_LDADD = $(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_LIBS) $(top_builddir)/src/libosmonetif.la
|
||||
|
||||
jibuf_jibuf_test_SOURCES = jibuf/jibuf_test.c
|
||||
jibuf_jibuf_test_LDADD = $(LIBOSMOCORE_LIBS) $(top_builddir)/src/libosmonetif.la
|
||||
jibuf_jibuf_test_LDADD = $(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_LIBS) $(top_builddir)/src/libosmonetif.la
|
||||
|
||||
if HAVE_PCAP
|
||||
check_PROGRAMS += jibuf/jibuf_tool
|
||||
|
@ -31,6 +31,7 @@ jibuf_jibuf_tool_SOURCES = \
|
|||
|
||||
jibuf_jibuf_tool_LDADD = \
|
||||
$(LIBOSMOCORE_LIBS) \
|
||||
$(LIBOSMOGSM_LIBS) \
|
||||
$(top_builddir)/src/libosmonetif.la \
|
||||
-lpcap
|
||||
endif
|
||||
|
|
Loading…
Reference in New Issue