aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2020-12-05 17:50:23 +0100
committerHarald Welte <laforge@osmocom.org>2020-12-05 17:50:50 +0100
commit4bf53ef19aeeaa520398f79e6882a73af46b8a4a (patch)
tree6a93801b0ef5eeb83f3ecbe58ee94bde2e3a7496
parent91bb72044905da4cb34628c6119c387cddb3077e (diff)
gb_proxy: cosmetic: Use function rather than open-coding is_sgsn
-rw-r--r--src/gbproxy/gb_proxy.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/gbproxy/gb_proxy.c b/src/gbproxy/gb_proxy.c
index 74f799d8..98fa9283 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->