Pau Espin Pedrol has uploaded this change for review. ( https://gerrit.osmocom.org/11791
Change subject: bsc: vty: Verify and warn on invalid arfcn passed ...................................................................... bsc: vty: Verify and warn on invalid arfcn passed Related: OS#3063 Depends: libosmocore Change-Id I780d452dcebce385469e32ef2fd844df6033393a Change-Id: Ib001501bf37289e824a1f72b62afde23892e88d2 --- M src/osmo-bsc/bsc_vty.c 1 file changed, 31 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/91/11791/1 diff --git a/src/osmo-bsc/bsc_vty.c b/src/osmo-bsc/bsc_vty.c index b9a5268..7537dbe 100644 --- a/src/osmo-bsc/bsc_vty.c +++ b/src/osmo-bsc/bsc_vty.c @@ -3111,6 +3111,7 @@ struct gsm_bts *bts = vty->index; struct bitvec *bv = &bts->si_common.neigh_list; uint16_t arfcn = atoi(argv[1]); + enum gsm_band unused; if (bts->neigh_list_manual_mode == NL_MODE_AUTOMATIC) { vty_out(vty, "%% Cannot configure neighbor list in " @@ -3118,6 +3119,11 @@ return CMD_WARNING; } + if (gsm_arfcn2band_rc(arfcn, &unused) < 0) { + vty_out(vty, "%% Invalid arfcn %" PRIu16 " detected%s", arfcn, VTY_NEWLINE); + return CMD_WARNING; + } + if (!strcmp(argv[0], "add")) bitvec_set_bit_pos(bv, arfcn, 1); else @@ -3254,6 +3260,7 @@ "Delete from SI5 manual neighbor list\n" "ARFCN of neighbor\n" "ARFCN of neighbor\n") { + enum gsm_band unused; struct gsm_bts *bts = vty->index; struct bitvec *bv = &bts->si_common.si5_neigh_list; uint16_t arfcn = atoi(argv[1]); @@ -3264,6 +3271,11 @@ return CMD_WARNING; } + if (gsm_arfcn2band_rc(arfcn, &unused) < 0) { + vty_out(vty, "%% Invalid arfcn %" PRIu16 " detected%s", arfcn, VTY_NEWLINE); + return CMD_WARNING; + } + if (!strcmp(argv[0], "add")) bitvec_set_bit_pos(bv, arfcn, 1); else @@ -3932,8 +3944,14 @@ "Set the ARFCN for this TRX\n" "Absolute Radio Frequency Channel Number\n") { - int arfcn = atoi(argv[0]); + enum gsm_band unused; struct gsm_bts_trx *trx = vty->index; + int arfcn = atoi(argv[0]); + + if (gsm_arfcn2band_rc(arfcn, &unused) < 0) { + vty_out(vty, "%% Invalid arfcn %" PRIu16 " detected%s", arfcn, VTY_NEWLINE); + return CMD_WARNING; + } /* FIXME: check if this ARFCN is supported by this TRX */ @@ -4181,9 +4199,15 @@ HOPPING_STR "Configure hopping ARFCN list\n" "Add an entry to the hopping ARFCN list\n" "ARFCN\n") { + enum gsm_band unused; struct gsm_bts_trx_ts *ts = vty->index; int arfcn = atoi(argv[0]); + if (gsm_arfcn2band_rc(arfcn, &unused) < 0) { + vty_out(vty, "%% Invalid arfcn %" PRIu16 " detected%s", arfcn, VTY_NEWLINE); + return CMD_WARNING; + } + bitvec_set_bit_pos(&ts->hopping.arfcns, arfcn, 1); return CMD_SUCCESS; @@ -4195,9 +4219,15 @@ HOPPING_STR "Configure hopping ARFCN list\n" "Delete an entry to the hopping ARFCN list\n" "ARFCN\n") { + enum gsm_band unused; struct gsm_bts_trx_ts *ts = vty->index; int arfcn = atoi(argv[0]); + if (gsm_arfcn2band_rc(arfcn, &unused) < 0) { + vty_out(vty, "%% Invalid arfcn %" PRIu16 " detected%s", arfcn, VTY_NEWLINE); + return CMD_WARNING; + } + bitvec_set_bit_pos(&ts->hopping.arfcns, arfcn, 0); return CMD_SUCCESS; -- To view, visit https://gerrit.osmocom.org/11791 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-MessageType: newchange Gerrit-Change-Id: Ib001501bf37289e824a1f72b62afde23892e88d2 Gerrit-Change-Number: 11791 Gerrit-PatchSet: 1 Gerrit-Owner: Pau Espin Pedrol <pes...@sysmocom.de>