lists.osmocom.org
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

gerrit-log

Thread Start a new thread
Download
Threads by month
  • ----- 2026 -----
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2025 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2024 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2023 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2022 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
gerrit-log@lists.osmocom.org

January 2024

  • 1 participants
  • 1559 discussions
[L] Change in osmocom-bb[master]: [WIP] mobile: implement sending CSD data over UNIX socket
by fixeria 15 Jan '24

15 Jan '24
fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmocom-bb/+/35583?usp=email ) Change subject: [WIP] mobile: implement sending CSD data over UNIX socket ...................................................................... [WIP] mobile: implement sending CSD data over UNIX socket Change-Id: Id054af7b3d9d0a41715f7981deb420f6e09bf30c Related: OS#4396 --- M src/host/layer23/include/osmocom/bb/mobile/tch.h M src/host/layer23/src/mobile/Makefile.am M src/host/layer23/src/mobile/tch_data.c A src/host/layer23/src/mobile/tch_data_sock.c 4 files changed, 284 insertions(+), 11 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/83/35583/1 diff --git a/src/host/layer23/include/osmocom/bb/mobile/tch.h b/src/host/layer23/include/osmocom/bb/mobile/tch.h index a31655a..c3c957a 100644 --- a/src/host/layer23/include/osmocom/bb/mobile/tch.h +++ b/src/host/layer23/include/osmocom/bb/mobile/tch.h @@ -13,6 +13,7 @@ } voice; struct tch_data_state { enum tch_data_io_handler handler; + struct tch_csd_sock_state *sock; struct osmo_v110_ta *v110_ta; struct osmo_soft_uart *suart; } data; diff --git a/src/host/layer23/src/mobile/Makefile.am b/src/host/layer23/src/mobile/Makefile.am index b4e45e2..d00e45e 100644 --- a/src/host/layer23/src/mobile/Makefile.am +++ b/src/host/layer23/src/mobile/Makefile.am @@ -33,6 +33,7 @@ primitives.c \ tch.c \ tch_data.c \ + tch_data_sock.c \ tch_voice.c \ transaction.c \ vty_interface.c \ diff --git a/src/host/layer23/src/mobile/tch_data.c b/src/host/layer23/src/mobile/tch_data.c index 082c397..21ed1c2 100644 --- a/src/host/layer23/src/mobile/tch_data.c +++ b/src/host/layer23/src/mobile/tch_data.c @@ -72,21 +72,31 @@ }, }; +struct tch_csd_sock_state *tch_csd_sock_init(void *ctx, const char *sock_path); +int tch_csd_sock_recv(struct tch_csd_sock_state *state, struct msgb *msg); +int tch_csd_sock_send(struct tch_csd_sock_state *state, struct msgb *msg); +void tch_csd_sock_exit(struct tch_csd_sock_state *state); + static void tch_soft_uart_rx_cb(void *priv, struct msgb *msg, unsigned int flags) { - LOGP(DL1C, LOGL_FATAL, "%s(): [flags=0x%08x] %s\n", + struct tch_data_state *state = (struct tch_data_state *)priv; + + LOGP(DL1C, LOGL_DEBUG, "%s(): [flags=0x%08x] %s\n", __func__, flags, msgb_hexdump(msg)); - msgb_free(msg); + + if (state->sock != NULL && msgb_length(msg) > 0) + tch_csd_sock_send(state->sock, msg); + else + msgb_free(msg); } static void tch_soft_uart_tx_cb(void *priv, struct msgb *msg) { - const char *data = "TEST\r\n"; - size_t n_bytes; + struct tch_data_state *state = (struct tch_data_state *)priv; + int n_bytes = tch_csd_sock_recv(state->sock, msg); - n_bytes = OSMO_MIN(msg->data_len, strlen(data)); - if (n_bytes > 0) - memcpy(msgb_put(msg, n_bytes), (void *)data, n_bytes); + LOGP(DL1C, LOGL_DEBUG, "%s(): [n_bytes=%u/%u] %s\n", + __func__, n_bytes, msg->data_len, msgb_hexdump(msg)); } struct osmo_soft_uart *tch_soft_uart_alloc(struct osmocom_ms *ms) @@ -169,7 +179,7 @@ int tch_csd_rx_from_l1(struct osmocom_ms *ms, struct msgb *msg) { - struct tch_data_state *state = &ms->tch_state->data; + const struct tch_data_state *state = &ms->tch_state->data; const struct gsm48_rr_cd *cd = &ms->rrlayer.cd_now; const struct csd_v110_frame_desc *desc; ubit_t data[4 * 60]; @@ -217,7 +227,7 @@ int tch_csd_tx_to_l1(struct osmocom_ms *ms) { - struct tch_data_state *state = &ms->tch_state->data; + const struct tch_data_state *state = &ms->tch_state->data; const struct gsm48_rr_cd *cd = &ms->rrlayer.cd_now; const struct csd_v110_frame_desc *desc; ubit_t data[60 * 4]; @@ -299,10 +309,13 @@ struct tch_data_state *state) { struct osmocom_ms *ms = trans->ms; + const struct gsm_settings *set = &ms->settings; switch (state->handler) { case TCH_DATA_IOH_UNIX_SOCK: - /* TODO: open listening socket */ + state->sock = tch_csd_sock_init(ms, set->tch_data.unix_socket_path); + if (state->sock == NULL) + return -ENOMEM; break; case TCH_DATA_IOH_LOOPBACK: case TCH_DATA_IOH_NONE: @@ -325,6 +338,8 @@ return 0; exit_free: + if (state->sock != NULL) + tch_csd_sock_exit(state->sock); if (state->suart != NULL) osmo_soft_uart_free(state->suart); if (state->v110_ta != NULL) @@ -341,7 +356,8 @@ switch (state->handler) { case TCH_DATA_IOH_UNIX_SOCK: - /* TODO: close listening socket */ + if (state->sock != NULL) + tch_csd_sock_exit(state->sock); break; default: break; diff --git a/src/host/layer23/src/mobile/tch_data_sock.c b/src/host/layer23/src/mobile/tch_data_sock.c new file mode 100644 index 0000000..c5cde6c --- /dev/null +++ b/src/host/layer23/src/mobile/tch_data_sock.c @@ -0,0 +1,245 @@ +/* + * (C) 2023 by sysmocom - s.f.m.c. GmbH <info(a)sysmocom.de> + * Author: Vadim Yanitskiy <vyanitskiy(a)sysmocom.de> + * + * All Rights Reserved + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include <stdio.h> +#include <unistd.h> +#include <stdlib.h> +#include <string.h> +#include <errno.h> +#include <assert.h> +#include <stdint.h> +#include <sys/socket.h> +#include <sys/un.h> + +#include <osmocom/core/talloc.h> +#include <osmocom/core/select.h> +#include <osmocom/core/timer.h> +#include <osmocom/core/msgb.h> +#include <osmocom/core/socket.h> + +#include <osmocom/bb/common/logging.h> +#include <osmocom/bb/common/osmocom_data.h> +#include <osmocom/bb/common/ms.h> +#include <osmocom/bb/mobile/tch.h> + +struct tch_csd_sock_state { + struct osmo_fd listen_bfd; /* fd for listen socket */ + struct osmo_fd conn_bfd; /* fd for a client connection */ + struct llist_head rxqueue; + struct llist_head txqueue; +}; + +static void tch_csd_sock_close(struct tch_csd_sock_state *state) +{ + struct osmo_fd *bfd = &state->conn_bfd; + + LOGP(DMOB, LOGL_NOTICE, "TCH CSD sock has closed connection\n"); + + osmo_fd_unregister(bfd); + close(bfd->fd); + bfd->fd = -1; + + /* re-enable the generation of ACCEPT for new connections */ + osmo_fd_read_enable(&state->listen_bfd); + + /* flush the queues */ + while (!llist_empty(&state->rxqueue)) + msgb_free(msgb_dequeue(&state->rxqueue)); + while (!llist_empty(&state->txqueue)) + msgb_free(msgb_dequeue(&state->txqueue)); +} + +static int tch_csd_sock_read(struct osmo_fd *bfd) +{ + struct tch_csd_sock_state *state = (struct tch_csd_sock_state *)bfd->data; + struct msgb *msg; + int rc; + + msg = msgb_alloc(256, "tch_csd_sock_rx"); + if (!msg) + return -ENOMEM; + + rc = recv(bfd->fd, msg->tail, msgb_tailroom(msg), 0); + if (rc == 0) + goto close; + if (rc < 0) { + if (errno == EAGAIN) + return 0; + goto close; + } + + msgb_put(msg, rc); + msgb_enqueue(&state->rxqueue, msg); + return rc; + +close: + msgb_free(msg); + tch_csd_sock_close(state); + return -1; +} + +static int tch_csd_sock_write(struct osmo_fd *bfd) +{ + struct tch_csd_sock_state *state = bfd->data; + + while (!llist_empty(&state->txqueue)) { + struct msgb *msg; + int rc; + + /* dequeue a msgb */ + msg = msgb_dequeue(&state->txqueue); + osmo_fd_write_disable(bfd); + + /* try to send it over the socket */ + rc = write(bfd->fd, msgb_data(msg), msgb_length(msg)); + if (rc == 0) { + llist_add(&msg->list, &state->txqueue); + goto close; + } else if (rc < 0) { + if (errno == EAGAIN) { + osmo_fd_write_enable(bfd); + break; + } + llist_add(&msg->list, &state->txqueue); + goto close; + } + } + + return 0; + +close: + tch_csd_sock_close(state); + return -1; +} + +static int tch_csd_sock_cb(struct osmo_fd *bfd, unsigned int flags) +{ + int rc = 0; + + if (flags & OSMO_FD_READ) { + rc = tch_csd_sock_read(bfd); + if (rc < 0) + return rc; + } + + if (flags & OSMO_FD_WRITE) + rc = tch_csd_sock_write(bfd); + + return rc; +} + +static int tch_csd_sock_accept(struct osmo_fd *bfd, unsigned int flags) +{ + struct tch_csd_sock_state *state = (struct tch_csd_sock_state *)bfd->data; + struct osmo_fd *conn_bfd = &state->conn_bfd; + struct sockaddr_un un_addr; + socklen_t len; + int rc; + + len = sizeof(un_addr); + rc = accept(bfd->fd, (struct sockaddr *)&un_addr, &len); + if (rc < 0) { + LOGP(DMOB, LOGL_ERROR, "Failed to accept() a new connection\n"); + return -1; + } + + if (conn_bfd->fd >= 0) { + LOGP(DMOB, LOGL_NOTICE, "TCH CSD sock already has an active connection\n"); + osmo_fd_read_disable(&state->listen_bfd); + close(rc); + return 0; + } + + osmo_fd_setup(conn_bfd, rc, OSMO_FD_READ, &tch_csd_sock_cb, state, 0); + if (osmo_fd_register(conn_bfd) != 0) { + LOGP(DMOB, LOGL_ERROR, "osmo_fd_register() failed\n"); + close(conn_bfd->fd); + conn_bfd->fd = -1; + return -1; + } + + LOGP(DMOB, LOGL_NOTICE, "TCH CSD sock got a connection\n"); + + return 0; +} + +struct tch_csd_sock_state *tch_csd_sock_init(void *ctx, const char *sock_path) +{ + struct tch_csd_sock_state *state; + struct osmo_fd *bfd; + int rc; + + state = talloc_zero(ctx, struct tch_csd_sock_state); + if (state == NULL) + return NULL; + + INIT_LLIST_HEAD(&state->rxqueue); + INIT_LLIST_HEAD(&state->txqueue); + state->conn_bfd.fd = -1; + + bfd = &state->listen_bfd; + + rc = osmo_sock_unix_init_ofd(bfd, SOCK_SEQPACKET, 0, sock_path, OSMO_SOCK_F_BIND); + if (rc < 0) { + LOGP(DMOB, LOGL_ERROR, "Could not create unix socket: %s\n", strerror(errno)); + talloc_free(state); + return NULL; + } + + bfd->cb = &tch_csd_sock_accept; + bfd->data = state; + + return state; +} + +void tch_csd_sock_exit(struct tch_csd_sock_state *state) +{ + if (state->conn_bfd.fd > -1) + tch_csd_sock_close(state); + osmo_fd_unregister(&state->listen_bfd); + close(state->listen_bfd.fd); + talloc_free(state); +} + +int tch_csd_sock_recv(struct tch_csd_sock_state *state, struct msgb *msg) +{ + unsigned int n_bytes = 0; + + while (msgb_tailroom(msg) > 0) { + struct msgb *rmsg = msgb_dequeue(&state->rxqueue); + if (rmsg == NULL) + break; + size_t len = OSMO_MIN(msgb_tailroom(msg), msgb_length(rmsg)); + memcpy(msgb_put(msg, len), msgb_data(rmsg), len); + msgb_pull(rmsg, len); + if (msgb_length(rmsg) > 0) + llist_add(&rmsg->list, &state->rxqueue); + else + msgb_free(rmsg); + n_bytes += len; + } + + return n_bytes; +} + +int tch_csd_sock_send(struct tch_csd_sock_state *state, struct msgb *msg) +{ + msgb_enqueue(&state->txqueue, msg); + osmo_fd_write_enable(&state->conn_bfd); + return 0; +} -- To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/35583?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Change-Id: Id054af7b3d9d0a41715f7981deb420f6e09bf30c Gerrit-Change-Number: 35583 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[L] Change in osmocom-bb[master]: [WIP] mobile: integrate V.110 TA & soft-UART from libosmocore
by fixeria 15 Jan '24

15 Jan '24
fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmocom-bb/+/35582?usp=email ) Change subject: [WIP] mobile: integrate V.110 TA & soft-UART from libosmocore ...................................................................... [WIP] mobile: integrate V.110 TA & soft-UART from libosmocore Change-Id: I7ac9c0e5010730fa4d8bc7a7a3c7ff85e11731c0 Depends: libosmocore.git I5716bd6fd0201ee7a7a29e72f775972cd374082f Related: OS#4396 --- M src/host/layer23/configure.ac M src/host/layer23/include/osmocom/bb/mobile/tch.h M src/host/layer23/src/mobile/Makefile.am M src/host/layer23/src/mobile/tch.c A src/host/layer23/src/mobile/tch_data.c 5 files changed, 375 insertions(+), 11 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/82/35582/1 diff --git a/src/host/layer23/configure.ac b/src/host/layer23/configure.ac index b4eb860..7fb8bf1 100644 --- a/src/host/layer23/configure.ac +++ b/src/host/layer23/configure.ac @@ -45,6 +45,7 @@ PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 1.5.0) PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty >= 0.10.0) PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm) +PKG_CHECK_MODULES(LIBOSMOISDN, libosmoisdn) PKG_CHECK_MODULES(LIBOSMOCODEC, libosmocodec) PKG_CHECK_MODULES(LIBOSMOGPRSRLCMAC, libosmo-gprs-rlcmac) PKG_CHECK_MODULES(LIBOSMOGPRSLLC, libosmo-gprs-llc) diff --git a/src/host/layer23/include/osmocom/bb/mobile/tch.h b/src/host/layer23/include/osmocom/bb/mobile/tch.h index d2cb4bc..a31655a 100644 --- a/src/host/layer23/include/osmocom/bb/mobile/tch.h +++ b/src/host/layer23/include/osmocom/bb/mobile/tch.h @@ -13,6 +13,8 @@ } voice; struct tch_data_state { enum tch_data_io_handler handler; + struct osmo_v110_ta *v110_ta; + struct osmo_soft_uart *suart; } data; }; }; diff --git a/src/host/layer23/src/mobile/Makefile.am b/src/host/layer23/src/mobile/Makefile.am index 0639916..b4e45e2 100644 --- a/src/host/layer23/src/mobile/Makefile.am +++ b/src/host/layer23/src/mobile/Makefile.am @@ -8,6 +8,7 @@ $(LIBOSMOCORE_CFLAGS) \ $(LIBOSMOVTY_CFLAGS) \ $(LIBOSMOGSM_CFLAGS) \ + $(LIBOSMOISDN_CFLAGS) \ $(LIBOSMOGPRSRLCMAC_CFLAGS) \ $(LIBOSMOGPRSLLC_CFLAGS) \ $(LIBOSMOGPRSSNDCP_CFLAGS) \ @@ -31,6 +32,7 @@ mncc_sock.c \ primitives.c \ tch.c \ + tch_data.c \ tch_voice.c \ transaction.c \ vty_interface.c \ @@ -45,6 +47,7 @@ $(LIBOSMOCORE_LIBS) \ $(LIBOSMOVTY_LIBS) \ $(LIBOSMOGSM_LIBS) \ + $(LIBOSMOISDN_LIBS) \ $(LIBOSMOGPRSRLCMAC_LIBS) \ $(LIBOSMOGPRSLLC_LIBS) \ $(LIBOSMOGPRSSNDCP_LIBS) \ diff --git a/src/host/layer23/src/mobile/tch.c b/src/host/layer23/src/mobile/tch.c index e5599dd..fa457ac 100644 --- a/src/host/layer23/src/mobile/tch.c +++ b/src/host/layer23/src/mobile/tch.c @@ -37,9 +37,14 @@ int tch_voice_state_init(struct gsm_trans *trans, struct tch_voice_state *state); +int tch_data_state_init(struct gsm_trans *trans, + struct tch_data_state *state); + void tch_voice_state_free(struct tch_voice_state *state); +void tch_data_state_free(struct tch_data_state *state); int tch_voice_recv(struct osmocom_ms *ms, struct msgb *msg); +int tch_data_recv(struct osmocom_ms *ms, struct msgb *msg); int tch_voice_serve_ms(struct osmocom_ms *ms); /* Receive a Downlink traffic (voice/data) frame from the lower layers */ @@ -54,10 +59,8 @@ if (state->voice_or_data) return tch_voice_recv(ms, msg); - else /* TODO: tch_recv_data() */ - msgb_free(msg); - - return 0; + else + return tch_data_recv(ms, msg); } /* Send an Uplink voice frame to the lower layers */ @@ -139,14 +142,11 @@ case GSM48_CMODE_DATA_12k0: case GSM48_CMODE_DATA_6k0: case GSM48_CMODE_DATA_3k6: -#if 0 state->voice_or_data = false; state->data.handler = ms->settings.tch_data.io_handler; - /* TODO: tch_data_state_init() */ if (tch_data_state_init(trans, &state->data) != 0) goto exit_free; break; -#endif case GSM48_CMODE_SIGN: default: LOGP(DL1C, LOGL_ERROR, "Unhandled channel mode %s\n", @@ -168,10 +168,8 @@ return; if (state->voice_or_data) tch_voice_state_free(&state->voice); -#if 0 - else /* TODO: tch_state_free_data() */ - tch_state_free_data(&state->data); -#endif + else + tch_data_state_free(&state->data); talloc_free(state); ms->tch_state = NULL; diff --git a/src/host/layer23/src/mobile/tch_data.c b/src/host/layer23/src/mobile/tch_data.c new file mode 100644 index 0000000..082c397 --- /dev/null +++ b/src/host/layer23/src/mobile/tch_data.c @@ -0,0 +1,349 @@ +/* + * (C) 2023 by sysmocom - s.f.m.c. GmbH <info(a)sysmocom.de> + * Author: Vadim Yanitskiy <vyanitskiy(a)sysmocom.de> + * + * All Rights Reserved + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include <stdint.h> +#include <string.h> +#include <errno.h> + +#include <osmocom/core/msgb.h> +#include <osmocom/core/soft_uart.h> + +#include <osmocom/gsm/protocol/gsm_08_58.h> +#include <osmocom/gsm/gsm44021.h> + +#include <osmocom/isdn/v110.h> +#include <osmocom/isdn/v110_ta.h> + +#include <osmocom/bb/common/logging.h> +#include <osmocom/bb/common/osmocom_data.h> +#include <osmocom/bb/common/ms.h> +#include <osmocom/bb/mobile/mncc.h> +#include <osmocom/bb/mobile/transaction.h> +#include <osmocom/bb/mobile/tch.h> + +struct csd_v110_frame_desc { + uint16_t num_blocks; + uint16_t num_bits; +}; + +struct csd_v110_lchan_desc { + struct csd_v110_frame_desc fr; + struct csd_v110_frame_desc hr; +}; + +/* key is enum gsm48_chan_mode, so assuming a value in range 0..255 */ +const struct csd_v110_lchan_desc csd_v110_lchan_desc[256] = { +#if 0 + [GSM48_CMODE_DATA_14k5] = { + /* TCH/F14.4: 290 bits every 20 ms (14.5 kbit/s) */ + .fr = { .num_blocks = 1, .num_bits = 290 }, + }, +#endif + [GSM48_CMODE_DATA_12k0] = { + /* TCH/F9.6: 4 * 60 bits every 20 ms (12.0 kbit/s) */ + .fr = { .num_blocks = 4, .num_bits = 60 }, + }, + [GSM48_CMODE_DATA_6k0] = { + /* TCH/F4.8: 2 * 60 bits every 20 ms (6.0 kbit/s) */ + .fr = { .num_blocks = 2, .num_bits = 60 }, + /* TCH/H4.8: 4 * 60 bits every 40 ms (6.0 kbit/s) */ + .hr = { .num_blocks = 4, .num_bits = 60 }, + }, + [GSM48_CMODE_DATA_3k6] = { + /* TCH/F2.4: 2 * 36 bits every 20 ms (3.6 kbit/s) */ + .fr = { .num_blocks = 2, .num_bits = 36 }, + /* TCH/H2.4: 4 * 36 bits every 40 ms (3.6 kbit/s) */ + .hr = { .num_blocks = 4, .num_bits = 36 }, + }, +}; + +static void tch_soft_uart_rx_cb(void *priv, struct msgb *msg, unsigned int flags) +{ + LOGP(DL1C, LOGL_FATAL, "%s(): [flags=0x%08x] %s\n", + __func__, flags, msgb_hexdump(msg)); + msgb_free(msg); +} + +static void tch_soft_uart_tx_cb(void *priv, struct msgb *msg) +{ + const char *data = "TEST\r\n"; + size_t n_bytes; + + n_bytes = OSMO_MIN(msg->data_len, strlen(data)); + if (n_bytes > 0) + memcpy(msgb_put(msg, n_bytes), (void *)data, n_bytes); +} + +struct osmo_soft_uart *tch_soft_uart_alloc(struct osmocom_ms *ms) +{ + struct osmo_soft_uart *suart; + + /* FIXME: take the exact config from BCap */ + const struct osmo_soft_uart_cfg cfg = { + .num_data_bits = 8, + .num_stop_bits = 1, + .parity_mode = OSMO_SUART_PARITY_NONE, + .rx_buf_size = 1024, /* TODO: align with the current TCH mode */ + .rx_timeout_ms = 100, /* TODO: align with TCH framing interval */ + .priv = &ms->tch_state->data, + .rx_cb = &tch_soft_uart_rx_cb, + .tx_cb = &tch_soft_uart_tx_cb, + }; + + suart = osmo_soft_uart_alloc(ms, "csd_soft_uart", &cfg); + if (suart == NULL) + return NULL; + + osmo_soft_uart_set_rx(suart, true); + osmo_soft_uart_set_tx(suart, true); + + return suart; +} + +/*************************************************************************************/ + +static void tch_v110_ta_rx_cb(void *priv, const ubit_t *buf, size_t buf_size) +{ + struct tch_data_state *state = (struct tch_data_state *)priv; + + /* XXX: we're assuming async call here */ + osmo_soft_uart_rx_ubits(state->suart, buf, buf_size); +} + +static void tch_v110_ta_tx_cb(void *priv, ubit_t *buf, size_t buf_size) +{ + struct tch_data_state *state = (struct tch_data_state *)priv; + + /* XXX: we're assuming async call here */ + osmo_soft_uart_tx_ubits(state->suart, buf, buf_size); +} + +static void tch_v110_ta_status_update_cb(void *priv, unsigned int status) +{ + LOGP(DL1C, LOGL_DEBUG, "%s(): [status=0x%08x]\n", __func__, status); + /* TODO: update status lines of the soft-UART */ +} + +struct osmo_v110_ta *tch_v110_ta_alloc(struct osmocom_ms *ms, + enum osmo_v100_sync_ra1_rate rate) +{ + const struct osmo_v110_ta_cfg cfg = { + .rate = rate, + .priv = &ms->tch_state->data, + .rx_cb = &tch_v110_ta_rx_cb, + .tx_cb = &tch_v110_ta_tx_cb, + .status_update_cb = &tch_v110_ta_status_update_cb, + }; + + return osmo_v110_ta_alloc(ms, "csd_v110_ta", &cfg); +} + +/*************************************************************************************/ + +static void swap_words(uint8_t *data, size_t data_len) +{ + /* swap bytes in words */ + while (data_len >= 2) { + uint8_t tmp = data[0]; + data[0] = data[1]; + data[1] = tmp; + data_len -= 2; + data += 2; + } +} + +int tch_csd_rx_from_l1(struct osmocom_ms *ms, struct msgb *msg) +{ + struct tch_data_state *state = &ms->tch_state->data; + const struct gsm48_rr_cd *cd = &ms->rrlayer.cd_now; + const struct csd_v110_frame_desc *desc; + ubit_t data[4 * 60]; + + if (msgb_l3len(msg) < 30) + return -EINVAL; + + if ((cd->chan_nr & RSL_CHAN_NR_MASK) == RSL_CHAN_Bm_ACCHs) + desc = &csd_v110_lchan_desc[cd->mode].fr; + else /* RSL_CHAN_Lm_ACCHs */ + desc = &csd_v110_lchan_desc[cd->mode].hr; + if (OSMO_UNLIKELY(desc->num_blocks == 0)) + return -ENOTSUP; + + switch (ms->settings.tch_data.io_format) { + case TCH_DATA_IOF_OSMO: + break; + case TCH_DATA_IOF_TI: + /* the layer1 firmware emits frames with swapped words (LE ordering) */ + swap_words(msgb_l3(msg), msgb_l3len(msg)); + break; + } + + /* unpack packed bits (MSB goes first) */ + osmo_pbit2ubit_ext(data, 0, msgb_l3(msg), 0, sizeof(data), 1); + + for (unsigned int i = 0; i < desc->num_blocks; i++) { + struct osmo_v110_decoded_frame df; + + if (desc->num_bits == 60) + osmo_csd_12k_6k_decode_frame(&df, &data[i * 60], 60); + else /* desc->num_bits == 36 */ + osmo_csd_3k6_decode_frame(&df, &data[i * 36], 36); + + /* FIXME: properly set E1/E2/E3 depending on data rate */ + df.e_bits[0] = 0; + df.e_bits[1] = 1; + df.e_bits[2] = 1; + + osmo_v110_ta_frame_in(state->v110_ta, &df); + } + + return 0; +} + +int tch_csd_tx_to_l1(struct osmocom_ms *ms) +{ + struct tch_data_state *state = &ms->tch_state->data; + const struct gsm48_rr_cd *cd = &ms->rrlayer.cd_now; + const struct csd_v110_frame_desc *desc; + ubit_t data[60 * 4]; + struct msgb *nmsg; + + if ((cd->chan_nr & RSL_CHAN_NR_MASK) == RSL_CHAN_Bm_ACCHs) + desc = &csd_v110_lchan_desc[cd->mode].fr; + else /* RSL_CHAN_Lm_ACCHs */ + desc = &csd_v110_lchan_desc[cd->mode].hr; + if (OSMO_UNLIKELY(desc->num_blocks == 0)) + return -ENOTSUP; + + for (unsigned int i = 0; i < desc->num_blocks; i++) { + struct osmo_v110_decoded_frame df; + + if (osmo_v110_ta_frame_out(state->v110_ta, &df) != 0) + memset(&df, 0x01, sizeof(df)); + + /* set E7 to binary 0 in every 4-th frame + * (as per 3GPP TS 44.021, subclause 10.2.1) + * FIXME: properly handle desc->num_blocks == 2 */ + df.e_bits[6] = (i > 0); + + if (desc->num_bits == 60) + osmo_csd_12k_6k_encode_frame(&data[i * 60], 60, &df); + else /* desc->num_bits == 36 */ + osmo_csd_3k6_encode_frame(&data[i * 36], 36, &df); + } + + nmsg = msgb_alloc_headroom(33 + 64, 64, __func__); + OSMO_ASSERT(nmsg != NULL); + + nmsg->l2h = msgb_put(nmsg, 33); /* XXX: proper size */ + + /* pack unpacked bits (MSB goes first) */ + osmo_ubit2pbit_ext(msgb_l2(nmsg), 0, &data[0], 0, sizeof(data), 1); + + switch (ms->settings.tch_data.io_format) { + case TCH_DATA_IOF_OSMO: + break; + case TCH_DATA_IOF_TI: + /* the layer1 firmware expects frames with swapped words (LE ordering) */ + swap_words(msgb_l2(nmsg), msgb_l2len(nmsg)); + break; + } + + return gsm48_rr_tx_traffic(ms, nmsg); +} + +/* TODO: set/unset OSMO_V110_TA_C_108 */ +/* TODO: call osmo_v110_ta_sync_ind() */ + +/*************************************************************************************/ + +int tch_data_recv(struct osmocom_ms *ms, struct msgb *msg) +{ + struct tch_data_state *state = &ms->tch_state->data; + + switch (state->handler) { + case TCH_DATA_IOH_LOOPBACK: + /* Remove the DL info header */ + msgb_pull_to_l2(msg); + /* Send data frame back */ + return tch_send_msg(ms, msg); + case TCH_DATA_IOH_UNIX_SOCK: + tch_csd_rx_from_l1(ms, msg); + tch_csd_tx_to_l1(ms); + msgb_free(msg); + break; + case TCH_DATA_IOH_NONE: + /* Drop voice frame */ + msgb_free(msg); + } + + return 0; +} + +int tch_data_state_init(struct gsm_trans *trans, + struct tch_data_state *state) +{ + struct osmocom_ms *ms = trans->ms; + + switch (state->handler) { + case TCH_DATA_IOH_UNIX_SOCK: + /* TODO: open listening socket */ + break; + case TCH_DATA_IOH_LOOPBACK: + case TCH_DATA_IOH_NONE: + /* we don't need V.110 TA / soft-UART */ + return 0; + default: + break; + } + +#if 1 + state->suart = tch_soft_uart_alloc(ms); + if (state->suart == NULL) + goto exit_free; +#endif + + state->v110_ta = tch_v110_ta_alloc(ms, OSMO_V110_SYNC_RA1_9600); /* XXX */ + if (state->v110_ta == NULL) + goto exit_free; + + return 0; + +exit_free: + if (state->suart != NULL) + osmo_soft_uart_free(state->suart); + if (state->v110_ta != NULL) + osmo_v110_ta_free(state->v110_ta); + return -1; +} + +void tch_data_state_free(struct tch_data_state *state) +{ + if (state->suart != NULL) + osmo_soft_uart_free(state->suart); + if (state->v110_ta != NULL) + osmo_v110_ta_free(state->v110_ta); + + switch (state->handler) { + case TCH_DATA_IOH_UNIX_SOCK: + /* TODO: close listening socket */ + break; + default: + break; + } +} -- To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/35582?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Change-Id: I7ac9c0e5010730fa4d8bc7a7a3c7ff85e11731c0 Gerrit-Change-Number: 35582 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[M] Change in osmocom-bb[master]: [WIP] mobile: check Bearer Capability
by fixeria 15 Jan '24

15 Jan '24
fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmocom-bb/+/35584?usp=email ) Change subject: [WIP] mobile: check Bearer Capability ...................................................................... [WIP] mobile: check Bearer Capability Change-Id: I6ddbe49f453134d08578e35a015f2fd605705987 --- M src/host/layer23/src/mobile/tch_data.c 1 file changed, 54 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/84/35584/1 diff --git a/src/host/layer23/src/mobile/tch_data.c b/src/host/layer23/src/mobile/tch_data.c index 21ed1c2..995e491 100644 --- a/src/host/layer23/src/mobile/tch_data.c +++ b/src/host/layer23/src/mobile/tch_data.c @@ -305,11 +305,56 @@ return 0; } +static int tch_data_check_bcap(const struct gsm_mncc_bearer_cap *bcap) +{ + if (bcap == NULL) { + LOGP(DL1C, LOGL_ERROR, + "%s(): CC transaction without BCap\n", + __func__); + return -ENODEV; + } + + if (bcap->mode != GSM48_BCAP_TMOD_CIRCUIT) { + LOGP(DMNCC, LOGL_ERROR, + "%s(): Transfer mode 0x%02x is not supported\n", + __func__, bcap->mode); + return -ENOTSUP; + } + if (bcap->coding != GSM48_BCAP_CODING_GSM_STD) { + LOGP(DMNCC, LOGL_ERROR, + "%s(): Coding standard 0x%02x is not supported\n", + __func__, bcap->coding); + return -ENOTSUP; + } + + switch (bcap->transfer) { + case GSM48_BCAP_ITCAP_UNR_DIG_INF: + case GSM48_BCAP_ITCAP_3k1_AUDIO: + /* XXX: sync/async: bcap->data.async */ + break; + case GSM48_BCAP_ITCAP_FAX_G3: + /* XXX: sync, transparent */ + break; + default: + LOGP(DMNCC, LOGL_ERROR, + "%s(): Information transfer capability 0x%02x is not supported\n", + __func__, bcap->transfer); + return -ENOTSUP; + } + + return 0; +} + int tch_data_state_init(struct gsm_trans *trans, struct tch_data_state *state) { struct osmocom_ms *ms = trans->ms; const struct gsm_settings *set = &ms->settings; + const struct gsm_mncc_bearer_cap *bcap = trans->cc.bcap; + int rc; + + if ((rc = tch_data_check_bcap(bcap)) != 0) + return rc; switch (state->handler) { case TCH_DATA_IOH_UNIX_SOCK: -- To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/35584?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Change-Id: I6ddbe49f453134d08578e35a015f2fd605705987 Gerrit-Change-Number: 35584 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[S] Change in osmocom-bb[master]: layer23: drop unneeded forward declaration
by fixeria 15 Jan '24

15 Jan '24
fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmocom-bb/+/35575?usp=email ) Change subject: layer23: drop unneeded forward declaration ...................................................................... layer23: drop unneeded forward declaration Change-Id: I75bd08c1a88ad75d93a519422dfb7922c37a27a3 --- M src/host/layer23/include/osmocom/bb/common/osmocom_data.h 1 file changed, 9 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/75/35575/1 diff --git a/src/host/layer23/include/osmocom/bb/common/osmocom_data.h b/src/host/layer23/include/osmocom/bb/common/osmocom_data.h index 60e12df..3a8cd2a 100644 --- a/src/host/layer23/include/osmocom/bb/common/osmocom_data.h +++ b/src/host/layer23/include/osmocom/bb/common/osmocom_data.h @@ -4,7 +4,6 @@ #include <stdbool.h> struct osmocom_ms; -struct gapk_io_state; struct vty; enum osmobb_sig_subsys { -- To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/35575?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Change-Id: I75bd08c1a88ad75d93a519422dfb7922c37a27a3 Gerrit-Change-Number: 35575 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[M] Change in osmocom-bb[master]: mobile: add generic signals for CC/SS/SM transactions
by fixeria 15 Jan '24

15 Jan '24
fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmocom-bb/+/35577?usp=email ) Change subject: mobile: add generic signals for CC/SS/SM transactions ...................................................................... mobile: add generic signals for CC/SS/SM transactions This allows driving logic in other modules based on transaction related events, such as allocation, deallocation, or a state change. These new signals will be used in the upcoming CSD implementation. Change-Id: Idae5da24cb517878a26cc14b2ba6976e60f0b31b Related: OS#4396 --- M src/host/layer23/include/osmocom/bb/common/osmocom_data.h M src/host/layer23/src/mobile/gsm480_ss.c M src/host/layer23/src/mobile/gsm48_cc.c M src/host/layer23/src/mobile/transaction.c 4 files changed, 46 insertions(+), 10 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/77/35577/1 diff --git a/src/host/layer23/include/osmocom/bb/common/osmocom_data.h b/src/host/layer23/include/osmocom/bb/common/osmocom_data.h index 3a8cd2a..935c02b 100644 --- a/src/host/layer23/include/osmocom/bb/common/osmocom_data.h +++ b/src/host/layer23/include/osmocom/bb/common/osmocom_data.h @@ -11,6 +11,7 @@ SS_GLOBAL, SS_L23_VTY, SS_L23_SUBSCR, + SS_L23_TRANS, }; enum osmobb_l1ctl_sig { @@ -40,6 +41,12 @@ S_L23_SUBSCR_SIM_AUTH_RESP, }; +enum osmobb_l23_trans_sig { + S_L23_CC_TRANS_ALLOC, /* new transaction has been allocated */ + S_L23_CC_TRANS_FREE, /* transaction is about to be free()d */ + S_L23_CC_TRANS_STATE_CHG, /* transaction state has been changed */ +}; + struct osmobb_l23_vty_sig_data { struct vty *vty; union { diff --git a/src/host/layer23/src/mobile/gsm480_ss.c b/src/host/layer23/src/mobile/gsm480_ss.c index fe601bc..0acd18d 100644 --- a/src/host/layer23/src/mobile/gsm480_ss.c +++ b/src/host/layer23/src/mobile/gsm480_ss.c @@ -22,6 +22,12 @@ #include <stdlib.h> #include <osmocom/core/msgb.h> +#include <osmocom/core/signal.h> +#include <osmocom/core/talloc.h> + +#include <osmocom/gsm/protocol/gsm_04_80.h> +#include <osmocom/gsm/gsm48.h> + #include <osmocom/bb/common/logging.h> #include <osmocom/bb/common/osmocom_data.h> #include <osmocom/bb/common/ms.h> @@ -29,10 +35,7 @@ #include <osmocom/bb/mobile/transaction.h> #include <osmocom/bb/mobile/gsm480_ss.h> #include <osmocom/bb/mobile/gsm44068_gcc_bcc.h> -#include <osmocom/core/talloc.h> #include <osmocom/bb/mobile/vty.h> -#include <osmocom/gsm/protocol/gsm_04_80.h> -#include <osmocom/gsm/gsm48.h> static uint32_t new_callref = 0x80000001; @@ -213,7 +216,7 @@ return 0; } -enum { +enum gsm480_ss_state { GSM480_SS_ST_IDLE = 0, GSM480_SS_ST_REGISTER, GSM480_SS_ST_ACTIVE, @@ -284,6 +287,13 @@ return 0; } +static void gsm480_trans_state_chg(struct gsm_trans *trans, + enum gsm480_ss_state state) +{ + trans->ss.state = state; + osmo_signal_dispatch(SS_L23_TRANS, S_L23_CC_TRANS_STATE_CHG, trans); +} + /* * encoding */ @@ -624,8 +634,7 @@ return -ENOMEM; } - /* go register sent state */ - trans->ss.state = GSM480_SS_ST_REGISTER; + gsm480_trans_state_chg(trans, GSM480_SS_ST_REGISTER); /* FIXME: generate invoke ID */ trans->ss.invoke_id = 5; @@ -1107,8 +1116,7 @@ return -EINVAL; } - /* go register state */ - trans->ss.state = GSM480_SS_ST_ACTIVE; + gsm480_trans_state_chg(trans, GSM480_SS_ST_ACTIVE); if (TLVP_PRESENT(&tp, GSM48_IE_FACILITY)) { rc = gsm480_rx_fac_ie(trans, TLVP_VAL(&tp, GSM48_IE_FACILITY), @@ -1143,8 +1151,7 @@ return -EINVAL; } - /* go register state */ - trans->ss.state = GSM480_SS_ST_ACTIVE; + gsm480_trans_state_chg(trans, GSM480_SS_ST_ACTIVE); if (TLVP_PRESENT(&tp, GSM48_IE_FACILITY)) { rc = gsm480_rx_fac_ie(trans, TLVP_VAL(&tp, GSM48_IE_FACILITY), diff --git a/src/host/layer23/src/mobile/gsm48_cc.c b/src/host/layer23/src/mobile/gsm48_cc.c index c3ec94b..523ae99 100644 --- a/src/host/layer23/src/mobile/gsm48_cc.c +++ b/src/host/layer23/src/mobile/gsm48_cc.c @@ -25,6 +25,7 @@ #include <osmocom/core/utils.h> #include <osmocom/gsm/gsm48.h> #include <osmocom/core/talloc.h> +#include <osmocom/core/signal.h> #include <osmocom/bb/common/logging.h> #include <osmocom/bb/common/osmocom_data.h> @@ -239,6 +240,8 @@ gsm48_cc_state_name(state)); trans->cc.state = state; + + osmo_signal_dispatch(SS_L23_TRANS, S_L23_CC_TRANS_STATE_CHG, trans); } /* diff --git a/src/host/layer23/src/mobile/transaction.c b/src/host/layer23/src/mobile/transaction.c index 3cc25fd..570545b 100644 --- a/src/host/layer23/src/mobile/transaction.c +++ b/src/host/layer23/src/mobile/transaction.c @@ -17,6 +17,7 @@ #include <stdint.h> +#include <osmocom/core/signal.h> #include <osmocom/core/talloc.h> #include <osmocom/core/timer.h> #include <osmocom/core/msgb.h> @@ -79,11 +80,15 @@ llist_add_tail(&trans->entry, &ms->trans_list); + osmo_signal_dispatch(SS_L23_TRANS, S_L23_CC_TRANS_ALLOC, trans); + return trans; } void trans_free(struct gsm_trans *trans) { + osmo_signal_dispatch(SS_L23_TRANS, S_L23_CC_TRANS_FREE, trans); + switch (trans->protocol) { case GSM48_PDISC_CC: _gsm48_cc_trans_free(trans); -- To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/35577?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Change-Id: Idae5da24cb517878a26cc14b2ba6976e60f0b31b Gerrit-Change-Number: 35577 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[M] Change in osmocom-bb[master]: mobile: always check return value of tlv_parse()
by fixeria 15 Jan '24

15 Jan '24
fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmocom-bb/+/35576?usp=email ) Change subject: mobile: always check return value of tlv_parse() ...................................................................... mobile: always check return value of tlv_parse() Change-Id: Id02fc0b1af6da939cb72f327c7d2ddca484ca063 --- M src/host/layer23/src/mobile/gsm480_ss.c M src/host/layer23/src/mobile/gsm48_cc.c M src/host/layer23/src/mobile/gsm48_mm.c M src/host/layer23/src/mobile/gsm48_rr.c 4 files changed, 143 insertions(+), 64 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/76/35576/1 diff --git a/src/host/layer23/src/mobile/gsm480_ss.c b/src/host/layer23/src/mobile/gsm480_ss.c index 4ed8354..fe601bc 100644 --- a/src/host/layer23/src/mobile/gsm480_ss.c +++ b/src/host/layer23/src/mobile/gsm480_ss.c @@ -1062,7 +1062,12 @@ struct tlv_parsed tp; int rc = 0; - tlv_parse(&tp, &gsm48_att_tlvdef, gh->data, payload_len, 0, 0); + if (tlv_parse(&tp, &gsm48_att_tlvdef, gh->data, payload_len, 0, 0) < 0) { + LOGP(DSS, LOGL_ERROR, "%s(): tlv_parse() failed\n", __func__); + gsm480_trans_free(trans); + return -EINVAL; + } + if (TLVP_PRESENT(&tp, GSM48_IE_FACILITY)) { rc = gsm480_rx_fac_ie(trans, TLVP_VAL(&tp, GSM48_IE_FACILITY), *(TLVP_VAL(&tp, GSM48_IE_FACILITY)-1)); @@ -1095,11 +1100,16 @@ struct tlv_parsed tp; int rc = 0; + if (tlv_parse(&tp, &gsm48_att_tlvdef, gh->data, payload_len, + GSM48_IE_FACILITY, 0) < 0) { + LOGP(DSS, LOGL_ERROR, "%s(): tlv_parse() failed\n", __func__); + /* XXX: indicate an error somehow */ + return -EINVAL; + } + /* go register state */ trans->ss.state = GSM480_SS_ST_ACTIVE; - tlv_parse(&tp, &gsm48_att_tlvdef, gh->data, payload_len, - GSM48_IE_FACILITY, 0); if (TLVP_PRESENT(&tp, GSM48_IE_FACILITY)) { rc = gsm480_rx_fac_ie(trans, TLVP_VAL(&tp, GSM48_IE_FACILITY), *(TLVP_VAL(&tp, GSM48_IE_FACILITY)-1)); @@ -1127,10 +1137,15 @@ struct tlv_parsed tp; int rc = 0; + if (tlv_parse(&tp, &gsm48_att_tlvdef, gh->data, payload_len, 0, 0) < 0) { + LOGP(DSS, LOGL_ERROR, "%s(): tlv_parse() failed\n", __func__); + /* XXX: indicate an error somehow */ + return -EINVAL; + } + /* go register state */ trans->ss.state = GSM480_SS_ST_ACTIVE; - tlv_parse(&tp, &gsm48_att_tlvdef, gh->data, payload_len, 0, 0); if (TLVP_PRESENT(&tp, GSM48_IE_FACILITY)) { rc = gsm480_rx_fac_ie(trans, TLVP_VAL(&tp, GSM48_IE_FACILITY), *(TLVP_VAL(&tp, GSM48_IE_FACILITY)-1)); diff --git a/src/host/layer23/src/mobile/gsm48_cc.c b/src/host/layer23/src/mobile/gsm48_cc.c index 4e26713..c3ec94b 100644 --- a/src/host/layer23/src/mobile/gsm48_cc.c +++ b/src/host/layer23/src/mobile/gsm48_cc.c @@ -623,10 +623,14 @@ LOGP(DCC, LOGL_INFO, "received PROGRESS\n"); + if (tlv_parse(&tp, &gsm48_att_tlvdef, gh->data, payload_len, + GSM48_IE_PROGR_IND, 0) < 0) { + LOGP(DCC, LOGL_ERROR, "%s(): tlv_parse() failed\n", __func__); + return -EINVAL; + } + memset(&progress, 0, sizeof(struct gsm_mncc)); progress.callref = trans->callref; - tlv_parse(&tp, &gsm48_att_tlvdef, gh->data, payload_len, - GSM48_IE_PROGR_IND, 0); /* progress */ if (TLVP_PRESENT(&tp, GSM48_IE_PROGR_IND)) { progress.fields |= MNCC_F_PROGRESS; @@ -654,13 +658,17 @@ struct tlv_parsed tp; struct gsm_mncc call_proc; - LOGP(DCC, LOGL_INFO, "sending CALL PROCEEDING\n"); + LOGP(DCC, LOGL_INFO, "received CALL PROCEEDING\n"); + + if (tlv_parse(&tp, &gsm48_att_tlvdef, gh->data, payload_len, 0, 0) < 0) { + LOGP(DCC, LOGL_ERROR, "%s(): tlv_parse() failed\n", __func__); + return -EINVAL; + } gsm48_stop_cc_timer(trans); memset(&call_proc, 0, sizeof(struct gsm_mncc)); call_proc.callref = trans->callref; - tlv_parse(&tp, &gsm48_att_tlvdef, gh->data, payload_len, 0, 0); #if 0 /* repeat */ if (TLVP_PRESENT(&tp, GSM48_IE_REPEAT_CIR)) @@ -712,12 +720,16 @@ LOGP(DCC, LOGL_INFO, "received ALERTING\n"); + if (tlv_parse(&tp, &gsm48_att_tlvdef, gh->data, payload_len, 0, 0) < 0) { + LOGP(DCC, LOGL_ERROR, "%s(): tlv_parse() failed\n", __func__); + return -EINVAL; + } + gsm48_stop_cc_timer(trans); /* no T301 in MS call control */ memset(&alerting, 0, sizeof(struct gsm_mncc)); alerting.callref = trans->callref; - tlv_parse(&tp, &gsm48_att_tlvdef, gh->data, payload_len, 0, 0); /* facility */ if (TLVP_PRESENT(&tp, GSM48_IE_FACILITY)) { alerting.fields |= MNCC_F_FACILITY; @@ -753,11 +765,15 @@ LOGP(DCC, LOGL_INFO, "received CONNECT\n"); + if (tlv_parse(&tp, &gsm48_att_tlvdef, gh->data, payload_len, 0, 0) < 0) { + LOGP(DCC, LOGL_ERROR, "%s(): tlv_parse() failed\n", __func__); + return -EINVAL; + } + gsm48_stop_cc_timer(trans); memset(&connect, 0, sizeof(struct gsm_mncc)); connect.callref = trans->callref; - tlv_parse(&tp, &gsm48_att_tlvdef, gh->data, payload_len, 0, 0); /* facility */ if (TLVP_PRESENT(&tp, GSM48_IE_FACILITY)) { connect.fields |= MNCC_F_FACILITY; @@ -823,10 +839,13 @@ LOGP(DCC, LOGL_INFO, "received SETUP\n"); + if (tlv_parse(&tp, &gsm48_att_tlvdef, gh->data, payload_len, 0, 0) < 0) { + LOGP(DCC, LOGL_ERROR, "%s(): tlv_parse() failed\n", __func__); + return -EINVAL; + } + memset(&setup, 0, sizeof(struct gsm_mncc)); setup.callref = trans->callref; - tlv_parse(&tp, &gsm48_att_tlvdef, gh->data, payload_len, 0, 0); - /* bearer capability */ if (TLVP_PRESENT(&tp, GSM48_IE_BEARER_CAP)) { setup.fields |= MNCC_F_BEARER_CAP; @@ -1076,9 +1095,13 @@ LOGP(DCC, LOGL_INFO, "received START DTMF ACKNOWLEDGE\n"); + if (tlv_parse(&tp, &gsm48_att_tlvdef, gh->data, payload_len, 0, 0) < 0) { + LOGP(DCC, LOGL_ERROR, "%s(): tlv_parse() failed\n", __func__); + return -EINVAL; + } + memset(&dtmf, 0, sizeof(struct gsm_mncc)); dtmf.callref = trans->callref; - tlv_parse(&tp, &gsm48_att_tlvdef, gh->data, payload_len, 0, 0); /* keypad facility */ if (TLVP_PRESENT(&tp, GSM48_IE_KPD_FACILITY)) { dtmf.fields |= MNCC_F_KEYPAD; @@ -1139,9 +1162,13 @@ LOGP(DCC, LOGL_INFO, "received STOP DTMF ACKNOWLEDGE\n"); + if (tlv_parse(&tp, &gsm48_att_tlvdef, gh->data, payload_len, 0, 0) < 0) { + LOGP(DCC, LOGL_ERROR, "%s(): tlv_parse() failed\n", __func__); + return -EINVAL; + } + memset(&dtmf, 0, sizeof(struct gsm_mncc)); dtmf.callref = trans->callref; - tlv_parse(&tp, &gsm48_att_tlvdef, gh->data, payload_len, 0, 0); return mncc_recvmsg(trans->ms, trans, MNCC_STOP_DTMF_RSP, &dtmf); } @@ -1335,15 +1362,18 @@ LOGP(DCC, LOGL_INFO, "received USERINFO\n"); - memset(&user, 0, sizeof(struct gsm_mncc)); - user.callref = trans->callref; if (payload_len < 1) { - LOGP(DCC, LOGL_NOTICE, "Short read of userinfo message " - "error.\n"); + LOGP(DCC, LOGL_NOTICE, "Short read of USERINFO message\n"); return -EINVAL; } - tlv_parse(&tp, &gsm48_att_tlvdef, gh->data, payload_len, - GSM48_IE_USER_USER, 0); + if (tlv_parse(&tp, &gsm48_att_tlvdef, gh->data, payload_len, + GSM48_IE_USER_USER, 0) < 0) { + LOGP(DCC, LOGL_ERROR, "%s(): tlv_parse() failed\n", __func__); + return -EINVAL; + } + + memset(&user, 0, sizeof(struct gsm_mncc)); + user.callref = trans->callref; /* user-user */ gsm48_decode_useruser(&user.useruser, TLVP_VAL(&tp, GSM48_IE_USER_USER)-1); @@ -1417,17 +1447,20 @@ LOGP(DCC, LOGL_INFO, "received MODIFY REJECT\n"); + if (payload_len < 1) { + LOGP(DCC, LOGL_NOTICE, "Short read of MODIFY REJECT message\n"); + return -EINVAL; + } + if (tlv_parse(&tp, &gsm48_att_tlvdef, gh->data, payload_len, + GSM48_IE_BEARER_CAP, GSM48_IE_CAUSE) < 0) { + LOGP(DCC, LOGL_ERROR, "%s(): tlv_parse() failed\n", __func__); + return -EINVAL; + } + gsm48_stop_cc_timer(trans); memset(&modify, 0, sizeof(struct gsm_mncc)); modify.callref = trans->callref; - if (payload_len < 1) { - LOGP(DCC, LOGL_NOTICE, "Short read of modify reject message " - "error.\n"); - return -EINVAL; - } - tlv_parse(&tp, &gsm48_att_tlvdef, gh->data, payload_len, - GSM48_IE_BEARER_CAP, GSM48_IE_CAUSE); /* bearer capability */ if (TLVP_PRESENT(&tp, GSM48_IE_BEARER_CAP)) { modify.fields |= MNCC_F_BEARER_CAP; @@ -1675,14 +1708,18 @@ LOGP(DCC, LOGL_INFO, "received DISCONNECT\n"); + if (tlv_parse(&tp, &gsm48_att_tlvdef, gh->data, payload_len, + GSM48_IE_CAUSE, 0) < 0) { + LOGP(DCC, LOGL_ERROR, "%s(): tlv_parse() failed\n", __func__); + return -EINVAL; + } + gsm48_stop_cc_timer(trans); new_cc_state(trans, GSM_CSTATE_DISCONNECT_IND); memset(&disc, 0, sizeof(struct gsm_mncc)); disc.callref = trans->callref; - tlv_parse(&tp, &gsm48_att_tlvdef, gh->data, payload_len, - GSM48_IE_CAUSE, 0); /* cause */ if (TLVP_PRESENT(&tp, GSM48_IE_CAUSE)) { disc.fields |= MNCC_F_CAUSE; @@ -1724,11 +1761,15 @@ LOGP(DCC, LOGL_INFO, "received RELEASE\n"); + if (tlv_parse(&tp, &gsm48_att_tlvdef, gh->data, payload_len, 0, 0) < 0) { + LOGP(DCC, LOGL_ERROR, "%s(): tlv_parse() failed\n", __func__); + return -EINVAL; + } + gsm48_stop_cc_timer(trans); memset(&rel, 0, sizeof(struct gsm_mncc)); rel.callref = trans->callref; - tlv_parse(&tp, &gsm48_att_tlvdef, gh->data, payload_len, 0, 0); /* cause */ if (TLVP_PRESENT(&tp, GSM48_IE_CAUSE)) { rel.fields |= MNCC_F_CAUSE; @@ -1793,11 +1834,15 @@ LOGP(DCC, LOGL_INFO, "received RELEASE COMPLETE\n"); + if (tlv_parse(&tp, &gsm48_att_tlvdef, gh->data, payload_len, 0, 0) < 0) { + LOGP(DCC, LOGL_ERROR, "%s(): tlv_parse() failed\n", __func__); + return -EINVAL; + } + gsm48_stop_cc_timer(trans); memset(&rel, 0, sizeof(struct gsm_mncc)); rel.callref = trans->callref; - tlv_parse(&tp, &gsm48_att_tlvdef, gh->data, payload_len, 0, 0); /* cause */ if (TLVP_PRESENT(&tp, GSM48_IE_CAUSE)) { rel.fields |= MNCC_F_CAUSE; diff --git a/src/host/layer23/src/mobile/gsm48_mm.c b/src/host/layer23/src/mobile/gsm48_mm.c index 378cd2d..16a9b07 100644 --- a/src/host/layer23/src/mobile/gsm48_mm.c +++ b/src/host/layer23/src/mobile/gsm48_mm.c @@ -2259,11 +2259,13 @@ struct tlv_parsed tp; if (payload_len < 0) { - LOGP(DMM, LOGL_NOTICE, "Short read of MM INFORMATION message " - "error.\n"); + LOGP(DMM, LOGL_ERROR, "Short read of MM INFORMATION message\n"); return -EINVAL; } - tlv_parse(&tp, &gsm48_mm_att_tlvdef, gh->data, payload_len, 0, 0); + if (tlv_parse(&tp, &gsm48_mm_att_tlvdef, gh->data, payload_len, 0, 0) < 0) { + LOGP(DMM, LOGL_ERROR, "%s(): tlv_parse() failed\n", __func__); + return -EINVAL; + } /* long name */ if (TLVP_PRESENT(&tp, GSM48_IE_NAME_LONG)) { @@ -2611,15 +2613,17 @@ struct tlv_parsed tp; struct msgb *nmsg; - if (payload_len < sizeof(struct gsm48_loc_area_id)) { - short_read: - LOGP(DMM, LOGL_NOTICE, "Short read of LOCATION UPDATING ACCEPT " - "message error.\n"); + if (payload_len < 0) { +short_read: + LOGP(DMM, LOGL_ERROR, "Short read of LOCATION UPDATING ACCEPT message\n"); return -EINVAL; } - tlv_parse(&tp, &gsm48_mm_att_tlvdef, - gh->data + sizeof(struct gsm48_loc_area_id), - payload_len - sizeof(struct gsm48_loc_area_id), 0, 0); + if (tlv_parse(&tp, &gsm48_mm_att_tlvdef, + gh->data + sizeof(*lai), + payload_len - sizeof(*lai), 0, 0) < 0) { + LOGP(DMM, LOGL_ERROR, "%s(): tlv_parse() failed\n", __func__); + return -EINVAL; + } /* update has finished */ mm->lupd_pending = 0; diff --git a/src/host/layer23/src/mobile/gsm48_rr.c b/src/host/layer23/src/mobile/gsm48_rr.c index 334fdaf..46a143c 100644 --- a/src/host/layer23/src/mobile/gsm48_rr.c +++ b/src/host/layer23/src/mobile/gsm48_rr.c @@ -3642,12 +3642,13 @@ struct tlv_parsed tp; if (payload_len < 0) { - LOGP(DRR, LOGL_NOTICE, "Short read of ADDITIONAL ASSIGNMENT " - "message.\n"); - return gsm48_rr_tx_rr_status(ms, - GSM48_RR_CAUSE_PROT_ERROR_UNSPC); + LOGP(DRR, LOGL_NOTICE, "Short read of ADDITIONAL ASSIGNMENT message\n"); + return gsm48_rr_tx_rr_status(ms, GSM48_RR_CAUSE_PROT_ERROR_UNSPC); } - tlv_parse(&tp, &gsm48_rr_att_tlvdef, aa->data, payload_len, 0, 0); + if (tlv_parse(&tp, &gsm48_rr_att_tlvdef, aa->data, payload_len, 0, 0) < 0) { + LOGP(DRR, LOGL_ERROR, "%s(): tlv_parse() failed\n", __func__); + return gsm48_rr_tx_rr_status(ms, GSM48_RR_CAUSE_PROT_ERROR_UNSPC); + } return gsm48_rr_tx_rr_status(ms, GSM48_RR_CAUSE_PROT_ERROR_UNSPC); } @@ -4338,12 +4339,13 @@ uint8_t *mode; if (payload_len < 0) { - LOGP(DRR, LOGL_NOTICE, "Short read of CHANNEL RELEASE " - "message.\n"); - return gsm48_rr_tx_rr_status(ms, - GSM48_RR_CAUSE_PROT_ERROR_UNSPC); + LOGP(DRR, LOGL_NOTICE, "Short read of CHANNEL RELEASE message\n"); + return gsm48_rr_tx_rr_status(ms, GSM48_RR_CAUSE_PROT_ERROR_UNSPC); } - tlv_parse(&tp, &gsm48_rr_att_tlvdef, cr->data, payload_len, 0, 0); + if (tlv_parse(&tp, &gsm48_rr_att_tlvdef, cr->data, payload_len, 0, 0) < 0) { + LOGP(DRR, LOGL_ERROR, "%s(): tlv_parse() failed\n", __func__); + return gsm48_rr_tx_rr_status(ms, GSM48_RR_CAUSE_PROT_ERROR_UNSPC); + } LOGP(DRR, LOGL_INFO, "channel release request with cause 0x%02x\n", cr->rr_cause); @@ -4391,10 +4393,13 @@ struct tlv_parsed tp; if (payload_len < 0) { - LOGP(DRR, LOGL_NOTICE, "Short read of CHANNEL RELEASE message.\n"); + LOGP(DRR, LOGL_NOTICE, "Short read of CHANNEL RELEASE message\n"); return gsm48_rr_tx_rr_status(ms, GSM48_RR_CAUSE_PROT_ERROR_UNSPC); } - tlv_parse(&tp, &gsm48_rr_att_tlvdef, cr->data, payload_len, 0, 0); + if (tlv_parse(&tp, &gsm48_rr_att_tlvdef, cr->data, payload_len, 0, 0) < 0) { + LOGP(DRR, LOGL_ERROR, "%s(): tlv_parse() failed\n", __func__); + return gsm48_rr_tx_rr_status(ms, GSM48_RR_CAUSE_PROT_ERROR_UNSPC); + } LOGP(DRR, LOGL_INFO, "CHANNEL RELESE via UI frame with cause 0x%02x\n", cr->rr_cause); @@ -4715,12 +4720,13 @@ cdb->ind_tx_power = rr->cd_now.ind_tx_power; if (payload_len < 0) { - LOGP(DRR, LOGL_NOTICE, "Short read of ASSIGNMENT COMMAND " - "message.\n"); - return gsm48_rr_tx_rr_status(ms, - GSM48_RR_CAUSE_PROT_ERROR_UNSPC); + LOGP(DRR, LOGL_NOTICE, "Short read of ASSIGNMENT COMMAND message\n"); + return gsm48_rr_tx_rr_status(ms, GSM48_RR_CAUSE_PROT_ERROR_UNSPC); } - tlv_parse(&tp, &gsm48_rr_att_tlvdef, ac->data, payload_len, 0, 0); + if (tlv_parse(&tp, &gsm48_rr_att_tlvdef, ac->data, payload_len, 0, 0) < 0) { + LOGP(DRR, LOGL_ERROR, "%s(): tlv_parse() failed\n", __func__); + return gsm48_rr_tx_rr_status(ms, GSM48_RR_CAUSE_PROT_ERROR_UNSPC); + } /* decode channel description (before time) */ if (TLVP_PRESENT(&tp, GSM48_IE_CH_DESC_1_BEFORE)) { @@ -5102,10 +5108,12 @@ cdb->ind_tx_power = rr->cd_now.ind_tx_power; if (payload_len < 0) { - LOGP(DRR, LOGL_NOTICE, "Short read of HANDOVER COMMAND " - "message.\n"); - return gsm48_rr_tx_rr_status(ms, - GSM48_RR_CAUSE_PROT_ERROR_UNSPC); + LOGP(DRR, LOGL_NOTICE, "Short read of HANDOVER COMMAND message\n"); + return gsm48_rr_tx_rr_status(ms, GSM48_RR_CAUSE_PROT_ERROR_UNSPC); + } + if (tlv_parse(&tp, &gsm48_rr_att_tlvdef, ho->data, payload_len, 0, 0) < 0) { + LOGP(DRR, LOGL_ERROR, "%s(): tlv_parse() failed\n", __func__); + return gsm48_rr_tx_rr_status(ms, GSM48_RR_CAUSE_PROT_ERROR_UNSPC); } /* cell description */ @@ -5115,8 +5123,6 @@ rr->chan_req_val = ho->ho_ref; rr->chan_req_mask = 0x00; - tlv_parse(&tp, &gsm48_rr_att_tlvdef, ho->data, payload_len, 0, 0); - /* sync ind */ if (TLVP_PRESENT(&tp, GSM48_IE_SYNC_IND)) { gsm48_decode_sync_ind(rr, (struct gsm48_sync_ind *) -- To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/35576?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Change-Id: Id02fc0b1af6da939cb72f327c7d2ddca484ca063 Gerrit-Change-Number: 35576 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[S] Change in osmo-ttcn3-hacks[master]: pgw: Expect EchoResp in CLIENT port of component who sent EchoReq
by pespin 15 Jan '24

15 Jan '24
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/35516?usp=email ) ( 1 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. )Change subject: pgw: Expect EchoResp in CLIENT port of component who sent EchoReq ...................................................................... pgw: Expect EchoResp in CLIENT port of component who sent EchoReq A recent commit in GTPv2_Emulation improved the routing of incoming messages from network towards clients. After that change, the GTPv2_Emulation properly matches the originating component of the procedure and forwards the reply to it. Hence, TC_tx_echo() needs to be adapter to expect the reply on its CLIENT port. TEID0 is now left for incoming initiating messages which have no seqnr match. Change-Id: I1764fdf81192597e393d79d34cb8f221aa79bbd9 Fixes: 1d2cc67036e95a0c3ee3ac7738d7e15d5f76b8a2 --- M pgw/PGW_Tests.ttcn 1 file changed, 24 insertions(+), 3 deletions(-) Approvals: daniel: Looks good to me, but someone else must approve laforge: Looks good to me, approved Jenkins Builder: Verified diff --git a/pgw/PGW_Tests.ttcn b/pgw/PGW_Tests.ttcn index b8eb471..fa7be47 100644 --- a/pgw/PGW_Tests.ttcn +++ b/pgw/PGW_Tests.ttcn @@ -41,7 +41,7 @@ } /* main component, we typically have one per testcase */ -type component PGW_Test_CT { +type component PGW_Test_CT extends GTP2_ConnHdlr { var GTPv2_Emulation_CT vc_GTP2; port GTP2EM_PT TEID0; @@ -241,6 +241,8 @@ vc_GTP2 := GTPv2_Emulation_CT.create("GTP2_EM"); map(vc_GTP2:GTP2C, system:GTP2C); connect(vc_GTP2:TEID0, self:TEID0); + connect(vc_GTP2:CLIENT, self:GTP2); + connect(vc_GTP2:CLIENT_PROC, self:GTP2_PROC); vc_GTP2.start(GTPv2_Emulation.main(cfg)); if (mp_pcrf_local_ip != "") { @@ -785,10 +787,10 @@ f_init(); - TEID0.send(ts_GTP2C_EchoReq(0)); + GTP2.send(ts_GTP2C_EchoReq(0)); T.start; alt { - [] TEID0.receive(tr_GTP2C_EchoResp) { + [] GTP2.receive(tr_GTP2C_EchoResp) { setverdict(pass); } [] T.timeout { -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/35516?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: I1764fdf81192597e393d79d34cb8f221aa79bbd9 Gerrit-Change-Number: 35516 Gerrit-PatchSet: 2 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
[S] Change in osmo-ttcn3-hacks[master]: S1AP_Emulation: Add port message to reset NAS count values
by pespin 15 Jan '24

15 Jan '24
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/35512?usp=email ) ( 1 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. )Change subject: S1AP_Emulation: Add port message to reset NAS count values ...................................................................... S1AP_Emulation: Add port message to reset NAS count values It is sometimes needed to reset them to zero as per spec, like when moving GERAN/UTRAN->EUTRAN. This will be used by a follow-up patch. Change-Id: I61d7b919aba8f58a020c18ae9b9bba4108d59010 --- M library/S1AP_Emulation.ttcn 1 file changed, 24 insertions(+), 1 deletion(-) Approvals: daniel: Looks good to me, but someone else must approve laforge: Looks good to me, approved Jenkins Builder: Verified diff --git a/library/S1AP_Emulation.ttcn b/library/S1AP_Emulation.ttcn index 7d91c36..1ef4a76 100644 --- a/library/S1AP_Emulation.ttcn +++ b/library/S1AP_Emulation.ttcn @@ -67,8 +67,12 @@ octetstring k_nas_int, octetstring k_nas_enc }; +type record ResetNAScounts { +/* empty */ +}; type union S1APEM_Config { - NAS_Keys set_nas_keys + NAS_Keys set_nas_keys, + ResetNAScounts reset_nas_counts }; type enumerated S1APEM_EventUpDown { @@ -442,6 +446,12 @@ S1apAssociationTable[assoc_id].nus.k_nas_int := s1cfg.set_nas_keys.k_nas_int; S1apAssociationTable[assoc_id].nus.k_nas_enc := s1cfg.set_nas_keys.k_nas_enc; } + /* Configuration primitive from client */ + [] S1AP_CLIENT.receive(S1APEM_Config:{reset_nas_counts:=?}) -> value s1cfg sender vc_conn { + var integer assoc_id := f_assoc_id_by_comp(vc_conn); + S1apAssociationTable[assoc_id].nus.rx_count := 0; + S1apAssociationTable[assoc_id].nus.tx_count := 0; + } /* S1AP from client: InitialUE */ [] S1AP_CLIENT.receive(tr_S1AP_InitialUE) -> value msg sender vc_conn { /* create a table entry about this connection */ -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/35512?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: I61d7b919aba8f58a020c18ae9b9bba4108d59010 Gerrit-Change-Number: 35512 Gerrit-PatchSet: 2 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
[M] Change in osmo-ttcn3-hacks[master]: NAS_Templates: Allow passing old_guti and ptmsi_sig to TAU Req template
by pespin 15 Jan '24

15 Jan '24
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/35510?usp=email ) Change subject: NAS_Templates: Allow passing old_guti and ptmsi_sig to TAU Req template ...................................................................... NAS_Templates: Allow passing old_guti and ptmsi_sig to TAU Req template Change-Id: I5e0204e772edefc49a63b73fc4aad2fed5c14cac --- M library/NAS_Templates.ttcn 1 file changed, 46 insertions(+), 5 deletions(-) Approvals: Jenkins Builder: Verified fixeria: Looks good to me, approved diff --git a/library/NAS_Templates.ttcn b/library/NAS_Templates.ttcn index 7652720..4b5758e 100644 --- a/library/NAS_Templates.ttcn +++ b/library/NAS_Templates.ttcn @@ -142,13 +142,21 @@ } template (value) EPS_MobileIdentityV -ts_NAS_MobileId_GUTI(hexstring mcc_mnc, OCT2 mmegi, OCT1 mmec, OCT4 tmsi) := { +ts_NAS_MobileId_GUTI_fields(hexstring mcc_mnc, OCT2 mmegi, OCT1 mmec, OCT4 tmsi) := { typeOfIdentity := '110'B, oddEvenInd_identity := { guti := ts_NAS_GUTI(mcc_mnc, mmegi, mmec, tmsi) } } +template (value) EPS_MobileIdentityV +ts_NAS_MobileId_GUTI(template (value) GUTI guti) := { + typeOfIdentity := '110'B, + oddEvenInd_identity := { + guti := guti + } +} + /* 9.9.3.12 EPS mobile identity */ template (value) EPS_MobileIdentityLV ts_EPS_MobileId_IMSI(hexstring imsi) := { @@ -162,7 +170,29 @@ template (value) EPS_MobileIdentityLV ts_EPS_MobileId_GUTI(hexstring mcc_mnc, OCT2 mmegi, OCT1 mmec, OCT4 tmsi) := { - ePS_MobileIdentity := ts_NAS_MobileId_GUTI(mcc_mnc, mmegi, mmec, tmsi) + ePS_MobileIdentity := ts_NAS_MobileId_GUTI_fields(mcc_mnc, mmegi, mmec, tmsi) +} + +template (value) EPS_MobileIdentityLV +ts_EPS_MobileId_GUTI_(template (value) GUTI guti) := { + ePS_MobileIdentity := ts_NAS_MobileId_GUTI(guti) +} + +/* 9.9.3.26 P-TMSI signature */ +template (value) P_TMSISignatureTV +ts_PTMSI_SignatureTV(template (value) OCT3 ptmsi_sig) := { + elementIdentifier := '19'O, + valueField := ptmsi_sig +} + +/* 9.9.3.45 GUTI Type */ +const BIT1 GUTI_TYPE_NATIVE := '0'B; +const BIT1 GUTI_TYPE_MAPPED := '1'B; +template (value) GUTI_TypeTV +ts_GUTI_TypeTV(template (value) BIT1 guti_type) := { + gUTI_Type := guti_type, + spare := '000'B, + elementIdentifier := '1110'B } template (value) PDU_NAS_EPS @@ -354,7 +384,9 @@ /* 8.2.29 Tracking Area Update Request */ template (value) PDU_NAS_EPS -ts_PDU_NAS_EPS_TrackingAreaUpdateRequest(EPS_MobileIdentityLV old_guti) := { +ts_PDU_NAS_EPS_TrackingAreaUpdateRequest(template (value) EPS_MobileIdentityLV old_guti, + template (omit) P_TMSISignatureTV old_ptmsi_sig := omit, + template (omit) GUTI_TypeTV old_guti_type := omit) := { protocolDiscriminator := c_EPS_NAS_PD_EMM, ePS_messages := { ePS_MobilityManagement := { @@ -366,7 +398,7 @@ oldGUTI := old_guti, nonCurrentNative_nasKeySetId := omit, gprsCipheringKeySequenceNumber := omit, - old_P_TMSISignature := omit, + old_P_TMSISignature := old_ptmsi_sig, additionalGUTI := omit, nonce := omit, uENetworkCapability := omit, @@ -382,7 +414,7 @@ supportedCodecList := omit, additionalUpdateType := omit, voiceDomainPrefandUEsettings := omit, - oldGUTI_Type := omit, + oldGUTI_Type := old_guti_type, deviceProperties := omit, mS_NetworkFeatureSupport := omit, tMSIBasedNRIContainer := omit, -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/35510?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: I5e0204e772edefc49a63b73fc4aad2fed5c14cac Gerrit-Change-Number: 35510 Gerrit-PatchSet: 2 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de> Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
[M] Change in osmo-ttcn3-hacks[master]: NAS_Templates: Introduce template tr_PDU_NAS_EPS_TrackingAreaUpdateAc...
by pespin 15 Jan '24

15 Jan '24
pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/35511?usp=email ) ( 1 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. )Change subject: NAS_Templates: Introduce template tr_PDU_NAS_EPS_TrackingAreaUpdateAccept ...................................................................... NAS_Templates: Introduce template tr_PDU_NAS_EPS_TrackingAreaUpdateAccept Change-Id: Iba19ac8293fecfe0b150155cebe50cbe4d32fe4d --- M library/NAS_Templates.ttcn 1 file changed, 52 insertions(+), 0 deletions(-) Approvals: laforge: Looks good to me, approved daniel: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/library/NAS_Templates.ttcn b/library/NAS_Templates.ttcn index 4b5758e..944d857 100644 --- a/library/NAS_Templates.ttcn +++ b/library/NAS_Templates.ttcn @@ -365,6 +365,49 @@ tSC := tSC } +/* 8.2.26 Tracking Area Update Accept */ +template (present) PDU_NAS_EPS +tr_PDU_NAS_EPS_TrackingAreaUpdateAccept := { + protocolDiscriminator := c_EPS_NAS_PD_EMM, + ePS_messages := { + ePS_MobilityManagement := { + pDU_NAS_EPS_TrackingAreaUpdateAccept := { + securityHeaderType := c_EPS_SEC_NONE, + messageType := '01001001'B, + updateResult := { + valueOfUpdateResult := ?, + spare := '0'B + }, + spareHalfOctet := '0000'B, + t3412 := *, + gUTI := *, + tAI_List := *, + ePSBearerContextStatus := *, + locationAreaIdentification := *, + msIdentity := *, + eMMCause := *, + t3402 := *, + t3423 := *, + equivalentPLMNs := *, + emergencyNumberList := *, + ePS_NetworkFeatureSupport := *, + additionalUpdateResult := *, + t3412_Extended := *, + t3324 := *, + extendedDRXParameters := *, + headerCompressionConfigurationStatus := *, + dNCID := *, + sMS_ServiceStatus := *, + non3GPP_NW_ProvidedPolicies := *, + t3448 := *, + networkPolicy := *, + t3447 := *, + extendedEmergencyNumberList := * + } + } + } +} + /* 8.2.28 Tracking Area Update Reject */ template (present) PDU_NAS_EPS tr_PDU_NAS_EPS_TrackingAreaUpdateReject(template (present) EMM_CauseV cause := ?) := { -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/35511?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: Iba19ac8293fecfe0b150155cebe50cbe4d32fe4d Gerrit-Change-Number: 35511 Gerrit-PatchSet: 2 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • ...
  • 156
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.