aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-03-30 06:08:56 +0200
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-03-30 06:08:56 +0200
commitd906a366c82dbd5777a885c17f0de1c92c37a541 (patch)
tree8c8875f204a21b0831b2a7e2707e887d51e0f1bc
parentd44d4c8c8b9b751f60b10dcac37e05a31ccddc88 (diff)
nat: Verify that the configured LACs are unique across the nat
-rw-r--r--openbsc/src/nat/bsc_nat_vty.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/openbsc/src/nat/bsc_nat_vty.c b/openbsc/src/nat/bsc_nat_vty.c
index 695903775..6dae0d65c 100644
--- a/openbsc/src/nat/bsc_nat_vty.c
+++ b/openbsc/src/nat/bsc_nat_vty.c
@@ -154,6 +154,7 @@ DEFUN(cfg_bsc_token, cfg_bsc_token_cmd, "token TOKEN", "Set the token")
DEFUN(cfg_bsc_lac, cfg_bsc_lac_cmd, "location_area_code <0-65535>",
"Set the Location Area Code (LAC) of this BSC\n")
{
+ struct bsc_config *tmp;
struct bsc_config *conf = vty->index;
int lac = atoi(argv[0]);
@@ -170,6 +171,14 @@ DEFUN(cfg_bsc_lac, cfg_bsc_lac_cmd, "location_area_code <0-65535>",
return CMD_WARNING;
}
+ /* verify that the LACs are unique */
+ llist_for_each_entry(tmp, &_nat->bsc_configs, entry) {
+ if (tmp->lac == lac) {
+ vty_out(vty, "%% LAC %d is already used.%s", lac, VTY_NEWLINE);
+ return CMD_ERR_INCOMPLETE;
+ }
+ }
+
conf->lac = lac;
return CMD_SUCCESS;