mirror of
https://gitea.osmocom.org/cellular-infrastructure/osmo-mgw.git
synced 2025-10-23 08:12:01 +00:00
nat: Verify that the configured LACs are unique across the nat
This commit is contained in:
@@ -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;
|
||||
|
Reference in New Issue
Block a user