diff options
author | Jacob Erlbeck <jerlbeck@sysmocom.de> | 2014-08-14 08:57:04 +0200 |
---|---|---|
committer | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2014-08-22 00:21:56 +0200 |
commit | 29805da6d17f367495d0d0d94098a07b01ea53e2 (patch) | |
tree | a91970b714d627a6b44b75987f4af5c62649fcff /openbsc/tests/gbproxy/gbproxy_test.c | |
parent | d2eb5e911e647cdbd78e6c004698f937e18e18a4 (diff) |
gbproxy: Add gbprox_clear_patch_filter() (Coverity)
Add a separate function to clear the IMSI filter to be used instead of
gbprox_set_patch_filter(cfg, NULL, ...). Albeit it fixes a Coverity
issue (Unchecked return value), it is a false positive, since the
return value is always 0 in these cases. Nevertheless it is more
obvious what happens when an explicit clear function is called. Using
NULL as filter argument of gbprox_set_patch_filter still clears the
filter.
Fixes: Coverity CID 1231255
Sponsored-by: On-Waves ehf
Diffstat (limited to 'openbsc/tests/gbproxy/gbproxy_test.c')
-rw-r--r-- | openbsc/tests/gbproxy/gbproxy_test.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/openbsc/tests/gbproxy/gbproxy_test.c b/openbsc/tests/gbproxy/gbproxy_test.c index 964c6da99..5363749c6 100644 --- a/openbsc/tests/gbproxy/gbproxy_test.c +++ b/openbsc/tests/gbproxy/gbproxy_test.c @@ -1571,6 +1571,12 @@ static void test_gbproxy_imsi_matching(void) OSMO_ASSERT(gbprox_set_patch_filter(&cfg, NULL, &err_msg) == 0); OSMO_ASSERT(cfg.check_imsi == 0); + OSMO_ASSERT(gbprox_set_patch_filter(&cfg, filter_re2, &err_msg) == 0); + OSMO_ASSERT(cfg.check_imsi == 1); + + gbprox_clear_patch_filter(&cfg); + OSMO_ASSERT(cfg.check_imsi == 0); + peer = gbproxy_peer_alloc(&cfg, 20); OSMO_ASSERT(gbprox_set_patch_filter(&cfg, filter_re2, &err_msg) == 0); |