From 9a83d7af55772e4e2e6f187ab11d3f2a2665791c Mon Sep 17 00:00:00 2001 From: Jacob Erlbeck Date: Thu, 25 Sep 2014 11:17:31 +0200 Subject: 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 --- openbsc/src/gprs/gb_proxy.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'openbsc/src/gprs/gb_proxy.c') diff --git a/openbsc/src/gprs/gb_proxy.c b/openbsc/src/gprs/gb_proxy.c index 3257f7490..41ff4a785 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; } -- cgit v1.2.3