nat: For debugging make it possible to set the last used endpoint

This will influence the allocator from where to search for the
next free endpoint. This can be used to force it to allocate a
specific endpoint next.
This commit is contained in:
Holger Hans Peter Freyther 2011-02-28 01:07:13 +01:00
parent 9212d9d636
commit dfdf8d929a
1 changed files with 27 additions and 0 deletions

View File

@ -690,6 +690,31 @@ DEFUN(test_regex, test_regex_cmd,
return CMD_SUCCESS;
}
DEFUN(set_last_endp, set_last_endp_cmd,
"set bsc last-used-endpoint <0-9999999999> <0-1024>",
"Set a value\n" "Operate on a BSC\n"
"Last used endpoint for an assignment\n" "BSC configuration number\n"
"Endpoint number used\n")
{
struct bsc_connection *con;
int nr = atoi(argv[0]);
int endp = atoi(argv[1]);
llist_for_each_entry(con, &_nat->bsc_connections, list_entry) {
if (!con->cfg)
continue;
if (con->cfg->nr != nr)
continue;
con->last_endpoint = endp;
vty_out(vty, "Updated the last endpoint for %d to %d.%s",
con->cfg->nr, con->last_endpoint, VTY_NEWLINE);
}
return CMD_SUCCESS;
}
int bsc_nat_vty_init(struct bsc_nat *nat)
{
_nat = nat;
@ -706,6 +731,8 @@ int bsc_nat_vty_init(struct bsc_nat *nat)
install_element_ve(&show_bsc_mgcp_cmd);
install_element_ve(&show_acc_lst_cmd);
install_element(ENABLE_NODE, &set_last_endp_cmd);
/* nat group */
install_element(CONFIG_NODE, &cfg_nat_cmd);
install_node(&nat_node, config_write_nat);