From c1578bc74702ac879b7fbf6cab868770f268e3cd Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Mon, 11 Oct 2010 10:06:39 +0200 Subject: 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. --- openbsc/include/openbsc/bsc_nat.h | 1 + openbsc/src/nat/bsc_nat_vty.c | 15 +++++++++++++++ 2 files changed, 16 insertions(+) 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); -- cgit v1.2.3