summaryrefslogtreecommitdiffstats
path: root/openbsc/src/gprs/gb_proxy.c
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2014-09-25 11:17:31 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-10-09 18:02:33 +0200
commit9a83d7af55772e4e2e6f187ab11d3f2a2665791c (patch)
treeb57ec27fd26bba90c88252251c5249bafd4d85d1 /openbsc/src/gprs/gb_proxy.c
parent55ec2bf97f9b30ea44c05e1ec5310bf93cee7884 (diff)
gbproxy: Refactor IMSI matching
The current implementation makes it difficult to add further match expressions. This patch adds a new struct gbproxy_match that contains the fields needed for each match expression. The matches (config) and the results (link_info) are stored in arrays. All related functions are updated to use them. The old fields in the config structure are removed. Sponsored-by: On-Waves ehf
Diffstat (limited to 'openbsc/src/gprs/gb_proxy.c')
-rw-r--r--openbsc/src/gprs/gb_proxy.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/openbsc/src/gprs/gb_proxy.c b/openbsc/src/gprs/gb_proxy.c
index 3257f74..41ff4a7 100644
--- a/openbsc/src/gprs/gb_proxy.c
+++ b/openbsc/src/gprs/gb_proxy.c
@@ -584,7 +584,8 @@ static int gbprox_process_bssgp_ul(struct gbproxy_config *cfg,
if (link_info && cfg->route_to_sgsn2) {
if (cfg->acquire_imsi && link_info->imsi_len == 0)
sgsn_nsei = 0xffff;
- else if (gbproxy_imsi_matches(peer, link_info))
+ else if (gbproxy_imsi_matches(cfg, GBPROX_MATCH_PATCHING,
+ link_info))
sgsn_nsei = cfg->nsip_sgsn2_nsei;
}
@@ -1346,10 +1347,12 @@ void gbprox_reset(struct gbproxy_config *cfg)
int gbproxy_init_config(struct gbproxy_config *cfg)
{
struct timespec tp;
+
INIT_LLIST_HEAD(&cfg->bts_peers);
cfg->ctrg = rate_ctr_group_alloc(tall_bsc_ctx, &global_ctrg_desc, 0);
clock_gettime(CLOCK_REALTIME, &tp);
cfg->bss_ptmsi_state = tp.tv_sec + tp.tv_nsec;
cfg->sgsn_tlli_state = tp.tv_sec - tp.tv_nsec;
+
return 0;
}