aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2011-02-25 20:38:15 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2011-02-26 10:42:01 +0100
commit7b07b2dcff72aa302b093beb3942c592b5103b91 (patch)
treef04741d1482d5ced08daf33c8107f7c0fe7add50 /openbsc
parent86c1db63387bd0dde439a6625c40e9e653b1cf4d (diff)
nat: Start making the number of multiplexes configurable
Introduce a VTY setting that right now needs to be set to one. To make updating this setting possible we will now store the number of endpoints in the bsc connection as well.
Diffstat (limited to 'openbsc')
-rw-r--r--openbsc/include/openbsc/bsc_nat.h1
-rw-r--r--openbsc/src/nat/bsc_mgcp_utils.c3
-rw-r--r--openbsc/src/nat/bsc_nat_vty.c14
3 files changed, 16 insertions, 2 deletions
diff --git a/openbsc/include/openbsc/bsc_nat.h b/openbsc/include/openbsc/bsc_nat.h
index 13d1b09f2..49213a5ed 100644
--- a/openbsc/include/openbsc/bsc_nat.h
+++ b/openbsc/include/openbsc/bsc_nat.h
@@ -79,6 +79,7 @@ struct bsc_connection {
/* mgcp related code */
char *_endpoint_status;
+ int number_endpoints;
int last_endpoint;
/* a back pointer */
diff --git a/openbsc/src/nat/bsc_mgcp_utils.c b/openbsc/src/nat/bsc_mgcp_utils.c
index d814f0dc3..f00292645 100644
--- a/openbsc/src/nat/bsc_mgcp_utils.c
+++ b/openbsc/src/nat/bsc_mgcp_utils.c
@@ -48,6 +48,7 @@ static int bsc_init_endps_if_needed(struct bsc_connection *con)
if (!con->cfg)
return -1;
+ con->number_endpoints = 31 * con->cfg->number_multiplexes;
con->_endpoint_status = talloc_zero_array(con, char,
(32 * con->cfg->number_multiplexes) + 1);
return con->_endpoint_status == NULL;
@@ -55,7 +56,7 @@ static int bsc_init_endps_if_needed(struct bsc_connection *con)
static int bsc_assign_endpoint(struct bsc_connection *bsc, struct sccp_connections *con)
{
- const int number_endpoints = 31 * bsc->cfg->number_multiplexes;
+ const int number_endpoints = bsc->number_endpoints;
int i;
for (i = 1; i <= number_endpoints; ++i) {
diff --git a/openbsc/src/nat/bsc_nat_vty.c b/openbsc/src/nat/bsc_nat_vty.c
index 01bee7489..2aefe9b25 100644
--- a/openbsc/src/nat/bsc_nat_vty.c
+++ b/openbsc/src/nat/bsc_nat_vty.c
@@ -113,6 +113,7 @@ static void config_write_bsc_single(struct vty *vty, struct bsc_config *bsc)
vty_out(vty, " description %s%s", bsc->description, VTY_NEWLINE);
if (bsc->acc_lst_name)
vty_out(vty, " access-list-name %s%s", bsc->acc_lst_name, VTY_NEWLINE);
+ vty_out(vty, " number-multiplexes %d%s", bsc->number_multiplexes, VTY_NEWLINE);
}
static int config_write_bsc(struct vty *vty)
@@ -183,7 +184,7 @@ DEFUN(show_bsc_mgcp, show_bsc_mgcp_cmd, "show bsc mgcp NR",
continue;
vty_out(vty, "MGCP Status for %d%s", con->cfg->nr, VTY_NEWLINE);
- endpoints = 31 * con->cfg->number_multiplexes;
+ endpoints = con->number_endpoints;
for (i = 1; i <= endpoints; ++i)
vty_out(vty, " Endpoint 0x%x %s%s", i,
con->_endpoint_status[i] == 0 ? "free" : "allocated",
@@ -630,6 +631,16 @@ DEFUN(cfg_bsc_acc_lst_name,
return CMD_SUCCESS;
}
+DEFUN(cfg_bsc_nr_multip, cfg_bsc_nr_multip_cmd,
+ "number-multiplexes <1-1>",
+ "Number of multiplexes on a BSC\n" "Number of ports\n")
+{
+ struct bsc_config *conf = vty->index;
+
+ conf->number_multiplexes = atoi(argv[0]);
+ return CMD_SUCCESS;
+}
+
DEFUN(cfg_bsc_paging,
cfg_bsc_paging_cmd,
"paging forbidden (0|1)",
@@ -730,6 +741,7 @@ int bsc_nat_vty_init(struct bsc_nat *nat)
install_element(NAT_BSC_NODE, &cfg_bsc_paging_cmd);
install_element(NAT_BSC_NODE, &cfg_bsc_desc_cmd);
install_element(NAT_BSC_NODE, &cfg_bsc_acc_lst_name_cmd);
+ install_element(NAT_BSC_NODE, &cfg_bsc_nr_multip_cmd);
mgcp_vty_init();