nat: Verify that the configured LACs are unique across the nat

This commit is contained in:
Holger Hans Peter Freyther
2010-03-30 06:08:56 +02:00
parent bae9da49b9
commit 39ee87783f

View File

@@ -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;