From e393f273e7c65edea09b12385ca648724c9c3825 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Tue, 12 Oct 2010 18:25:52 +0200 Subject: nat: Keep a ussd token in the config We will have the USSD provider connecting to us and we will use the IPA protocol, including the auth mechanism. --- openbsc/include/openbsc/bsc_nat.h | 2 ++ openbsc/src/nat/bsc_nat_vty.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/openbsc/include/openbsc/bsc_nat.h b/openbsc/include/openbsc/bsc_nat.h index 61f19f27e..f718766a1 100644 --- a/openbsc/include/openbsc/bsc_nat.h +++ b/openbsc/include/openbsc/bsc_nat.h @@ -235,6 +235,8 @@ struct bsc_nat { /* USSD messages we want to match */ char *ussd_lst_name; char *ussd_query; + char *ussd_token; + char *ussd_local; /* 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 940ebfdf2..b284fedd5 100644 --- a/openbsc/src/nat/bsc_nat_vty.c +++ b/openbsc/src/nat/bsc_nat_vty.c @@ -82,6 +82,10 @@ static int config_write_nat(struct vty *vty) 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); + if (_nat->ussd_token) + vty_out(vty, " ussd-token %s%s", _nat->ussd_token, VTY_NEWLINE); + if (_nat->ussd_local) + vty_out(vty, " ussd-local-ip %s%s", _nat->ussd_local, VTY_NEWLINE); llist_for_each_entry(lst, &_nat->access_lists, list) { write_acc_lst(vty, lst); @@ -423,6 +427,28 @@ DEFUN(cfg_nat_ussd_query, return CMD_SUCCESS; } +DEFUN(cfg_nat_ussd_token, + cfg_nat_ussd_token_cmd, + "ussd-token TOKEN", + "Set the token used to identify the USSD module\n" "Secret key\n") +{ + if (_nat->ussd_token) + talloc_free(_nat->ussd_token); + _nat->ussd_token = talloc_strdup(_nat, argv[0]); + return CMD_SUCCESS; +} + +DEFUN(cfg_nat_ussd_local, + cfg_nat_ussd_local_cmd, + "ussd-local-ip A.B.C.D", + "Set the IP to listen for the USSD Provider\n" "IP Address\n") +{ + if (_nat->ussd_local) + talloc_free(_nat->ussd_local); + _nat->ussd_local = 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") { @@ -662,6 +688,8 @@ int bsc_nat_vty_init(struct bsc_nat *nat) 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); + install_element(NAT_NODE, &cfg_nat_ussd_token_cmd); + install_element(NAT_NODE, &cfg_nat_ussd_local_cmd); /* access-list */ install_element(NAT_NODE, &cfg_lst_imsi_allow_cmd); -- cgit v1.2.3