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.
This commit is contained in:
Holger Hans Peter Freyther 2010-10-11 10:06:39 +02:00
parent c1cac1e31a
commit c1578bc747
2 changed files with 16 additions and 0 deletions

View File

@ -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;

View File

@ -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);