bsc: vty: Verify and warn on invalid arfcn passed
Related: OS#3063 Depends: libosmocore Change-Id I780d452dcebce385469e32ef2fd844df6033393a Change-Id: Ib001501bf37289e824a1f72b62afde23892e88d2
This commit is contained in:
parent
89f3a3347f
commit
33ca61346f
|
@ -3114,6 +3114,7 @@ DEFUN(cfg_bts_neigh, cfg_bts_neigh_cmd,
|
|||
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 "
|
||||
|
@ -3121,6 +3122,11 @@ DEFUN(cfg_bts_neigh, cfg_bts_neigh_cmd,
|
|||
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
|
||||
|
@ -3257,6 +3263,7 @@ DEFUN(cfg_bts_si5_neigh, cfg_bts_si5_neigh_cmd,
|
|||
"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]);
|
||||
|
@ -3267,6 +3274,11 @@ DEFUN(cfg_bts_si5_neigh, cfg_bts_si5_neigh_cmd,
|
|||
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
|
||||
|
@ -3937,8 +3949,14 @@ DEFUN(cfg_trx_arfcn,
|
|||
"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 */
|
||||
|
||||
|
@ -4186,9 +4204,15 @@ DEFUN(cfg_ts_arfcn_add,
|
|||
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;
|
||||
|
@ -4200,9 +4224,15 @@ DEFUN(cfg_ts_arfcn_del,
|
|||
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;
|
||||
|
|
Loading…
Reference in New Issue