From e2034e0283b785811e5f757b38f9603cd5e92443 Mon Sep 17 00:00:00 2001 From: Vadim Yanitskiy Date: Mon, 5 Apr 2021 02:12:43 +0200 Subject: [hopping] vty: ensure no duplicate hopping ARFCN entries Change-Id: Ie27c859e3f16ada08a5cdc8ab4ac6e20a885a378 --- src/osmo-bsc/bsc_vty.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/osmo-bsc/bsc_vty.c b/src/osmo-bsc/bsc_vty.c index 91eaee01d..6a6411f1a 100644 --- a/src/osmo-bsc/bsc_vty.c +++ b/src/osmo-bsc/bsc_vty.c @@ -5597,6 +5597,11 @@ DEFUN_USRATTR(cfg_ts_arfcn_add, return CMD_WARNING; } + if (bitvec_get_bit_pos(&ts->hopping.arfcns, arfcn) == ONE) { + vty_out(vty, "%% ARFCN %" PRIu16 " is already set%s", arfcn, VTY_NEWLINE); + return CMD_WARNING; + } + bitvec_set_bit_pos(&ts->hopping.arfcns, arfcn, 1); return CMD_SUCCESS; @@ -5618,6 +5623,11 @@ DEFUN_USRATTR(cfg_ts_arfcn_del, return CMD_WARNING; } + if (bitvec_get_bit_pos(&ts->hopping.arfcns, arfcn) != ONE) { + vty_out(vty, "%% ARFCN %" PRIu16 " is not set%s", arfcn, VTY_NEWLINE); + return CMD_WARNING; + } + bitvec_set_bit_pos(&ts->hopping.arfcns, arfcn, 0); return CMD_SUCCESS; -- cgit v1.2.3