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

March 2023

  • 1 participants
  • 3642 discussions
[M] Change in osmo-bsc[master]: pcu_sock: handle multiple BTSs with one BSC co-located PCU (in theory)
by dexter 01 Mar '23

01 Mar '23
dexter has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bsc/+/31618 ) Change subject: pcu_sock: handle multiple BTSs with one BSC co-located PCU (in theory) ...................................................................... pcu_sock: handle multiple BTSs with one BSC co-located PCU (in theory) The current PCU implementation has never been tested with multiple BTS attached to it. This is due to the fact that it has been used exclusively in an BTS co-located setup where naturally only one BTS is present. The PCU sock protocol supports multiple BTSs in theory and we should handle this correctly. We also should add a check and print an error message in case two or more BTSs with BSC co-located PCU (Ericsson RBS) are configured. Related: OS#5198 Change-Id: I0b42c2c130106f6ffca2dd08d079e1a7bda41f0b --- M src/osmo-bsc/pcu_sock.c 1 file changed, 114 insertions(+), 58 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/18/31618/1 diff --git a/src/osmo-bsc/pcu_sock.c b/src/osmo-bsc/pcu_sock.c index f136e21..933ff5f 100644 --- a/src/osmo-bsc/pcu_sock.c +++ b/src/osmo-bsc/pcu_sock.c @@ -361,11 +361,11 @@ if (pcu_connected(bts)) { /* In cases where the CCU is connected via an E1 line, we transmit the connection parameters for the * PDCH before we announce the other BTS related parameters. At the moment Ericsson RBS is the only - * E1 BTS we support. */ - if (is_ericsson_bts(bts)) + * E1 BTS we support and also the only BTS we support with a BSC co-located-pcu */ + if (is_ericsson_bts(bts)) { pcu_tx_e1_ccu_ind(bts); - - pcu_tx_info_ind(bts); + pcu_tx_info_ind(bts); + } } } @@ -713,8 +713,9 @@ int rc = 0; struct gsm_bts *bts; - /* FIXME: allow multiple BTS */ - bts = llist_entry(net->bts_list.next, struct gsm_bts, list); + bts = gsm_bts_num(net, pcu_prim->bts_nr); + if (!bts) + return -EINVAL; switch (msg_type) { case PCU_IF_MSG_DATA_REQ: @@ -766,25 +767,11 @@ return 0; } -static void pcu_sock_close(struct pcu_sock_state *state) +static void pdch_deact_bts(struct gsm_bts *bts) { - struct osmo_fd *bfd = &state->conn_bfd; - struct gsm_bts *bts; struct gsm_bts_trx *trx; int j; - /* FIXME: allow multiple BTS */ - bts = llist_entry(state->net->bts_list.next, struct gsm_bts, list); - - LOGP(DPCU, LOGL_NOTICE, "PCU socket has LOST connection\n"); - - close(bfd->fd); - bfd->fd = -1; - osmo_fd_unregister(bfd); - - /* re-enable the generation of ACCEPT for new connections */ - osmo_fd_read_enable(&state->listen_bfd); - #if 0 /* remove si13, ... */ bts->si_valid &= ~(1 << SYSINFO_TYPE_13); @@ -806,6 +793,27 @@ } } } +} + +static void pcu_sock_close(struct pcu_sock_state *state) +{ + struct osmo_fd *bfd = &state->conn_bfd; + struct gsm_bts *bts; + + LOGP(DPCU, LOGL_NOTICE, "PCU socket has LOST connection\n"); + + close(bfd->fd); + bfd->fd = -1; + osmo_fd_unregister(bfd); + + /* re-enable the generation of ACCEPT for new connections */ + osmo_fd_read_enable(&state->listen_bfd); + + /* Disable all PDCHs on all BTSs that are served by the PCU */ + llist_for_each_entry(bts, &state->net->bts_list, list) { + if (is_ericsson_bts(bts)) + pdch_deact_bts(bts); + } /* flush the queue */ while (!llist_empty(&state->upqueue)) { @@ -923,46 +931,10 @@ return rc; } -/* accept connection coming from PCU */ -static int pcu_sock_accept(struct osmo_fd *bfd, unsigned int flags) +static void pdch_act_bts(struct gsm_bts *bts) { - struct pcu_sock_state *state = (struct pcu_sock_state *)bfd->data; - struct osmo_fd *conn_bfd = &state->conn_bfd; - struct sockaddr_un un_addr; - struct gsm_bts *bts; struct gsm_bts_trx *trx; int j; - socklen_t len; - int rc; - - /* FIXME: allow multiple BTS */ - bts = llist_entry(state->net->bts_list.next, struct gsm_bts, list); - - len = sizeof(un_addr); - rc = accept(bfd->fd, (struct sockaddr *) &un_addr, &len); - if (rc < 0) { - LOG_BTS(bts, DPCU, LOGL_ERROR, "Failed to accept a new connection\n"); - return -1; - } - - if (conn_bfd->fd >= 0) { - LOG_BTS(bts, DPCU, LOGL_NOTICE, "PCU connects but we already have another active connection ?!?\n"); - /* We already have one PCU connected, this is all we support */ - osmo_fd_read_disable(&state->listen_bfd); - close(rc); - return 0; - } - - osmo_fd_setup(conn_bfd, rc, OSMO_FD_READ, pcu_sock_cb, state, 0); - - if (osmo_fd_register(conn_bfd) != 0) { - LOG_BTS(bts, DPCU, LOGL_ERROR, "Failed to register new connection fd\n"); - close(conn_bfd->fd); - conn_bfd->fd = -1; - return -1; - } - - LOG_BTS(bts, DPCU, LOGL_NOTICE, "PCU socket connected to external PCU\n"); /* activate PDCH */ llist_for_each_entry(trx, &bts->trx_list, list) { @@ -975,6 +947,72 @@ } } } +} + +/* Check if there are multiple BTSs configured that would require a BSC co-located PCU */ +static bool check_for_multiple_bts(struct llist_head *bts_list) +{ + unsigned int bts_count = 0; + struct gsm_bts *bts; + + llist_for_each_entry(bts, bts_list, list) { + if (is_ericsson_bts(bts)) + bts_count++; + } + + if (bts_count > 1) + return true; + return false; +} + + +/* accept connection coming from PCU */ +static int pcu_sock_accept(struct osmo_fd *bfd, unsigned int flags) +{ + struct pcu_sock_state *state = (struct pcu_sock_state *)bfd->data; + struct osmo_fd *conn_bfd = &state->conn_bfd; + struct sockaddr_un un_addr; + struct gsm_bts *bts; + socklen_t len; + int rc; + + /* FIXME: allow multiple BTS in OsmoPCU */ + if (check_for_multiple_bts(&state->net->bts_list)) { + LOGP(DPCU, LOGL_ERROR, "This version of OsmoBSC can only handle one (Ericsson RBS) BTS with BSC co-located PCU\n"); + LOGP(DPCU, LOGL_ERROR, "Failed to accept a new connection\n"); + } + + len = sizeof(un_addr); + rc = accept(bfd->fd, (struct sockaddr *) &un_addr, &len); + if (rc < 0) { + LOGP(DPCU, LOGL_ERROR, "Failed to accept a new connection\n"); + return -1; + } + + if (conn_bfd->fd >= 0) { + LOGP(DPCU, LOGL_NOTICE, "PCU connects but we already have another active connection ?!?\n"); + /* We already have one PCU connected, this is all we support */ + osmo_fd_read_disable(&state->listen_bfd); + close(rc); + return 0; + } + + osmo_fd_setup(conn_bfd, rc, OSMO_FD_READ, pcu_sock_cb, state, 0); + + if (osmo_fd_register(conn_bfd) != 0) { + LOGP(DPCU, LOGL_ERROR, "Failed to register new connection fd\n"); + close(conn_bfd->fd); + conn_bfd->fd = -1; + return -1; + } + + LOGP(DPCU, LOGL_NOTICE, "PCU socket connected to external PCU\n"); + + /* Activate all PDCHs on all BTSs that are served by the PCU */ + llist_for_each_entry(bts, &state->net->bts_list, list) { + if (is_ericsson_bts(bts)) + pdch_act_bts(bts); + } return 0; } -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/31618 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: I0b42c2c130106f6ffca2dd08d079e1a7bda41f0b Gerrit-Change-Number: 31618 Gerrit-PatchSet: 1 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[M] Change in osmocom-bb[master]: modem: route L1CTL prims to/from libosmo-gprs-rlcmac
by fixeria 01 Mar '23

01 Mar '23
Attention is currently required from: pespin. Hello Jenkins Builder, pespin, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/osmocom-bb/+/31572 to look at the new patch set (#2). Change subject: modem: route L1CTL prims to/from libosmo-gprs-rlcmac ...................................................................... modem: route L1CTL prims to/from libosmo-gprs-rlcmac Change-Id: I38e9a686f8edc3fe55f961d75e68602c33bbbaaf Related: OS#5500 --- M src/host/layer23/src/modem/rlcmac.c 1 file changed, 77 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/72/31572/2 -- To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/31572 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmocom-bb Gerrit-Branch: master Gerrit-Change-Id: I38e9a686f8edc3fe55f961d75e68602c33bbbaaf Gerrit-Change-Number: 31572 Gerrit-PatchSet: 2 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newpatchset
1 0
0 0
[L] Change in libosmocore[master]: fix gsm0808_sc_cfg <-> gsm48_mr_cfg conversion
by fixeria 01 Mar '23

01 Mar '23
Attention is currently required from: neels, pespin, dexter. fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/29475 ) Change subject: fix gsm0808_sc_cfg <-> gsm48_mr_cfg conversion ...................................................................... Patch Set 4: (1 comment) File include/osmocom/gsm/protocol/gsm_04_08.h: https://gerrit.osmocom.org/c/libosmocore/+/29475/comment/65ec494f_715300db PS2, Line 627: return ((uint8_t *)cfg)[1]; > gsm48_multi_rate_conf has two uint8_t members, AFAICT adding a union would require adding another ex […] You don't really need to name the union itself, it can be anonymous (just like structures). The problem is that bit-fields are treated as individual fields in a union, so doing what Pau suggested: ``` /* I removed the LE variant for the sake of readability * see https://people.osmocom.org/fixeria/union_bfield_test.c */ struct gsm48_multi_rate_conf { uint8_t ver:3, nscb:1, icmi:1, spare:1, smod:2; union { uint8_t m12_2:1, m10_2:1, m7_95:1, m7_40:1, m6_70:1, m5_90:1, m5_15:1, m4_75:1; uint8_t mode; }; } __attribute__((packed)); ``` will result in the following behavior: ``` struct gsm48_multi_rate_conf mrc = { 0 }; // mrc.mode = 0x00 // m4_75=0, m5_15=0, m5_90=0, m6_70=0, m7_40=0, m7_95=0, m10_2=0, m12_2=0 mrc.m4_75 = 1; // mrc.mode = 0x01 // m4_75=1, m5_15=1, m5_90=1, m6_70=1, m7_40=1, m7_95=1, m10_2=1, m12_2=1 mrc.m10_2 = 0; // mrc.mode = 0x00 // m4_75=0, m5_15=0, m5_90=0, m6_70=0, m7_40=0, m7_95=0, m10_2=0, m12_2=0 mrc.m12_2 = 1; // mrc.mode = 0x01 // m4_75=1, m5_15=1, m5_90=1, m6_70=1, m7_40=1, m7_95=1, m10_2=1, m12_2=1 ``` Definitely not what we want. Here is an alternative approach: ``` union gsm48_multi_rate_conf_u { struct gsm48_multi_rate_conf mrc; struct { uint8_t hdr; uint8_t mode; }; }; ``` This should work as expected, but I am fine with the current approach. Keep it as it is. -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/29475 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I900fda192742fa8f6dd54e9131ef1704b14cc41a Gerrit-Change-Number: 29475 Gerrit-PatchSet: 4 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-CC: pespin <pespin(a)sysmocom.de> Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de> Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-Attention: dexter <pmaier(a)sysmocom.de> Gerrit-Comment-Date: Wed, 01 Mar 2023 11:29:22 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: neels <nhofmeyr(a)sysmocom.de> Comment-In-Reply-To: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: comment
1 0
0 0
[S] Change in osmo-bsc[master]: pcu_sock: print OML alerts from PCU
by dexter 01 Mar '23

01 Mar '23
dexter has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/31499 ) ( 5 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. )Change subject: pcu_sock: print OML alerts from PCU ...................................................................... pcu_sock: print OML alerts from PCU The PCU is able to send OML alerts via the BTS to the BSC. When the PCU operates in co-location to the BSC we just print the alerts in the log directly Change-Id: Id32553556356c2affe32e47ae1c3ae6a514efdce Related: OS#5198 --- M src/osmo-bsc/pcu_sock.c 1 file changed, 17 insertions(+), 0 deletions(-) Approvals: pespin: Looks good to me, but someone else must approve laforge: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/osmo-bsc/pcu_sock.c b/src/osmo-bsc/pcu_sock.c index add968a..a0c9827 100644 --- a/src/osmo-bsc/pcu_sock.c +++ b/src/osmo-bsc/pcu_sock.c @@ -686,6 +686,9 @@ if (rc < 0) return -EINVAL; break; + case PCU_OML_ALERT: + LOG_BTS(bts, DPCU, LOGL_ERROR, "PCU external alarm: %s\n", txt->text); + break; default: LOGP(DPCU, LOGL_ERROR, "Unknown TXT_IND type %u received\n", txt->type); -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/31499 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: Id32553556356c2affe32e47ae1c3ae6a514efdce Gerrit-Change-Number: 31499 Gerrit-PatchSet: 6 Gerrit-Owner: dexter <pmaier(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter <pmaier(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
[S] Change in osmo-bsc[master]: utils: fix incorrect string checks in meas_db_insert()
by fixeria 01 Mar '23

01 Mar '23
Attention is currently required from: iedemam. fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/31617 ) Change subject: utils: fix incorrect string checks in meas_db_insert() ...................................................................... Patch Set 1: (2 comments) Patchset: PS1: > Good catch, apologies for the miss. […] No worries, it's absolutely normal and we all make mistakes. File src/utils/meas_db.c: https://gerrit.osmocom.org/c/osmo-bsc/+/31617/comment/8b5c6a0b_ab216ab6 PS1, Line 97: if (mfm->imsi[0] != '\0') > The original checks before my refactor were using strlen(). […] Let's see what the others think. If people find `strlen()` more readable, I can amend the patch. The compiler would optimize `strlen()` out anyway. -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/31617 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: I8a41078070119bc22d594c0dfff5d98b5d16f970 Gerrit-Change-Number: 31617 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: iedemam <michael(a)kapsulate.com> Gerrit-Attention: iedemam <michael(a)kapsulate.com> Gerrit-Comment-Date: Wed, 01 Mar 2023 09:57:28 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: iedemam <michael(a)kapsulate.com> Gerrit-MessageType: comment
1 0
0 0
[S] Change in osmo-bsc[master]: utils: fix incorrect string checks in meas_db_insert()
by iedemam 01 Mar '23

01 Mar '23
Attention is currently required from: fixeria. iedemam has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/31617 ) Change subject: utils: fix incorrect string checks in meas_db_insert() ...................................................................... Patch Set 1: Code-Review+1 (2 comments) Patchset: PS1: Good catch, apologies for the miss. This looks ok to me, only a note about how this check was performed before. File src/utils/meas_db.c: https://gerrit.osmocom.org/c/osmo-bsc/+/31617/comment/50de4a0d_fcfccde0 PS1, Line 97: if (mfm->imsi[0] != '\0') The original checks before my refactor were using strlen(). Maybe that's cleaner? -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/31617 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: I8a41078070119bc22d594c0dfff5d98b5d16f970 Gerrit-Change-Number: 31617 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: iedemam <michael(a)kapsulate.com> Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Comment-Date: Wed, 01 Mar 2023 09:28:32 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
[M] Change in osmo-bsc[master]: codec_pref: split test_codec_support_bts_rate
by osmith 01 Mar '23

01 Mar '23
osmith has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/31544 ) Change subject: codec_pref: split test_codec_support_bts_rate ...................................................................... codec_pref: split test_codec_support_bts_rate Move the check for the rate into an extra function, so it can be used for CSD without checking a speech codec at the same time. Related: OS#4393 Change-Id: Iea8a23ef3c66ed556110038fe9f3bc7f6eef3e96 --- M src/osmo-bsc/codec_pref.c 1 file changed, 37 insertions(+), 18 deletions(-) Approvals: laforge: Looks good to me, approved pespin: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/src/osmo-bsc/codec_pref.c b/src/osmo-bsc/codec_pref.c index a64425a..581872a 100644 --- a/src/osmo-bsc/codec_pref.c +++ b/src/osmo-bsc/codec_pref.c @@ -174,37 +174,43 @@ return false; } +static bool test_codec_support_bts_rate(const struct gsm_bts *bts, const bool full_rate) +{ + unsigned int i; + struct gsm_bts_trx *trx; + enum gsm_phys_chan_config pchan; + + llist_for_each_entry(trx, &bts->trx_list, list) { + for (i = 0; i < TRX_NR_TS; i++) { + pchan = trx->ts[i].pchan_from_config; + if (pchan == GSM_PCHAN_OSMO_DYN) + return true; + else if (full_rate && pchan == GSM_PCHAN_TCH_F) + return true; + else if (full_rate && pchan == GSM_PCHAN_TCH_F_PDCH) + return true; + else if (!full_rate && pchan == GSM_PCHAN_TCH_H) + return true; + } + } + + return false; +} + /* Check if the given permitted speech value is supported by the BTS * (vty option bts->codec-support). */ static bool test_codec_support_bts(const struct gsm_bts *bts, uint8_t perm_spch) { - struct gsm_bts_trx *trx; const struct bts_codec_conf *bts_codec = &bts->codec; - unsigned int i; bool full_rate; int rc; - enum gsm_phys_chan_config pchan; - bool rate_match = false; /* Check if the BTS provides a physical channel that matches the * bandwidth of the desired codec. */ rc = full_rate_from_perm_spch(&full_rate, perm_spch); if (rc < 0) return false; - llist_for_each_entry(trx, &bts->trx_list, list) { - for (i = 0; i < TRX_NR_TS; i++) { - pchan = trx->ts[i].pchan_from_config; - if (pchan == GSM_PCHAN_OSMO_DYN) - rate_match = true; - else if (full_rate && pchan == GSM_PCHAN_TCH_F) - rate_match = true; - else if (full_rate && pchan == GSM_PCHAN_TCH_F_PDCH) - rate_match = true; - else if (!full_rate && pchan == GSM_PCHAN_TCH_H) - rate_match = true; - } - } - if (!rate_match) + if (!test_codec_support_bts_rate(bts, full_rate)) return false; /* Check codec support */ -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/31544 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: Iea8a23ef3c66ed556110038fe9f3bc7f6eef3e96 Gerrit-Change-Number: 31544 Gerrit-PatchSet: 3 Gerrit-Owner: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
[M] Change in osmo-bsc[master]: bssmap_handle_ass_req_ct_speech: refactor
by osmith 01 Mar '23

01 Mar '23
osmith has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/31543 ) Change subject: bssmap_handle_ass_req_ct_speech: refactor ...................................................................... bssmap_handle_ass_req_ct_speech: refactor Move the translation from osmo_sockaddr_to_str_and_uint into bssmap_handle_ass_req_tp_rtp_addr, which will be used by bssmap_handle_ass_req_ct_data in a future patch too. Pass pointers to variables in req, instead of duplicating variables and filling it in later (like in bssmap_handle_ass_req_ct_sign). Related: OS#4393 Change-Id: I6bb16b26d89056dffa50bd8296fefe9315c587ca --- M src/osmo-bsc/osmo_bsc_bssap.c 1 file changed, 42 insertions(+), 34 deletions(-) Approvals: laforge: Looks good to me, approved pespin: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/src/osmo-bsc/osmo_bsc_bssap.c b/src/osmo-bsc/osmo_bsc_bssap.c index 1a7c56e..2c09ef0 100644 --- a/src/osmo-bsc/osmo_bsc_bssap.c +++ b/src/osmo-bsc/osmo_bsc_bssap.c @@ -814,10 +814,12 @@ return 0; } -static int bssmap_handle_ass_req_tp_rtp_addr(struct tlv_parsed *tp, bool aoip, struct sockaddr_storage *rtp_addr, - uint8_t *cause) +static int bssmap_handle_ass_req_tp_rtp_addr(struct tlv_parsed *tp, bool aoip, char *msc_rtp_addr, + size_t msc_rtp_addr_len, uint16_t *msc_rtp_port, uint8_t *cause) { + struct sockaddr_storage rtp_addr; int rc; + unsigned int rc2; if (TLVP_PRESENT(tp, GSM0808_IE_AOIP_TRASP_ADDR)) { if (!aoip) { @@ -827,7 +829,7 @@ return -1; } /* Decode AoIP transport address element */ - rc = gsm0808_dec_aoip_trasp_addr(rtp_addr, + rc = gsm0808_dec_aoip_trasp_addr(&rtp_addr, TLVP_VAL(tp, GSM0808_IE_AOIP_TRASP_ADDR), TLVP_LEN(tp, GSM0808_IE_AOIP_TRASP_ADDR)); if (rc < 0) { @@ -835,6 +837,14 @@ *cause = GSM0808_CAUSE_INCORRECT_VALUE; return -1; } + + rc2 = osmo_sockaddr_to_str_and_uint(msc_rtp_addr, msc_rtp_addr_len, msc_rtp_port, + (const struct sockaddr *)&rtp_addr); + if (!rc2 || rc >= msc_rtp_addr_len) { + LOGP(DMSC, LOGL_ERROR, "Assignment request: RTP address is too long\n"); + *cause = GSM0808_CAUSE_REQ_CODEC_TYPE_OR_CONFIG_UNAVAIL; + return -1; + } return 0; } @@ -918,33 +928,26 @@ struct gsm0808_channel_type *ct, struct assignment_request *req, uint8_t *cause) { - uint16_t cic = 0; bool aoip = gscon_is_aoip(conn); - bool use_osmux = false; - uint8_t osmux_cid = 0; - struct sockaddr_storage rtp_addr; int rc; - if (bssmap_handle_ass_req_tp_cic(tp, aoip, &cic, cause) < 0) - return -1; - - if (bssmap_handle_ass_req_tp_rtp_addr(tp, aoip, &rtp_addr, cause) < 0) - return -1; - - if (bssmap_handle_ass_req_tp_osmux(conn, tp, &use_osmux, &osmux_cid, cause) < 0) - return -1; - - if (bssmap_handle_ass_req_tp_codec_list(conn, tp, aoip, cause) < 0) - return -1; - *req = (struct assignment_request){ .assign_for = ASSIGN_FOR_BSSMAP_REQ, .aoip = aoip, - .msc_assigned_cic = cic, - .use_osmux = use_osmux, - .osmux_cid = osmux_cid, }; + if (bssmap_handle_ass_req_tp_cic(tp, aoip, &req->msc_assigned_cic, cause) < 0) + return -1; + + if (bssmap_handle_ass_req_tp_rtp_addr(tp, aoip, req->msc_rtp_addr, sizeof(req->msc_rtp_addr), &req->msc_rtp_port, cause) < 0) + return -1; + + if (bssmap_handle_ass_req_tp_osmux(conn, tp, &req->use_osmux, &req->osmux_cid, cause) < 0) + return -1; + + if (bssmap_handle_ass_req_tp_codec_list(conn, tp, aoip, cause) < 0) + return -1; + /* Match codec information from the assignment command against the * local preferences of the BSC and BTS */ rc = select_codecs(req, ct, conn); @@ -953,18 +956,6 @@ return -1; } - if (aoip) { - unsigned int rc = osmo_sockaddr_to_str_and_uint(req->msc_rtp_addr, - sizeof(req->msc_rtp_addr), - &req->msc_rtp_port, - (const struct sockaddr *)&rtp_addr); - if (!rc || rc >= sizeof(req->msc_rtp_addr)) { - LOGP(DMSC, LOGL_ERROR, "Assignment request: RTP address is too long\n"); - *cause = GSM0808_CAUSE_REQ_CODEC_TYPE_OR_CONFIG_UNAVAIL; - return -1; - } - } - return 0; } -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/31543 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: I6bb16b26d89056dffa50bd8296fefe9315c587ca Gerrit-Change-Number: 31543 Gerrit-PatchSet: 3 Gerrit-Owner: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
[L] Change in osmo-bsc[master]: bssmap_handle_assignm_req: split up
by osmith 01 Mar '23

01 Mar '23
osmith has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/31541 ) Change subject: bssmap_handle_assignm_req: split up ...................................................................... bssmap_handle_assignm_req: split up Prepare to implement GSM0808_CHAN_DATA without making this function even longer. Related: OS#4393 Change-Id: I8580e75e292cff1b52b6ba1bafd12c155c3bbe93 --- M src/osmo-bsc/osmo_bsc_bssap.c 1 file changed, 157 insertions(+), 123 deletions(-) Approvals: laforge: Looks good to me, approved pespin: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/src/osmo-bsc/osmo_bsc_bssap.c b/src/osmo-bsc/osmo_bsc_bssap.c index 6e78f47..d0ff1cf 100644 --- a/src/osmo-bsc/osmo_bsc_bssap.c +++ b/src/osmo-bsc/osmo_bsc_bssap.c @@ -796,6 +796,148 @@ return nc > 0 ? 0 : -EINVAL; } +static int bssmap_handle_ass_req_ct_speech(struct gsm_subscriber_connection *conn, struct tlv_parsed *tp, + struct gsm0808_channel_type *ct, struct assignment_request *req, + uint8_t *cause) +{ + uint16_t cic = 0; + bool aoip = gscon_is_aoip(conn); + bool use_osmux = false; + uint8_t osmux_cid = 0; + struct sockaddr_storage rtp_addr; + int rc; + + if (TLVP_PRESENT(tp, GSM0808_IE_CIRCUIT_IDENTITY_CODE)) { + /* CIC is permitted in both AoIP and SCCPlite */ + cic = osmo_load16be(TLVP_VAL(tp, GSM0808_IE_CIRCUIT_IDENTITY_CODE)); + } else { + if (!aoip) { + /* no CIC but SCCPlite: illegal */ + LOGP(DMSC, LOGL_ERROR, "SCCPlite MSC, but no CIC in ASSIGN REQ?\n"); + *cause = GSM0808_CAUSE_INFORMATION_ELEMENT_OR_FIELD_MISSING; + return -1; + } + } + if (TLVP_PRESENT(tp, GSM0808_IE_AOIP_TRASP_ADDR)) { + if (!aoip) { + /* SCCPlite and AoIP transport address: illegal */ + LOGP(DMSC, LOGL_ERROR, "AoIP Transport address over IPA ?!?\n"); + *cause = GSM0808_CAUSE_INCORRECT_VALUE; + return -1; + } + /* Decode AoIP transport address element */ + rc = gsm0808_dec_aoip_trasp_addr(&rtp_addr, + TLVP_VAL(tp, GSM0808_IE_AOIP_TRASP_ADDR), + TLVP_LEN(tp, GSM0808_IE_AOIP_TRASP_ADDR)); + if (rc < 0) { + LOGP(DMSC, LOGL_ERROR, "Unable to decode AoIP transport address.\n"); + *cause = GSM0808_CAUSE_INCORRECT_VALUE; + return -1; + } + } else if (aoip) { + /* no AoIP transport level address but AoIP transport: illegal */ + LOGP(DMSC, LOGL_ERROR, "AoIP transport address missing in ASSIGN REQ, " + "audio would not work; rejecting\n"); + *cause = GSM0808_CAUSE_INFORMATION_ELEMENT_OR_FIELD_MISSING; + return -1; + } + + if (TLVP_PRESENT(tp, GSM0808_IE_OSMO_OSMUX_CID)) { + if (conn->sccp.msc->use_osmux == OSMUX_USAGE_OFF) { + LOGP(DMSC, LOGL_ERROR, "MSC using Osmux but we have it disabled.\n"); + *cause = GSM0808_CAUSE_INCORRECT_VALUE; + return -1; + } + use_osmux = true; + rc = gsm0808_dec_osmux_cid(&osmux_cid, + TLVP_VAL(tp, GSM0808_IE_OSMO_OSMUX_CID), + TLVP_LEN(tp, GSM0808_IE_OSMO_OSMUX_CID)); + if (rc < 0) { + LOGP(DMSC, LOGL_ERROR, "Unable to decode Osmux CID.\n"); + *cause = GSM0808_CAUSE_INCORRECT_VALUE; + return -1; + } + } else { + if (conn->sccp.msc->use_osmux == OSMUX_USAGE_ONLY) { + LOGP(DMSC, LOGL_ERROR, "MSC not using Osmux but we are forced to use it.\n"); + *cause = GSM0808_CAUSE_INCORRECT_VALUE; + return -1; + } else if (conn->sccp.msc->use_osmux == OSMUX_USAGE_ON) + LOGP(DMSC, LOGL_NOTICE, "MSC not using Osmux but we have Osmux enabled.\n"); + } + + /* Decode speech codec list. First set len = 0. */ + conn->codec_list = (struct gsm0808_speech_codec_list){}; + /* Check for speech codec list element */ + if (TLVP_PRESENT(tp, GSM0808_IE_SPEECH_CODEC_LIST)) { + /* Decode Speech Codec list */ + rc = gsm0808_dec_speech_codec_list(&conn->codec_list, + TLVP_VAL(tp, GSM0808_IE_SPEECH_CODEC_LIST), + TLVP_LEN(tp, GSM0808_IE_SPEECH_CODEC_LIST)); + if (rc < 0) { + LOGP(DMSC, LOGL_ERROR, "Unable to decode speech codec list\n"); + *cause = GSM0808_CAUSE_INCORRECT_VALUE; + return -1; + } + } + + if (aoip && !conn->codec_list.len) { + LOGP(DMSC, LOGL_ERROR, "%s: AoIP speech mode Assignment Request:" + " Missing or empty Speech Codec List IE\n", bsc_subscr_name(conn->bsub)); + *cause = GSM0808_CAUSE_INFORMATION_ELEMENT_OR_FIELD_MISSING; + return -1; + } + + *req = (struct assignment_request){ + .assign_for = ASSIGN_FOR_BSSMAP_REQ, + .aoip = aoip, + .msc_assigned_cic = cic, + .use_osmux = use_osmux, + .osmux_cid = osmux_cid, + }; + + /* Match codec information from the assignment command against the + * local preferences of the BSC and BTS */ + rc = select_codecs(req, ct, conn); + if (rc < 0) { + *cause = GSM0808_CAUSE_REQ_CODEC_TYPE_OR_CONFIG_UNAVAIL; + return -1; + } + + if (aoip) { + unsigned int rc = osmo_sockaddr_to_str_and_uint(req->msc_rtp_addr, + sizeof(req->msc_rtp_addr), + &req->msc_rtp_port, + (const struct sockaddr *)&rtp_addr); + if (!rc || rc >= sizeof(req->msc_rtp_addr)) { + LOGP(DMSC, LOGL_ERROR, "Assignment request: RTP address is too long\n"); + *cause = GSM0808_CAUSE_REQ_CODEC_TYPE_OR_CONFIG_UNAVAIL; + return -1; + } + } + + return 0; +} + +static int bssmap_handle_ass_req_ct_sign(struct gsm_subscriber_connection *conn, struct gsm0808_channel_type *ct, + struct assignment_request *req, uint8_t *cause) +{ + int rc; + + *req = (struct assignment_request){ + .assign_for = ASSIGN_FOR_BSSMAP_REQ, + .aoip = gscon_is_aoip(conn), + }; + + rc = select_sign_chan(req, ct); + if (rc < 0) { + *cause = GSM0808_CAUSE_INCORRECT_VALUE; + return rc; + } + + return 0; +} + /* * Handle the assignment request message. * @@ -806,11 +948,6 @@ { struct msgb *resp; struct tlv_parsed tp; - uint16_t cic = 0; - bool aoip = false; - bool use_osmux = false; - uint8_t osmux_cid = 0; - struct sockaddr_storage rtp_addr; struct gsm0808_channel_type ct; uint8_t cause; int rc; @@ -822,8 +959,6 @@ return -1; } - aoip = gscon_is_aoip(conn); - if (osmo_bssap_tlv_parse(&tp, msg->l4h + 1, length - 1) < 0) { LOGPFSML(conn->fi, LOGL_ERROR, "%s(): tlv_parse() failed\n", __func__); return -1; @@ -855,126 +990,12 @@ cause = GSM0808_CAUSE_REQ_CODEC_TYPE_OR_CONFIG_NOT_SUPP; goto reject; case GSM0808_CHAN_SPEECH: - if (TLVP_PRESENT(&tp, GSM0808_IE_CIRCUIT_IDENTITY_CODE)) { - /* CIC is permitted in both AoIP and SCCPlite */ - cic = osmo_load16be(TLVP_VAL(&tp, GSM0808_IE_CIRCUIT_IDENTITY_CODE)); - } else { - if (!aoip) { - /* no CIC but SCCPlite: illegal */ - LOGP(DMSC, LOGL_ERROR, "SCCPlite MSC, but no CIC in ASSIGN REQ?\n"); - cause = GSM0808_CAUSE_INFORMATION_ELEMENT_OR_FIELD_MISSING; - goto reject; - } - } - if (TLVP_PRESENT(&tp, GSM0808_IE_AOIP_TRASP_ADDR)) { - if (!aoip) { - /* SCCPlite and AoIP transport address: illegal */ - LOGP(DMSC, LOGL_ERROR, "AoIP Transport address over IPA ?!?\n"); - cause = GSM0808_CAUSE_INCORRECT_VALUE; - goto reject; - } - /* Decode AoIP transport address element */ - rc = gsm0808_dec_aoip_trasp_addr(&rtp_addr, - TLVP_VAL(&tp, GSM0808_IE_AOIP_TRASP_ADDR), - TLVP_LEN(&tp, GSM0808_IE_AOIP_TRASP_ADDR)); - if (rc < 0) { - LOGP(DMSC, LOGL_ERROR, "Unable to decode AoIP transport address.\n"); - cause = GSM0808_CAUSE_INCORRECT_VALUE; - goto reject; - } - } else if (aoip) { - /* no AoIP transport level address but AoIP transport: illegal */ - LOGP(DMSC, LOGL_ERROR, "AoIP transport address missing in ASSIGN REQ, " - "audio would not work; rejecting\n"); - cause = GSM0808_CAUSE_INFORMATION_ELEMENT_OR_FIELD_MISSING; + if (bssmap_handle_ass_req_ct_speech(conn, &tp, &ct, &req, &cause) < 0) goto reject; - } - - if (TLVP_PRESENT(&tp, GSM0808_IE_OSMO_OSMUX_CID)) { - if (conn->sccp.msc->use_osmux == OSMUX_USAGE_OFF) { - LOGP(DMSC, LOGL_ERROR, "MSC using Osmux but we have it disabled.\n"); - cause = GSM0808_CAUSE_INCORRECT_VALUE; - goto reject; - } - use_osmux = true; - rc = gsm0808_dec_osmux_cid(&osmux_cid, - TLVP_VAL(&tp, GSM0808_IE_OSMO_OSMUX_CID), - TLVP_LEN(&tp, GSM0808_IE_OSMO_OSMUX_CID)); - if (rc < 0) { - LOGP(DMSC, LOGL_ERROR, "Unable to decode Osmux CID.\n"); - cause = GSM0808_CAUSE_INCORRECT_VALUE; - goto reject; - } - } else { - if (conn->sccp.msc->use_osmux == OSMUX_USAGE_ONLY) { - LOGP(DMSC, LOGL_ERROR, "MSC not using Osmux but we are forced to use it.\n"); - cause = GSM0808_CAUSE_INCORRECT_VALUE; - goto reject; - } else if (conn->sccp.msc->use_osmux == OSMUX_USAGE_ON) - LOGP(DMSC, LOGL_NOTICE, "MSC not using Osmux but we have Osmux enabled.\n"); - } - - /* Decode speech codec list. First set len = 0. */ - conn->codec_list = (struct gsm0808_speech_codec_list){}; - /* Check for speech codec list element */ - if (TLVP_PRESENT(&tp, GSM0808_IE_SPEECH_CODEC_LIST)) { - /* Decode Speech Codec list */ - rc = gsm0808_dec_speech_codec_list(&conn->codec_list, - TLVP_VAL(&tp, GSM0808_IE_SPEECH_CODEC_LIST), - TLVP_LEN(&tp, GSM0808_IE_SPEECH_CODEC_LIST)); - if (rc < 0) { - LOGP(DMSC, LOGL_ERROR, "Unable to decode speech codec list\n"); - cause = GSM0808_CAUSE_INCORRECT_VALUE; - goto reject; - } - } - - if (aoip && !conn->codec_list.len) { - LOGP(DMSC, LOGL_ERROR, "%s: AoIP speech mode Assignment Request:" - " Missing or empty Speech Codec List IE\n", bsc_subscr_name(conn->bsub)); - cause = GSM0808_CAUSE_INFORMATION_ELEMENT_OR_FIELD_MISSING; - goto reject; - } - - req = (struct assignment_request){ - .assign_for = ASSIGN_FOR_BSSMAP_REQ, - .aoip = aoip, - .msc_assigned_cic = cic, - .use_osmux = use_osmux, - .osmux_cid = osmux_cid, - }; - - /* Match codec information from the assignment command against the - * local preferences of the BSC and BTS */ - rc = select_codecs(&req, &ct, conn); - if (rc < 0) { - cause = GSM0808_CAUSE_REQ_CODEC_TYPE_OR_CONFIG_UNAVAIL; - goto reject; - } - - if (aoip) { - unsigned int rc = osmo_sockaddr_to_str_and_uint(req.msc_rtp_addr, - sizeof(req.msc_rtp_addr), - &req.msc_rtp_port, - (const struct sockaddr*)&rtp_addr); - if (!rc || rc >= sizeof(req.msc_rtp_addr)) { - LOGP(DMSC, LOGL_ERROR, "Assignment request: RTP address is too long\n"); - cause = GSM0808_CAUSE_REQ_CODEC_TYPE_OR_CONFIG_UNAVAIL; - goto reject; - } - } break; case GSM0808_CHAN_SIGN: - req = (struct assignment_request){ - .assign_for = ASSIGN_FOR_BSSMAP_REQ, - .aoip = aoip, - }; - - rc = select_sign_chan(&req, &ct); - if (rc < 0) { - cause = GSM0808_CAUSE_INCORRECT_VALUE; + if (bssmap_handle_ass_req_ct_sign(conn, &ct, &req, &cause) < 0) goto reject; - } break; default: cause = GSM0808_CAUSE_INVALID_MESSAGE_CONTENTS; -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/31541 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: I8580e75e292cff1b52b6ba1bafd12c155c3bbe93 Gerrit-Change-Number: 31541 Gerrit-PatchSet: 3 Gerrit-Owner: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
[M] Change in osmo-bsc[master]: bssmap_handle_ass_req_ct_speech: split up
by osmith 01 Mar '23

01 Mar '23
osmith has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/31542 ) Change subject: bssmap_handle_ass_req_ct_speech: split up ...................................................................... bssmap_handle_ass_req_ct_speech: split up Allow reusing common code in an upcoming bssmap_handle_ass_req_ct_data. It won't use _osmux for now (maybe in the future?), but splitting it out as well makes it consistent. Related: OS#4393 Change-Id: I4d9a4df314b1e56b9c1f90c9d7914332b70b56f8 --- M src/osmo-bsc/osmo_bsc_bssap.c 1 file changed, 92 insertions(+), 29 deletions(-) Approvals: laforge: Looks good to me, approved pespin: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/src/osmo-bsc/osmo_bsc_bssap.c b/src/osmo-bsc/osmo_bsc_bssap.c index d0ff1cf..1a7c56e 100644 --- a/src/osmo-bsc/osmo_bsc_bssap.c +++ b/src/osmo-bsc/osmo_bsc_bssap.c @@ -796,28 +796,29 @@ return nc > 0 ? 0 : -EINVAL; } -static int bssmap_handle_ass_req_ct_speech(struct gsm_subscriber_connection *conn, struct tlv_parsed *tp, - struct gsm0808_channel_type *ct, struct assignment_request *req, - uint8_t *cause) +static int bssmap_handle_ass_req_tp_cic(struct tlv_parsed *tp, bool aoip, uint16_t *cic, uint8_t *cause) { - uint16_t cic = 0; - bool aoip = gscon_is_aoip(conn); - bool use_osmux = false; - uint8_t osmux_cid = 0; - struct sockaddr_storage rtp_addr; - int rc; - if (TLVP_PRESENT(tp, GSM0808_IE_CIRCUIT_IDENTITY_CODE)) { /* CIC is permitted in both AoIP and SCCPlite */ - cic = osmo_load16be(TLVP_VAL(tp, GSM0808_IE_CIRCUIT_IDENTITY_CODE)); - } else { - if (!aoip) { - /* no CIC but SCCPlite: illegal */ - LOGP(DMSC, LOGL_ERROR, "SCCPlite MSC, but no CIC in ASSIGN REQ?\n"); - *cause = GSM0808_CAUSE_INFORMATION_ELEMENT_OR_FIELD_MISSING; - return -1; - } + *cic = osmo_load16be(TLVP_VAL(tp, GSM0808_IE_CIRCUIT_IDENTITY_CODE)); + return 0; } + + if (!aoip) { + /* no CIC but SCCPlite: illegal */ + LOGP(DMSC, LOGL_ERROR, "SCCPlite MSC, but no CIC in ASSIGN REQ?\n"); + *cause = GSM0808_CAUSE_INFORMATION_ELEMENT_OR_FIELD_MISSING; + return -1; + } + + return 0; +} + +static int bssmap_handle_ass_req_tp_rtp_addr(struct tlv_parsed *tp, bool aoip, struct sockaddr_storage *rtp_addr, + uint8_t *cause) +{ + int rc; + if (TLVP_PRESENT(tp, GSM0808_IE_AOIP_TRASP_ADDR)) { if (!aoip) { /* SCCPlite and AoIP transport address: illegal */ @@ -826,7 +827,7 @@ return -1; } /* Decode AoIP transport address element */ - rc = gsm0808_dec_aoip_trasp_addr(&rtp_addr, + rc = gsm0808_dec_aoip_trasp_addr(rtp_addr, TLVP_VAL(tp, GSM0808_IE_AOIP_TRASP_ADDR), TLVP_LEN(tp, GSM0808_IE_AOIP_TRASP_ADDR)); if (rc < 0) { @@ -834,7 +835,10 @@ *cause = GSM0808_CAUSE_INCORRECT_VALUE; return -1; } - } else if (aoip) { + return 0; + } + + if (aoip) { /* no AoIP transport level address but AoIP transport: illegal */ LOGP(DMSC, LOGL_ERROR, "AoIP transport address missing in ASSIGN REQ, " "audio would not work; rejecting\n"); @@ -842,14 +846,22 @@ return -1; } + return 0; +} + +static int bssmap_handle_ass_req_tp_osmux(struct gsm_subscriber_connection *conn, struct tlv_parsed *tp, + bool *use_osmux, uint8_t *osmux_cid, uint8_t *cause) +{ + int rc; + if (TLVP_PRESENT(tp, GSM0808_IE_OSMO_OSMUX_CID)) { if (conn->sccp.msc->use_osmux == OSMUX_USAGE_OFF) { LOGP(DMSC, LOGL_ERROR, "MSC using Osmux but we have it disabled.\n"); *cause = GSM0808_CAUSE_INCORRECT_VALUE; return -1; } - use_osmux = true; - rc = gsm0808_dec_osmux_cid(&osmux_cid, + *use_osmux = true; + rc = gsm0808_dec_osmux_cid(osmux_cid, TLVP_VAL(tp, GSM0808_IE_OSMO_OSMUX_CID), TLVP_LEN(tp, GSM0808_IE_OSMO_OSMUX_CID)); if (rc < 0) { @@ -857,15 +869,26 @@ *cause = GSM0808_CAUSE_INCORRECT_VALUE; return -1; } - } else { - if (conn->sccp.msc->use_osmux == OSMUX_USAGE_ONLY) { - LOGP(DMSC, LOGL_ERROR, "MSC not using Osmux but we are forced to use it.\n"); - *cause = GSM0808_CAUSE_INCORRECT_VALUE; - return -1; - } else if (conn->sccp.msc->use_osmux == OSMUX_USAGE_ON) - LOGP(DMSC, LOGL_NOTICE, "MSC not using Osmux but we have Osmux enabled.\n"); + return 0; } + if (conn->sccp.msc->use_osmux == OSMUX_USAGE_ONLY) { + LOGP(DMSC, LOGL_ERROR, "MSC not using Osmux but we are forced to use it.\n"); + *cause = GSM0808_CAUSE_INCORRECT_VALUE; + return -1; + } + + if (conn->sccp.msc->use_osmux == OSMUX_USAGE_ON) + LOGP(DMSC, LOGL_NOTICE, "MSC not using Osmux but we have Osmux enabled.\n"); + + return 0; +} + +static int bssmap_handle_ass_req_tp_codec_list(struct gsm_subscriber_connection *conn, struct tlv_parsed *tp, bool aoip, + uint8_t *cause) +{ + int rc; + /* Decode speech codec list. First set len = 0. */ conn->codec_list = (struct gsm0808_speech_codec_list){}; /* Check for speech codec list element */ @@ -888,6 +911,32 @@ return -1; } + return 0; +} + +static int bssmap_handle_ass_req_ct_speech(struct gsm_subscriber_connection *conn, struct tlv_parsed *tp, + struct gsm0808_channel_type *ct, struct assignment_request *req, + uint8_t *cause) +{ + uint16_t cic = 0; + bool aoip = gscon_is_aoip(conn); + bool use_osmux = false; + uint8_t osmux_cid = 0; + struct sockaddr_storage rtp_addr; + int rc; + + if (bssmap_handle_ass_req_tp_cic(tp, aoip, &cic, cause) < 0) + return -1; + + if (bssmap_handle_ass_req_tp_rtp_addr(tp, aoip, &rtp_addr, cause) < 0) + return -1; + + if (bssmap_handle_ass_req_tp_osmux(conn, tp, &use_osmux, &osmux_cid, cause) < 0) + return -1; + + if (bssmap_handle_ass_req_tp_codec_list(conn, tp, aoip, cause) < 0) + return -1; + *req = (struct assignment_request){ .assign_for = ASSIGN_FOR_BSSMAP_REQ, .aoip = aoip, -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/31542 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: I4d9a4df314b1e56b9c1f90c9d7914332b70b56f8 Gerrit-Change-Number: 31542 Gerrit-PatchSet: 3 Gerrit-Owner: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge(a)osmocom.org> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 358
  • 359
  • 360
  • 361
  • 362
  • 363
  • 364
  • 365
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.