aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-10-11 10:06:39 +0200
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-10-25 21:04:46 +0200
commitc1578bc74702ac879b7fbf6cab868770f268e3cd (patch)
treed0d5717aee694779da0ecf16d63de26b01428e78
parentc1cac1e31ac89ce533fea50eb1150b29ad260c8c (diff)
nat: Add an option to set the query string to match
Allow the query string to be set. The ussd matching code will check for this string and then forward it to the bypass.
-rw-r--r--openbsc/include/openbsc/bsc_nat.h1
-rw-r--r--openbsc/src/nat/bsc_nat_vty.c15
2 files changed, 16 insertions, 0 deletions
diff --git a/openbsc/include/openbsc/bsc_nat.h b/openbsc/include/openbsc/bsc_nat.h
index e8a47525c..61f19f27e 100644
--- a/openbsc/include/openbsc/bsc_nat.h
+++ b/openbsc/include/openbsc/bsc_nat.h
@@ -234,6 +234,7 @@ struct bsc_nat {
/* USSD messages we want to match */
char *ussd_lst_name;
+ char *ussd_query;
/* statistics */
struct bsc_nat_statistics stats;
diff --git a/openbsc/src/nat/bsc_nat_vty.c b/openbsc/src/nat/bsc_nat_vty.c
index de58bba07..940ebfdf2 100644
--- a/openbsc/src/nat/bsc_nat_vty.c
+++ b/openbsc/src/nat/bsc_nat_vty.c
@@ -80,6 +80,8 @@ static int config_write_nat(struct vty *vty)
vty_out(vty, " access-list-name %s%s", _nat->acc_lst_name, VTY_NEWLINE);
if (_nat->ussd_lst_name)
vty_out(vty, " ussd-list-name %s%s", _nat->ussd_lst_name, VTY_NEWLINE);
+ if (_nat->ussd_query)
+ vty_out(vty, " ussd-query %s%s", _nat->ussd_query, VTY_NEWLINE);
llist_for_each_entry(lst, &_nat->access_lists, list) {
write_acc_lst(vty, lst);
@@ -409,6 +411,18 @@ DEFUN(cfg_nat_ussd_lst_name,
return CMD_SUCCESS;
}
+DEFUN(cfg_nat_ussd_query,
+ cfg_nat_ussd_query_cmd,
+ "ussd-query QUERY",
+ "Set the USSD query to match with the ussd-list-name\n"
+ "The query to match")
+{
+ if (_nat->ussd_query)
+ talloc_free(_nat->ussd_query);
+ _nat->ussd_query = talloc_strdup(_nat, argv[0]);
+ return CMD_SUCCESS;
+}
+
/* per BSC configuration */
DEFUN(cfg_bsc, cfg_bsc_cmd, "bsc BSC_NR", "Select a BSC to configure")
{
@@ -647,6 +661,7 @@ int bsc_nat_vty_init(struct bsc_nat *nat)
install_element(NAT_NODE, &cfg_nat_bsc_ip_tos_cmd);
install_element(NAT_NODE, &cfg_nat_acc_lst_name_cmd);
install_element(NAT_NODE, &cfg_nat_ussd_lst_name_cmd);
+ install_element(NAT_NODE, &cfg_nat_ussd_query_cmd);
/* access-list */
install_element(NAT_NODE, &cfg_lst_imsi_allow_cmd);