aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/osmo-bsc_nat/bsc_nat_vty.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2011-05-27 12:38:58 +0200
committerHolger Hans Peter Freyther <zecke@selfish.org>2011-06-01 20:40:35 +0200
commitad75eababc153d513e75f7f052818ca02acd9533 (patch)
tree495be345f80cbe4f975ec15367c49433350a6c71 /openbsc/src/osmo-bsc_nat/bsc_nat_vty.c
parent384ef099209f92afb0af0c48756731a105da23f5 (diff)
nat: Allow to have a regexp to match the MSISDN
The idea that MCC and MNC is enough to classify a subscriber turns out to be wrong. Certain operatos license a number range of IMSIs to others. When we see a '^' in the MCC field we treat it as a regexp. The code now turns the MCC/MNC into a regexp for the IMSI. It is not using extended POSIX regexp to match the behavior of the access list.
Diffstat (limited to 'openbsc/src/osmo-bsc_nat/bsc_nat_vty.c')
-rw-r--r--openbsc/src/osmo-bsc_nat/bsc_nat_vty.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/openbsc/src/osmo-bsc_nat/bsc_nat_vty.c b/openbsc/src/osmo-bsc_nat/bsc_nat_vty.c
index 0375cf800..38b5a0905 100644
--- a/openbsc/src/osmo-bsc_nat/bsc_nat_vty.c
+++ b/openbsc/src/osmo-bsc_nat/bsc_nat_vty.c
@@ -461,16 +461,16 @@ DEFUN(cfg_nat_number_rewrite,
"number-rewrite FILENAME",
"Set the file with rewriting rules.\n" "Filename")
{
+ struct osmo_config_list *rewr = NULL;
+
bsc_replace_string(_nat, &_nat->num_rewr_name, argv[0]);
if (_nat->num_rewr_name) {
- if (_nat->num_rewr)
- talloc_free(_nat->num_rewr);
- _nat->num_rewr = osmo_config_list_parse(_nat, _nat->num_rewr_name);
- return _nat->num_rewr == NULL ? CMD_WARNING : CMD_SUCCESS;
+ rewr = osmo_config_list_parse(_nat, _nat->num_rewr_name);
+ bsc_nat_num_rewr_entry_adapt(_nat, rewr);
+ talloc_free(rewr);
+ return CMD_SUCCESS;
} else {
- if (_nat->num_rewr)
- talloc_free(_nat->num_rewr);
- _nat->num_rewr = NULL;
+ bsc_nat_num_rewr_entry_adapt(_nat, NULL);
return CMD_SUCCESS;
}
}