From 4bf53ef19aeeaa520398f79e6882a73af46b8a4a Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sat, 5 Dec 2020 17:50:23 +0100 Subject: gb_proxy: cosmetic: Use function rather than open-coding is_sgsn Change-Id: Id41d74ebd41e5084377a986f4a1acd53cae12bc1 --- src/gbproxy/gb_proxy.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/gbproxy/gb_proxy.c b/src/gbproxy/gb_proxy.c index 74f799d84..98fa92834 100644 --- a/src/gbproxy/gb_proxy.c +++ b/src/gbproxy/gb_proxy.c @@ -83,6 +83,12 @@ static int gbprox_relay2peer(struct msgb *old_msg, struct gbproxy_bvc *bvc, static int gbprox_relay2sgsn(struct gbproxy_config *cfg, struct msgb *old_msg, uint16_t ns_bvci, uint16_t sgsn_nsei); + +static int gbproxy_is_sgsn_nsei(struct gbproxy_config *cfg, uint16_t nsei) +{ + return nsei == cfg->nsip_sgsn_nsei; +} + static int check_bvc_nsei(struct gbproxy_bvc *bvc, uint16_t nsei) { OSMO_ASSERT(bvc); @@ -726,11 +732,6 @@ err_no_bvc: return bssgp_tx_status(BSSGP_CAUSE_INV_MAND_INF, NULL, orig_msg); } -static int gbproxy_is_sgsn_nsei(struct gbproxy_config *cfg, uint16_t nsei) -{ - return nsei == cfg->nsip_sgsn_nsei; -} - int gbprox_bssgp_send_cb(void *ctx, struct msgb *msg) { int rc; @@ -800,7 +801,7 @@ void gprs_ns_prim_status_cb(struct gbproxy_config *cfg, struct osmo_gprs_ns2_pri case NS_AFF_CAUSE_RECOVERY: LOGP(DPCU, LOGL_NOTICE, "NS-NSE %d became available\n", nsp->nsei); - if (nsp->nsei == cfg->nsip_sgsn_nsei) { + if (gbproxy_is_sgsn_nsei(cfg, nsp->nsei)) { /* look-up or create the BTS context for this BVC */ struct bssgp_bvc_ctx *bctx = btsctx_by_bvci_nsei(nsp->bvci, nsp->nsei); if (!bctx) @@ -810,7 +811,7 @@ void gprs_ns_prim_status_cb(struct gbproxy_config *cfg, struct osmo_gprs_ns2_pri } break; case NS_AFF_CAUSE_FAILURE: - if (nsp->nsei == cfg->nsip_sgsn_nsei) { + if (gbproxy_is_sgsn_nsei(cfg, nsp->nsei)) { /* sgsn */ /* TODO: BSVC: block all PtP towards bss */ rate_ctr_inc(&cfg->ctrg-> -- cgit v1.2.3