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
[S] Change in osmo-bsc[master]: vty: improve doc for 'codec-list'
by fixeria 01 Mar '23

01 Mar '23
Attention is currently required from: neels. fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/31605 ) Change subject: vty: improve doc for 'codec-list' ...................................................................... Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/31605 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: I33e6568997bcb1a9466e1e0c1b00718b703e2904 Gerrit-Change-Number: 31605 Gerrit-PatchSet: 1 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de> Gerrit-Comment-Date: Wed, 01 Mar 2023 07:37:16 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
[S] Change in osmo-bsc[master]: examples: osmo-bsc-minimal.cfg: drop codec-list
by fixeria 01 Mar '23

01 Mar '23
Attention is currently required from: neels. fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/31601 ) Change subject: examples: osmo-bsc-minimal.cfg: drop codec-list ...................................................................... Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/31601 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: I01bee711f21023e2eab0688f45ff68f81afe1831 Gerrit-Change-Number: 31601 Gerrit-PatchSet: 1 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de> Gerrit-Comment-Date: Wed, 01 Mar 2023 07:35:35 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
[M] Change in osmo-bsc[master]: add msc.vty to test 'msc' / 'codec-list' cfg
by fixeria 01 Mar '23

01 Mar '23
Attention is currently required from: neels. fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/31602 ) Change subject: add msc.vty to test 'msc' / 'codec-list' cfg ...................................................................... Patch Set 1: Code-Review-1 (1 comment) Patchset: PS1: You need to add this new file to `EXTRA_DIST`. -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/31602 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: I04ce02dff7cadab826611bd6a0df5596a40578b5 Gerrit-Change-Number: 31602 Gerrit-PatchSet: 1 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de> Gerrit-Comment-Date: Wed, 01 Mar 2023 07:00:47 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
[S] Change in osmo-bsc[master]: cosmetic: use char literals in cfg_net_bsc_codec_list()
by fixeria 01 Mar '23

01 Mar '23
Attention is currently required from: neels. fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/31603 ) Change subject: cosmetic: use char literals in cfg_net_bsc_codec_list() ...................................................................... Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/31603 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: I1a29fb54cdcd15c6e9b6447d929db0e9492264f7 Gerrit-Change-Number: 31603 Gerrit-PatchSet: 1 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de> Gerrit-Comment-Date: Wed, 01 Mar 2023 06:46:49 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
[S] Change in osmo-bsc[master]: cosmetic: use i++ instead of ++i in for loop
by fixeria 01 Mar '23

01 Mar '23
Attention is currently required from: neels. fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/31604 ) Change subject: cosmetic: use i++ instead of ++i in for loop ...................................................................... Patch Set 1: Code-Review+1 (1 comment) Patchset: PS1: Not sure what's wrong with it, but ok. -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/31604 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: I9903e54e3eb59db9b9cd22e017bc81b9b86e01e9 Gerrit-Change-Number: 31604 Gerrit-PatchSet: 1 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de> Gerrit-Comment-Date: Wed, 01 Mar 2023 06:46:29 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
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
fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bsc/+/31617 ) Change subject: utils: fix incorrect string checks in meas_db_insert() ...................................................................... utils: fix incorrect string checks in meas_db_insert() Comparing an array to null is not useful, since the test will always evaluate as true (NO_EFFECT). Change-Id: I8a41078070119bc22d594c0dfff5d98b5d16f970 Fixes: fbead4327 utils: store more fields from meas-feed in db Fixes: CID#310821 --- M src/utils/meas_db.c 1 file changed, 17 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/17/31617/1 diff --git a/src/utils/meas_db.c b/src/utils/meas_db.c index 1b4f1f3..2f81524 100644 --- a/src/utils/meas_db.c +++ b/src/utils/meas_db.c @@ -94,19 +94,19 @@ SCK_OK(st->db, sqlite3_bind_int(st->stmt_ins_mr, 6, mfm->lchan_type)); SCK_OK(st->db, sqlite3_bind_int(st->stmt_ins_mr, 7, mfm->pchan_type)); - if (mfm->imsi) + if (mfm->imsi[0] != '\0') SCK_OK(st->db, sqlite3_bind_text(st->stmt_ins_mr, 8, mfm->imsi, -1, SQLITE_STATIC)); else SCK_OK(st->db, sqlite3_bind_null(st->stmt_ins_mr, 8)); - if (mfm->name) + if (mfm->name[0] != '\0') SCK_OK(st->db, sqlite3_bind_text(st->stmt_ins_mr, 9, mfm->name, -1, SQLITE_STATIC)); else SCK_OK(st->db, sqlite3_bind_null(st->stmt_ins_mr, 9)); - if (mfm->scenario) + if (mfm->scenario[0] != '\0') SCK_OK(st->db, sqlite3_bind_text(st->stmt_ins_mr, 10, mfm->scenario, -1, SQLITE_STATIC)); else -- 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-MessageType: newchange
1 0
0 0
[S] Change in osmo-bsc[master]: vty: msc / codec-list: tweak error msg
by neels 01 Mar '23

01 Mar '23
neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bsc/+/31608 ) Change subject: vty: msc / codec-list: tweak error msg ...................................................................... vty: msc / codec-list: tweak error msg Change-Id: I7ba508cceccb8a25db0936f756f3e4a28ec1333f --- M src/osmo-bsc/bsc_vty.c M tests/msc.vty 2 files changed, 10 insertions(+), 9 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/08/31608/1 diff --git a/src/osmo-bsc/bsc_vty.c b/src/osmo-bsc/bsc_vty.c index d0add0e..bba84e2 100644 --- a/src/osmo-bsc/bsc_vty.c +++ b/src/osmo-bsc/bsc_vty.c @@ -2752,7 +2752,7 @@ error: vty_out(vty, "Codec name must be hrX or frX. Was '%s'%s", argv[i], VTY_NEWLINE); - return CMD_ERR_INCOMPLETE; + return CMD_WARNING; } #define LEGACY_STR "This command has no effect, it is kept to support legacy config files\n" diff --git a/tests/msc.vty b/tests/msc.vty index 6edc846..56a3fe2 100644 --- a/tests/msc.vty +++ b/tests/msc.vty @@ -34,23 +34,15 @@ OsmoBSC(config-msc)# codec-list foo Codec name must be hrX or frX. Was 'foo' -% Command incomplete. -OsmoBSC(config-msc)# # ERROR: "Command incomplete" is not accurate OsmoBSC(config-msc)# codec-list fr10 Codec name must be hrX or frX. Was 'fr10' -% Command incomplete. -OsmoBSC(config-msc)# # ERROR: "Command incomplete" is not accurate OsmoBSC(config-msc)# codec-list hr10 Codec name must be hrX or frX. Was 'hr10' -% Command incomplete. -OsmoBSC(config-msc)# # ERROR: "Command incomplete" is not accurate OsmoBSC(config-msc)# codec-list FR1 Codec name must be hrX or frX. Was 'FR1' -% Command incomplete. -OsmoBSC(config-msc)# # ERROR: "Command incomplete" is not accurate OsmoBSC(config-msc)# # Ensure the codec-list with wrong args did not change the config OsmoBSC(config-msc)# show running-config -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/31608 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: I7ba508cceccb8a25db0936f756f3e4a28ec1333f Gerrit-Change-Number: 31608 Gerrit-PatchSet: 1 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[M] Change in osmo-bsc[master]: vty: msc / codec-list: forbid duplicate entries
by neels 01 Mar '23

01 Mar '23
neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bsc/+/31610 ) Change subject: vty: msc / codec-list: forbid duplicate entries ...................................................................... vty: msc / codec-list: forbid duplicate entries Change-Id: Ifdc9e04bf1d623da65bfb8a2fddea765601f6d9b --- M include/osmocom/bsc/gsm_data.h M src/osmo-bsc/bsc_vty.c M src/osmo-bsc/gsm_data.c M tests/msc.vty 4 files changed, 57 insertions(+), 23 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/10/31610/1 diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h index 8c4dcce..b2aa590 100644 --- a/include/osmocom/bsc/gsm_data.h +++ b/include/osmocom/bsc/gsm_data.h @@ -984,6 +984,8 @@ ver : 7; }; +int gsm_audio_support_cmp(const struct gsm_audio_support *a, const struct gsm_audio_support *b); + extern void talloc_ctx_init(void *ctx_root); enum gsm_bts_type parse_btstype(const char *arg); diff --git a/src/osmo-bsc/bsc_vty.c b/src/osmo-bsc/bsc_vty.c index bea85bb..fdb61e2 100644 --- a/src/osmo-bsc/bsc_vty.c +++ b/src/osmo-bsc/bsc_vty.c @@ -2711,42 +2711,50 @@ " (fr3: AMR-FR, hr3: AMR-HR, fr2: GSM-EFR, fr1: GSM-FR, hr1: GSM-HR)\n") { struct bsc_msc_data *data = bsc_msc_data(vty); + struct gsm_audio_support tmp[ARRAY_SIZE(data->audio_support)]; int i; - /* check all given arguments first */ - for (i = 0; i < argc; i++) { - /* check for hrX or frX */ - if (strlen(argv[i]) != 3 - || argv[i][1] != 'r' - || (argv[i][0] != 'h' && argv[i][0] != 'f') - || argv[i][2] < '0' - || argv[i][2] > '9') - goto error; - } - + /* Nr of arguments must fit in the array */ if (argc > ARRAY_SIZE(data->audio_support)) { vty_out(vty, "Too many items in 'msc' / 'codec-list': %d. There can be at most %d entries.%s", argc, (int)ARRAY_SIZE(data->audio_support), VTY_NEWLINE); return CMD_ERR_EXEED_ARGC_MAX; } - data->audio_length = argc; + /* check all given arguments first */ + for (i = 0; i < argc; i++) { + int j; - for (i = 0; i < argc; ++i) { - data->audio_support[i].ver = atoi(argv[i] + 2); + /* check for hrX or frX */ + if (strlen(argv[i]) != 3 + || argv[i][1] != 'r' + || (argv[i][0] != 'h' && argv[i][0] != 'f') + || argv[i][2] < '0' + || argv[i][2] > '9') { + vty_out(vty, "Codec name must be hrX or frX. Was '%s'%s", argv[i], VTY_NEWLINE); + return CMD_WARNING; + } + /* store in tmp[] first, to not overwrite data->audio_support[] in case of error */ + tmp[i].ver = atoi(argv[i] + 2); if (strncmp("hr", argv[i], 2) == 0) - data->audio_support[i].hr = 1; + tmp[i].hr = 1; else if (strncmp("fr", argv[i], 2) == 0) - data->audio_support[i].hr = 0; + tmp[i].hr = 0; + + /* prevent duplicate entries */ + for (j = 0; j < i; j++) { + if (gsm_audio_support_cmp(&tmp[j], &tmp[i]) == 0) { + vty_out(vty, "duplicate entry in 'msc' / 'codec-support': %s%s", argv[i], VTY_NEWLINE); + return CMD_WARNING; + } + } } - return CMD_SUCCESS; + memcpy(data->audio_support, tmp, sizeof(data->audio_support)); + data->audio_length = argc; -error: - vty_out(vty, "Codec name must be hrX or frX. Was '%s'%s", - argv[i], VTY_NEWLINE); - return CMD_WARNING; + return CMD_SUCCESS; } #define LEGACY_STR "This command has no effect, it is kept to support legacy config files\n" diff --git a/src/osmo-bsc/gsm_data.c b/src/osmo-bsc/gsm_data.c index 1562ea8..a682a32 100644 --- a/src/osmo-bsc/gsm_data.c +++ b/src/osmo-bsc/gsm_data.c @@ -1042,3 +1042,18 @@ return -EINVAL; } } + +int gsm_audio_support_cmp(const struct gsm_audio_support *a, const struct gsm_audio_support *b) +{ + int rc; + if (a == b) + return 0; + if (!a) + return -1; + if (!b) + return 1; + rc = OSMO_CMP(a->hr, b->hr); + if (rc) + return rc; + return OSMO_CMP(a->ver, b->ver); +} diff --git a/tests/msc.vty b/tests/msc.vty index af4c33e..8cbcb83 100644 --- a/tests/msc.vty +++ b/tests/msc.vty @@ -53,13 +53,13 @@ ... OsmoBSC(config-msc)# codec-list fr1 fr1 +duplicate entry in 'msc' / 'codec-support': fr1 OsmoBSC(config-msc)# show running-config ... msc 0 ... - codec-list fr1 fr1 + codec-list hr1 hr3 fr1 fr2 fr3 ... -OsmoBSC(config-msc)# # ERROR: duplicate entries make no sense OsmoBSC(config-msc)# codec-list fr0 fr1 OsmoBSC(config-msc)# show running-config -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/31610 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: Ifdc9e04bf1d623da65bfb8a2fddea765601f6d9b Gerrit-Change-Number: 31610 Gerrit-PatchSet: 1 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[S] Change in osmo-bsc[master]: vty: msc / codec-list: forbid invalid codec versions
by neels 01 Mar '23

01 Mar '23
neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bsc/+/31611 ) Change subject: vty: msc / codec-list: forbid invalid codec versions ...................................................................... vty: msc / codec-list: forbid invalid codec versions Change-Id: I421c306aa22dfdad0f30c6ba8b482e1eff188a8e --- M src/osmo-bsc/bsc_vty.c M tests/msc.vty 2 files changed, 26 insertions(+), 10 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/11/31611/1 diff --git a/src/osmo-bsc/bsc_vty.c b/src/osmo-bsc/bsc_vty.c index fdb61e2..91bfbe9 100644 --- a/src/osmo-bsc/bsc_vty.c +++ b/src/osmo-bsc/bsc_vty.c @@ -2742,6 +2742,13 @@ else if (strncmp("fr", argv[i], 2) == 0) tmp[i].hr = 0; + /* forbid invalid versions */ + if (tmp[i].ver < 1 || tmp[i].ver > 7 + || (tmp[i].hr && tmp[i].ver == 2)) { + vty_out(vty, "'%s' is not a valid codec version%s", argv[i], VTY_NEWLINE); + return CMD_WARNING; + } + /* prevent duplicate entries */ for (j = 0; j < i; j++) { if (gsm_audio_support_cmp(&tmp[j], &tmp[i]) == 0) { diff --git a/tests/msc.vty b/tests/msc.vty index 8cbcb83..74eca2a 100644 --- a/tests/msc.vty +++ b/tests/msc.vty @@ -62,49 +62,49 @@ ... OsmoBSC(config-msc)# codec-list fr0 fr1 +'fr0' is not a valid codec version OsmoBSC(config-msc)# show running-config ... msc 0 ... - codec-list fr0 fr1 + codec-list hr1 hr3 fr1 fr2 fr3 ... -OsmoBSC(config-msc)# # ERROR: fr0 should be rejected OsmoBSC(config-msc)# codec-list hr0 hr1 +'hr0' is not a valid codec version OsmoBSC(config-msc)# show running-config ... msc 0 ... - codec-list hr0 hr1 + codec-list hr1 hr3 fr1 fr2 fr3 ... -OsmoBSC(config-msc)# # ERROR: hr0 should be rejected OsmoBSC(config-msc)# codec-list fr8 fr9 +'fr8' is not a valid codec version OsmoBSC(config-msc)# show running-config ... msc 0 ... - codec-list fr8 fr9 + codec-list hr1 hr3 fr1 fr2 fr3 ... -OsmoBSC(config-msc)# # ERROR: fr8 and fr9 should be rejected OsmoBSC(config-msc)# codec-list hr8 hr9 +'hr8' is not a valid codec version OsmoBSC(config-msc)# show running-config ... msc 0 ... - codec-list hr8 hr9 + codec-list hr1 hr3 fr1 fr2 fr3 ... -OsmoBSC(config-msc)# # ERROR: hr8 and hr9 should be rejected OsmoBSC(config-msc)# codec-list fr2 hr2 +'hr2' is not a valid codec version OsmoBSC(config-msc)# show running-config ... msc 0 ... - codec-list fr2 hr2 + codec-list hr1 hr3 fr1 fr2 fr3 ... -OsmoBSC(config-msc)# # TODO: should hr2 be rejected OsmoBSC(config-msc)# codec-list fr1 fr2 fr3 fr4 OsmoBSC(config-msc)# show running-config -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/31611 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: I421c306aa22dfdad0f30c6ba8b482e1eff188a8e Gerrit-Change-Number: 31611 Gerrit-PatchSet: 1 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
[M] Change in osmo-bsc[master]: simplify storage of bsc_msc_data->audio_support
by neels 01 Mar '23

01 Mar '23
neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bsc/+/31609 ) Change subject: simplify storage of bsc_msc_data->audio_support ...................................................................... simplify storage of bsc_msc_data->audio_support Make it a plain array, no dynamic allocation needed. Change-Id: I625cedc4bb040d649fd6e1794ba468f4c6ad6adc --- M include/osmocom/bsc/bsc_msc_data.h M src/osmo-bsc/bsc_vty.c M src/osmo-bsc/codec_pref.c M src/osmo-bsc/osmo_bsc_msc.c M tests/codec_pref/codec_pref_test.c M tests/msc.vty 6 files changed, 87 insertions(+), 130 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/09/31609/1 diff --git a/include/osmocom/bsc/bsc_msc_data.h b/include/osmocom/bsc/bsc_msc_data.h index 3568716..31e9975 100644 --- a/include/osmocom/bsc/bsc_msc_data.h +++ b/include/osmocom/bsc/bsc_msc_data.h @@ -133,8 +133,13 @@ /* audio codecs */ struct gsm48_multi_rate_conf amr_conf; bool amr_octet_aligned; - struct gsm_audio_support **audio_support; + + /* Practically, there can be at most 5 entries in osmo-bsc: FR1 FR2 FR3 HR1 HR3. Historically, osmo-bsc allowed + * *any* number of entries -- we should not break too strictly on old cfg files. Theoretically, there should be + * room for FR1 to FR7 plus HR1 to HR7, i.e. 14. Let's just make it: */ + struct gsm_audio_support audio_support[16]; int audio_length; + enum bsc_lcls_mode lcls_mode; bool lcls_codec_mismatch_allow; diff --git a/src/osmo-bsc/bsc_vty.c b/src/osmo-bsc/bsc_vty.c index bba84e2..bea85bb 100644 --- a/src/osmo-bsc/bsc_vty.c +++ b/src/osmo-bsc/bsc_vty.c @@ -2550,10 +2550,10 @@ if (i != 0) vty_out(vty, " "); - if (msc->audio_support[i]->hr) - vty_out(vty, "hr%u", msc->audio_support[i]->ver); + if (msc->audio_support[i].hr) + vty_out(vty, "hr%u", msc->audio_support[i].ver); else - vty_out(vty, "fr%u", msc->audio_support[i]->ver); + vty_out(vty, "fr%u", msc->audio_support[i].ver); } vty_out(vty, "%s", VTY_NEWLINE); @@ -2724,27 +2724,21 @@ goto error; } - /* free the old list... if it exists */ - if (data->audio_support) { - talloc_free(data->audio_support); - data->audio_support = NULL; - data->audio_length = 0; + if (argc > ARRAY_SIZE(data->audio_support)) { + vty_out(vty, "Too many items in 'msc' / 'codec-list': %d. There can be at most %d entries.%s", + argc, (int)ARRAY_SIZE(data->audio_support), VTY_NEWLINE); + return CMD_ERR_EXEED_ARGC_MAX; } - /* create a new array */ - data->audio_support = - talloc_zero_array(bsc_gsmnet, struct gsm_audio_support *, argc); data->audio_length = argc; for (i = 0; i < argc; ++i) { - data->audio_support[i] = talloc_zero(data->audio_support, - struct gsm_audio_support); - data->audio_support[i]->ver = atoi(argv[i] + 2); + data->audio_support[i].ver = atoi(argv[i] + 2); if (strncmp("hr", argv[i], 2) == 0) - data->audio_support[i]->hr = 1; + data->audio_support[i].hr = 1; else if (strncmp("fr", argv[i], 2) == 0) - data->audio_support[i]->hr = 0; + data->audio_support[i].hr = 0; } return CMD_SUCCESS; diff --git a/src/osmo-bsc/codec_pref.c b/src/osmo-bsc/codec_pref.c index a64425a..dc29a5a 100644 --- a/src/osmo-bsc/codec_pref.c +++ b/src/osmo-bsc/codec_pref.c @@ -333,7 +333,7 @@ * indeed available with the current BTS and MSC configuration */ for (i = 0; i < msc->audio_length; i++) { /* Pick a permitted speech value from the global codec configuration list */ - perm_spch = audio_support_to_gsm88(msc->audio_support[i]); + perm_spch = audio_support_to_gsm88(&msc->audio_support[i]); /* Determine if the result is a half or full rate codec */ rc = full_rate_from_perm_spch(&full_rate, perm_spch); @@ -404,7 +404,7 @@ for (i = 0; i < msc->audio_length; i++) { /* Pick a permitted speech value from the global codec configuration list */ - perm_spch = audio_support_to_gsm88(msc->audio_support[i]); + perm_spch = audio_support_to_gsm88(&msc->audio_support[i]); /* Check this permitted speech value against the BTS specific parameters. * if the BTS does not support the codec, try the next one */ @@ -419,8 +419,8 @@ /* AMR (HR/FR version 3) is the only codec that requires a codec * configuration (S0-S15). Determine the current configuration and update * the cfg flag. */ - if (msc->audio_support[i]->ver == 3) - scl->codec[scl->len].cfg = gen_bss_supported_amr_s15_s0(msc, bts, msc->audio_support[i]->hr); + if (msc->audio_support[i].ver == 3) + scl->codec[scl->len].cfg = gen_bss_supported_amr_s15_s0(msc, bts, msc->audio_support[i].hr); scl->len++; } diff --git a/src/osmo-bsc/osmo_bsc_msc.c b/src/osmo-bsc/osmo_bsc_msc.c index 4d5d5b2..08a2466 100644 --- a/src/osmo-bsc/osmo_bsc_msc.c +++ b/src/osmo-bsc/osmo_bsc_msc.c @@ -207,7 +207,6 @@ struct bsc_msc_data *osmo_msc_data_alloc(struct gsm_network *net, int nr) { struct bsc_msc_data *msc_data; - unsigned int i; /* check if there is already one */ msc_data = osmo_msc_data_find(net, nr); @@ -251,24 +250,16 @@ /* Allow the full set of possible codecs by default */ msc_data->audio_length = 5; - msc_data->audio_support = - talloc_zero_array(msc_data, struct gsm_audio_support *, - msc_data->audio_length); - for (i = 0; i < msc_data->audio_length; i++) { - msc_data->audio_support[i] = - talloc_zero(msc_data->audio_support, - struct gsm_audio_support); - } - msc_data->audio_support[0]->ver = 1; - msc_data->audio_support[0]->hr = 0; - msc_data->audio_support[1]->ver = 1; - msc_data->audio_support[1]->hr = 1; - msc_data->audio_support[2]->ver = 2; - msc_data->audio_support[2]->hr = 0; - msc_data->audio_support[3]->ver = 3; - msc_data->audio_support[3]->hr = 0; - msc_data->audio_support[4]->ver = 3; - msc_data->audio_support[4]->hr = 1; + msc_data->audio_support[0].ver = 1; + msc_data->audio_support[0].hr = 0; + msc_data->audio_support[1].ver = 1; + msc_data->audio_support[1].hr = 1; + msc_data->audio_support[2].ver = 2; + msc_data->audio_support[2].hr = 0; + msc_data->audio_support[3].ver = 3; + msc_data->audio_support[3].hr = 0; + msc_data->audio_support[4].ver = 3; + msc_data->audio_support[4].hr = 1; osmo_fd_setup(&msc_data->mgcp_ipa.ofd, -1, OSMO_FD_READ, &bsc_sccplite_mgcp_proxy_cb, msc_data, 0); msc_data->mgcp_ipa.local_addr = NULL; /* = INADDR(6)_ANY */ diff --git a/tests/codec_pref/codec_pref_test.c b/tests/codec_pref/codec_pref_test.c index 5f4c831..920352c 100644 --- a/tests/codec_pref/codec_pref_test.c +++ b/tests/codec_pref/codec_pref_test.c @@ -30,27 +30,8 @@ void *ctx = NULL; -#define MSC_AUDIO_SUPPORT_MAX 5 #define N_CONFIG_VARIANTS 9 -/* Make sure that there is some memory to put our test configuration. */ -static void init_msc_config(struct bsc_msc_data *msc) -{ - unsigned int i; - - msc->audio_support = talloc_zero_array(ctx, struct gsm_audio_support *, MSC_AUDIO_SUPPORT_MAX); - msc->audio_length = MSC_AUDIO_SUPPORT_MAX; - for (i = 0; i < MSC_AUDIO_SUPPORT_MAX; i++) { - msc->audio_support[i] = talloc_zero(msc->audio_support, struct gsm_audio_support); - } -} - -/* Free memory that we have used for the test configuration. */ -static void free_msc_config(struct bsc_msc_data *msc) -{ - talloc_free(msc->audio_support); -} - /* The speech codec list is sent by the MS and lists the voice codec settings * that the MS is able to support. The BSC must select one of this codecs * depending on what the MSC is able to support. The following function @@ -215,74 +196,74 @@ switch (config_no) { case 0: /* FR1 only */ - msc->audio_support[0]->ver = 1; - msc->audio_support[0]->hr = 0; + msc->audio_support[0].ver = 1; + msc->audio_support[0].hr = 0; msc->audio_length = 1; break; case 1: /* HR1 only */ - msc->audio_support[0]->ver = 1; - msc->audio_support[0]->hr = 1; + msc->audio_support[0].ver = 1; + msc->audio_support[0].hr = 1; msc->audio_length = 1; break; case 2: /* FR2 only */ - msc->audio_support[0]->ver = 2; - msc->audio_support[0]->hr = 0; + msc->audio_support[0].ver = 2; + msc->audio_support[0].hr = 0; msc->audio_length = 1; break; case 3: /* FR3 only */ - msc->audio_support[0]->ver = 3; - msc->audio_support[0]->hr = 0; + msc->audio_support[0].ver = 3; + msc->audio_support[0].hr = 0; msc->audio_length = 1; break; case 4: /* HR3 only */ - msc->audio_support[0]->ver = 3; - msc->audio_support[0]->hr = 1; + msc->audio_support[0].ver = 3; + msc->audio_support[0].hr = 1; msc->audio_length = 1; break; case 5: /* FR1 and HR1 */ - msc->audio_support[0]->ver = 1; - msc->audio_support[0]->hr = 0; - msc->audio_support[1]->ver = 1; - msc->audio_support[1]->hr = 1; + msc->audio_support[0].ver = 1; + msc->audio_support[0].hr = 0; + msc->audio_support[1].ver = 1; + msc->audio_support[1].hr = 1; msc->audio_length = 2; break; case 6: /* FR1, FR2 and HR1 */ - msc->audio_support[0]->ver = 1; - msc->audio_support[0]->hr = 0; - msc->audio_support[1]->ver = 2; - msc->audio_support[1]->hr = 0; - msc->audio_support[2]->ver = 1; - msc->audio_support[2]->hr = 1; + msc->audio_support[0].ver = 1; + msc->audio_support[0].hr = 0; + msc->audio_support[1].ver = 2; + msc->audio_support[1].hr = 0; + msc->audio_support[2].ver = 1; + msc->audio_support[2].hr = 1; msc->audio_length = 3; break; case 7: /* FR1, FR3 and HR3 */ - msc->audio_support[0]->ver = 1; - msc->audio_support[0]->hr = 0; - msc->audio_support[1]->ver = 3; - msc->audio_support[1]->hr = 0; - msc->audio_support[2]->ver = 3; - msc->audio_support[2]->hr = 1; + msc->audio_support[0].ver = 1; + msc->audio_support[0].hr = 0; + msc->audio_support[1].ver = 3; + msc->audio_support[1].hr = 0; + msc->audio_support[2].ver = 3; + msc->audio_support[2].hr = 1; msc->audio_length = 3; break; case 8: /* FR1, FR2, FR3, HR1 and HR3 */ - msc->audio_support[0]->ver = 1; - msc->audio_support[0]->hr = 0; - msc->audio_support[1]->ver = 2; - msc->audio_support[1]->hr = 0; - msc->audio_support[2]->ver = 3; - msc->audio_support[2]->hr = 0; - msc->audio_support[3]->ver = 1; - msc->audio_support[3]->hr = 1; - msc->audio_support[4]->ver = 3; - msc->audio_support[4]->hr = 1; + msc->audio_support[0].ver = 1; + msc->audio_support[0].hr = 0; + msc->audio_support[1].ver = 2; + msc->audio_support[1].hr = 0; + msc->audio_support[2].ver = 3; + msc->audio_support[2].hr = 0; + msc->audio_support[3].ver = 1; + msc->audio_support[3].hr = 1; + msc->audio_support[4].ver = 3; + msc->audio_support[4].hr = 1; msc->audio_length = 5; break; } @@ -394,10 +375,10 @@ printf(" * BSS: audio support settings (%u items):\n", msc->audio_length); for (i = 0; i < msc->audio_length; i++) - if (msc->audio_support[i]->hr) - printf(" audio_support[%u]=HR%u\n", i, msc->audio_support[i]->ver); + if (msc->audio_support[i].hr) + printf(" audio_support[%u]=HR%u\n", i, msc->audio_support[i].ver); else - printf(" audio_support[%u]=FR%u\n", i, msc->audio_support[i]->ver); + printf(" audio_support[%u]=FR%u\n", i, msc->audio_support[i].ver); printf(" * BTS: audio support settings:\n"); printf(" (GSM-FR implicitly supported)\n"); @@ -426,8 +407,6 @@ printf("============== test_one_to_one ==============\n\n"); - init_msc_config(&msc_local); - for (i = 0; i < N_CONFIG_VARIANTS; i++) { make_msc_config(&msc_local, i); make_scl_config(&scl_ms, i); @@ -436,8 +415,6 @@ rc = test_match_codec_pref(&ct_msc, &scl_ms, &msc_local, &bts_local); OSMO_ASSERT(rc == 0); } - - free_msc_config(&msc_local); } /* Network supports all combinations, MS varies */ @@ -452,8 +429,6 @@ printf("============== test_ms ==============\n\n"); - init_msc_config(&msc_local); - make_msc_config(&msc_local, 8); make_ct_config(&ct_msc, 8); make_bts_config(&bts_local, 8); @@ -462,8 +437,6 @@ rc = test_match_codec_pref(&ct_msc, &scl_ms, &msc_local, &bts_local); OSMO_ASSERT(rc == 0); } - - free_msc_config(&msc_local); } /* BSS and MS support all combinations, MSC varies */ @@ -478,8 +451,6 @@ printf("============== test_ct ==============\n\n"); - init_msc_config(&msc_local); - make_msc_config(&msc_local, 8); make_scl_config(&scl_ms, 8); make_bts_config(&bts_local, 8); @@ -488,8 +459,6 @@ rc = test_match_codec_pref(&ct_msc, &scl_ms, &msc_local, &bts_local); OSMO_ASSERT(rc == 0); } - - free_msc_config(&msc_local); } /* MSC and MS support all combinations, BSS varies */ @@ -504,8 +473,6 @@ printf("============== test_msc ==============\n\n"); - init_msc_config(&msc_local); - make_ct_config(&ct_msc, 8); make_scl_config(&scl_ms, 8); make_bts_config(&bts_local, 8); @@ -514,8 +481,6 @@ rc = test_match_codec_pref(&ct_msc, &scl_ms, &msc_local, &bts_local); OSMO_ASSERT(rc == 0); } - - free_msc_config(&msc_local); } /* Some mixed configurations that are supposed to work */ @@ -529,8 +494,6 @@ printf("============== test_selected_working ==============\n\n"); - init_msc_config(&msc_local); - make_scl_config(&scl_ms, 6); make_ct_config(&ct_msc, 5); make_msc_config(&msc_local, 7); @@ -572,8 +535,6 @@ make_bts_config(&bts_local, 1); rc = test_match_codec_pref(&ct_msc, &scl_ms, &msc_local, &bts_local); OSMO_ASSERT(rc == 0); - - free_msc_config(&msc_local); } /* Some mixed configurations that can not work */ @@ -587,8 +548,6 @@ printf("============== test_selected_non_working ==============\n\n"); - init_msc_config(&msc_local); - make_scl_config(&scl_ms, 1); make_ct_config(&ct_msc, 5); make_msc_config(&msc_local, 7); @@ -630,8 +589,6 @@ make_bts_config(&bts_local, 7); rc = test_match_codec_pref(&ct_msc, &scl_ms, &msc_local, &bts_local); OSMO_ASSERT(rc == -1); - - free_msc_config(&msc_local); } /* Try execute bss_supp_codec_list(), display input and output parameters */ @@ -644,10 +601,10 @@ printf(" * BSS: audio support settings (%u items):\n", msc->audio_length); for (i = 0; i < msc->audio_length; i++) - if (msc->audio_support[i]->hr) - printf(" audio_support[%u]=HR%u\n", i, msc->audio_support[i]->ver); + if (msc->audio_support[i].hr) + printf(" audio_support[%u]=HR%u\n", i, msc->audio_support[i].ver); else - printf(" audio_support[%u]=FR%u\n", i, msc->audio_support[i]->ver); + printf(" audio_support[%u]=FR%u\n", i, msc->audio_support[i].ver); printf(" * BTS: audio support settings:\n"); printf(" (GSM-FR implicitly supported)\n"); @@ -660,7 +617,7 @@ printf(" * result: speech codec list (%u items):\n", scl.len); for (i = 0; i < scl.len; i++) { printf(" codec[%u]->type=%s", i, gsm0808_speech_codec_type_name(scl.codec[i].type)); - if (msc->audio_support[i]->ver == 3) + if (msc->audio_support[i].ver == 3) printf(" S15-S0=%04x", scl.codec[i].cfg); printf("\n"); } @@ -676,8 +633,6 @@ uint8_t k; printf("============== test_gen_bss_supp_codec_list_cfgs ==============\n\n"); - init_msc_config(&msc_local); - for (i = 0; i < N_CONFIG_VARIANTS; i++) { for (k = 0; k < N_CONFIG_VARIANTS; k++) { make_msc_config(&msc_local, i); @@ -686,8 +641,6 @@ test_gen_bss_supported_codec_list(&msc_local, &bts_local); } } - - free_msc_config(&msc_local); } static const struct log_info_cat log_categories[] = { diff --git a/tests/msc.vty b/tests/msc.vty index 56a3fe2..af4c33e 100644 --- a/tests/msc.vty +++ b/tests/msc.vty @@ -114,3 +114,6 @@ codec-list fr1 fr2 fr3 fr4 ... OsmoBSC(config-msc)# # TODO: should fr4 thru fr7 be rejected + +OsmoBSC(config-msc)# codec-list fr1 fr1 fr1 fr1 fr1 fr1 fr1 fr1 fr1 fr1 fr1 fr1 fr1 fr1 fr1 fr1 fr1 +Too many items in 'msc' / 'codec-list': 17. There can be at most 16 entries. -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/31609 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: I625cedc4bb040d649fd6e1794ba468f4c6ad6adc Gerrit-Change-Number: 31609 Gerrit-PatchSet: 1 Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 360
  • 361
  • 362
  • 363
  • 364
  • 365
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.