aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2011-02-28 01:07:13 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2011-02-28 19:40:46 +0100
commitdfdf8d929a77976e099e60869b509ad7fa88d79e (patch)
tree3d8cb87a7fea706eb20fe5e0a36d275d47563d4e /openbsc
parent9212d9d6364cfcd0ecd9255b9efaf03782bdf630 (diff)
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.
Diffstat (limited to 'openbsc')
-rw-r--r--openbsc/src/nat/bsc_nat_vty.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/openbsc/src/nat/bsc_nat_vty.c b/openbsc/src/nat/bsc_nat_vty.c
index 761c2994..786db2dc 100644
--- a/openbsc/src/nat/bsc_nat_vty.c
+++ b/openbsc/src/nat/bsc_nat_vty.c
@@ -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);