2019-08-30 17:48:34 +00:00
|
|
|
/* Gb proxy peer handling */
|
|
|
|
|
|
|
|
/* (C) 2010 by Harald Welte <laforge@gnumonks.org>
|
|
|
|
* (C) 2010-2013 by On-Waves
|
|
|
|
* (C) 2013 by Holger Hans Peter Freyther
|
|
|
|
* All Rights Reserved
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Affero General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Affero General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <osmocom/sgsn/gb_proxy.h>
|
|
|
|
|
|
|
|
#include <osmocom/sgsn/debug.h>
|
|
|
|
|
|
|
|
#include <osmocom/gprs/protocol/gsm_08_18.h>
|
2020-12-02 18:33:50 +00:00
|
|
|
#include <osmocom/core/logging.h>
|
2019-08-30 17:48:34 +00:00
|
|
|
#include <osmocom/core/rate_ctr.h>
|
|
|
|
#include <osmocom/core/stats.h>
|
|
|
|
#include <osmocom/core/talloc.h>
|
|
|
|
#include <osmocom/gsm/tlv.h>
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
extern void *tall_sgsn_ctx;
|
|
|
|
|
2020-12-04 21:24:47 +00:00
|
|
|
static const struct rate_ctr_desc bvc_ctr_description[] = {
|
2019-08-30 17:48:34 +00:00
|
|
|
{ "blocked", "BVC Block " },
|
|
|
|
{ "unblocked", "BVC Unblock " },
|
|
|
|
{ "dropped", "BVC blocked, dropped packet " },
|
|
|
|
{ "inv-nsei", "NSEI mismatch " },
|
|
|
|
{ "tx-err", "NS Transmission error " },
|
|
|
|
{ "raid-mod:bss", "RAID patched (BSS )" },
|
|
|
|
{ "raid-mod:sgsn", "RAID patched (SGSN)" },
|
|
|
|
{ "apn-mod:sgsn", "APN patched " },
|
|
|
|
{ "tlli-mod:bss", "TLLI patched (BSS )" },
|
|
|
|
{ "tlli-mod:sgsn", "TLLI patched (SGSN)" },
|
|
|
|
{ "ptmsi-mod:bss", "P-TMSI patched (BSS )" },
|
|
|
|
{ "ptmsi-mod:sgsn","P-TMSI patched (SGSN)" },
|
|
|
|
{ "mod-crypt-err", "Patch error: encrypted " },
|
|
|
|
{ "mod-err", "Patch error: other " },
|
|
|
|
{ "attach-reqs", "Attach Request count " },
|
|
|
|
{ "attach-rejs", "Attach Reject count " },
|
|
|
|
{ "attach-acks", "Attach Accept count " },
|
|
|
|
{ "attach-cpls", "Attach Completed count " },
|
|
|
|
{ "ra-upd-reqs", "RoutingArea Update Request count" },
|
|
|
|
{ "ra-upd-rejs", "RoutingArea Update Reject count " },
|
|
|
|
{ "ra-upd-acks", "RoutingArea Update Accept count " },
|
|
|
|
{ "ra-upd-cpls", "RoutingArea Update Compltd count" },
|
|
|
|
{ "gmm-status", "GMM Status count (BSS)" },
|
|
|
|
{ "gmm-status", "GMM Status count (SGSN)" },
|
|
|
|
{ "detach-reqs", "Detach Request count " },
|
|
|
|
{ "detach-acks", "Detach Accept count " },
|
|
|
|
{ "pdp-act-reqs", "PDP Activation Request count " },
|
|
|
|
{ "pdp-act-rejs", "PDP Activation Reject count " },
|
|
|
|
{ "pdp-act-acks", "PDP Activation Accept count " },
|
|
|
|
{ "pdp-deact-reqs","PDP Deactivation Request count " },
|
|
|
|
{ "pdp-deact-acks","PDP Deactivation Accept count " },
|
|
|
|
{ "tlli-unknown", "TLLI from SGSN unknown " },
|
|
|
|
{ "tlli-cache", "TLLI cache size " },
|
|
|
|
};
|
|
|
|
|
2020-12-04 21:24:47 +00:00
|
|
|
osmo_static_assert(ARRAY_SIZE(bvc_ctr_description) == GBPROX_PEER_CTR_LAST, everything_described);
|
2019-08-30 17:48:34 +00:00
|
|
|
|
2020-12-04 21:24:47 +00:00
|
|
|
static const struct rate_ctr_group_desc bvc_ctrg_desc = {
|
2019-08-30 17:48:34 +00:00
|
|
|
.group_name_prefix = "gbproxy:peer",
|
|
|
|
.group_description = "GBProxy Peer Statistics",
|
2020-12-04 21:24:47 +00:00
|
|
|
.num_ctr = ARRAY_SIZE(bvc_ctr_description),
|
|
|
|
.ctr_desc = bvc_ctr_description,
|
2019-08-30 17:48:34 +00:00
|
|
|
.class_id = OSMO_STATS_CLASS_PEER,
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2020-12-04 21:24:47 +00:00
|
|
|
/* Find the gbproxy_bvc by its BVCI. There can only be one match */
|
|
|
|
struct gbproxy_bvc *gbproxy_bvc_by_bvci(struct gbproxy_config *cfg, uint16_t bvci)
|
2019-08-30 17:48:34 +00:00
|
|
|
{
|
2020-11-26 17:19:21 +00:00
|
|
|
struct gbproxy_nse *nse;
|
2020-12-04 23:31:07 +00:00
|
|
|
int i;
|
2020-11-26 17:19:21 +00:00
|
|
|
|
2020-12-04 23:31:07 +00:00
|
|
|
hash_for_each(cfg->bss_nses, i, nse, list) {
|
2020-12-04 21:24:47 +00:00
|
|
|
struct gbproxy_bvc *bvc;
|
|
|
|
llist_for_each_entry(bvc, &nse->bvcs, list) {
|
|
|
|
if (bvc->bvci == bvci)
|
|
|
|
return bvc;
|
2020-11-26 17:19:21 +00:00
|
|
|
}
|
2019-08-30 17:48:34 +00:00
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2020-12-04 21:24:47 +00:00
|
|
|
/* Find the gbproxy_bvc by its NSEI */
|
|
|
|
/* FIXME: Only returns the first bvc, but we could have multiple on this nsei */
|
|
|
|
struct gbproxy_bvc *gbproxy_bvc_by_nsei(struct gbproxy_config *cfg,
|
2019-08-30 17:48:34 +00:00
|
|
|
uint16_t nsei)
|
|
|
|
{
|
2020-12-04 23:31:07 +00:00
|
|
|
struct gbproxy_nse *nse = gbproxy_nse_by_nsei(cfg, nsei);
|
|
|
|
|
|
|
|
if (nse && !llist_empty(&nse->bvcs))
|
|
|
|
return llist_first_entry(&nse->bvcs, struct gbproxy_bvc, list);
|
|
|
|
|
2019-08-30 17:48:34 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2020-12-04 21:24:47 +00:00
|
|
|
/* look-up a bvc by its Routeing Area Identification (RAI) */
|
|
|
|
/* FIXME: this doesn't make sense, as RA can span multiple bvcs! */
|
|
|
|
struct gbproxy_bvc *gbproxy_bvc_by_rai(struct gbproxy_config *cfg,
|
2019-08-30 17:48:34 +00:00
|
|
|
const uint8_t *ra)
|
|
|
|
{
|
2020-11-26 17:19:21 +00:00
|
|
|
struct gbproxy_nse *nse;
|
2020-12-04 23:31:07 +00:00
|
|
|
int i;
|
2020-11-26 17:19:21 +00:00
|
|
|
|
2020-12-04 23:31:07 +00:00
|
|
|
hash_for_each(cfg->bss_nses, i, nse, list) {
|
2020-12-04 21:24:47 +00:00
|
|
|
struct gbproxy_bvc *bvc;
|
|
|
|
llist_for_each_entry(bvc, &nse->bvcs, list) {
|
|
|
|
if (!memcmp(bvc->ra, ra, 6))
|
|
|
|
return bvc;
|
2020-11-26 17:19:21 +00:00
|
|
|
}
|
2019-08-30 17:48:34 +00:00
|
|
|
}
|
2020-11-26 17:19:21 +00:00
|
|
|
|
2019-08-30 17:48:34 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2020-12-04 21:24:47 +00:00
|
|
|
/* look-up a bvc by its Location Area Identification (LAI) */
|
|
|
|
/* FIXME: this doesn't make sense, as LA can span multiple bvcs! */
|
|
|
|
struct gbproxy_bvc *gbproxy_bvc_by_lai(struct gbproxy_config *cfg,
|
2019-08-30 17:48:34 +00:00
|
|
|
const uint8_t *la)
|
|
|
|
{
|
2020-11-26 17:19:21 +00:00
|
|
|
struct gbproxy_nse *nse;
|
2020-12-04 23:31:07 +00:00
|
|
|
int i;
|
2020-11-26 17:19:21 +00:00
|
|
|
|
2020-12-04 23:31:07 +00:00
|
|
|
hash_for_each(cfg->bss_nses, i, nse, list) {
|
2020-12-04 21:24:47 +00:00
|
|
|
struct gbproxy_bvc *bvc;
|
|
|
|
llist_for_each_entry(bvc, &nse->bvcs, list) {
|
|
|
|
if (!memcmp(bvc->ra, la, 5))
|
|
|
|
return bvc;
|
2020-11-26 17:19:21 +00:00
|
|
|
}
|
2019-08-30 17:48:34 +00:00
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2020-12-04 21:24:47 +00:00
|
|
|
/* look-up a bvc by its Location Area Code (LAC) */
|
|
|
|
/* FIXME: this doesn't make sense, as LAC can span multiple bvcs! */
|
|
|
|
struct gbproxy_bvc *gbproxy_bvc_by_lac(struct gbproxy_config *cfg,
|
2019-08-30 17:48:34 +00:00
|
|
|
const uint8_t *la)
|
|
|
|
{
|
2020-11-26 17:19:21 +00:00
|
|
|
struct gbproxy_nse *nse;
|
2020-12-04 23:31:07 +00:00
|
|
|
int i;
|
2020-11-26 17:19:21 +00:00
|
|
|
|
2020-12-04 23:31:07 +00:00
|
|
|
hash_for_each(cfg->bss_nses, i, nse, list) {
|
2020-12-04 21:24:47 +00:00
|
|
|
struct gbproxy_bvc *bvc;
|
|
|
|
llist_for_each_entry(bvc, &nse->bvcs, list) {
|
|
|
|
if (!memcmp(bvc->ra + 3, la + 3, 2))
|
|
|
|
return bvc;
|
2020-11-26 17:19:21 +00:00
|
|
|
}
|
2019-08-30 17:48:34 +00:00
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2020-12-04 21:24:47 +00:00
|
|
|
struct gbproxy_bvc *gbproxy_bvc_by_bssgp_tlv(struct gbproxy_config *cfg,
|
2019-08-30 17:48:34 +00:00
|
|
|
struct tlv_parsed *tp)
|
|
|
|
{
|
2020-12-03 14:36:59 +00:00
|
|
|
if (TLVP_PRES_LEN(tp, BSSGP_IE_BVCI, 2)) {
|
2019-08-30 17:48:34 +00:00
|
|
|
uint16_t bvci;
|
|
|
|
|
|
|
|
bvci = ntohs(tlvp_val16_unal(tp, BSSGP_IE_BVCI));
|
|
|
|
if (bvci >= 2)
|
2020-12-04 21:24:47 +00:00
|
|
|
return gbproxy_bvc_by_bvci(cfg, bvci);
|
2019-08-30 17:48:34 +00:00
|
|
|
}
|
|
|
|
|
2020-12-04 21:24:47 +00:00
|
|
|
/* FIXME: this doesn't make sense, as RA can span multiple bvcs! */
|
2020-12-03 14:36:59 +00:00
|
|
|
if (TLVP_PRES_LEN(tp, BSSGP_IE_ROUTEING_AREA, 6)) {
|
2019-08-30 17:48:34 +00:00
|
|
|
uint8_t *rai = (uint8_t *)TLVP_VAL(tp, BSSGP_IE_ROUTEING_AREA);
|
|
|
|
/* Only compare LAC part, since MCC/MNC are possibly patched.
|
|
|
|
* Since the LAC of different BSS must be different when
|
|
|
|
* MCC/MNC are patched, collisions shouldn't happen. */
|
2020-12-04 21:24:47 +00:00
|
|
|
return gbproxy_bvc_by_lac(cfg, rai);
|
2019-08-30 17:48:34 +00:00
|
|
|
}
|
|
|
|
|
2020-12-04 21:24:47 +00:00
|
|
|
/* FIXME: this doesn't make sense, as LA can span multiple bvcs! */
|
2020-12-03 14:36:59 +00:00
|
|
|
if (TLVP_PRES_LEN(tp, BSSGP_IE_LOCATION_AREA, 5)) {
|
2019-08-30 17:48:34 +00:00
|
|
|
uint8_t *lai = (uint8_t *)TLVP_VAL(tp, BSSGP_IE_LOCATION_AREA);
|
2020-12-04 21:24:47 +00:00
|
|
|
return gbproxy_bvc_by_lac(cfg, lai);
|
2019-08-30 17:48:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void clean_stale_timer_cb(void *data)
|
|
|
|
{
|
|
|
|
time_t now;
|
|
|
|
struct timespec ts = {0,};
|
2020-12-04 21:24:47 +00:00
|
|
|
struct gbproxy_bvc *bvc = (struct gbproxy_bvc *) data;
|
|
|
|
OSMO_ASSERT(bvc);
|
|
|
|
OSMO_ASSERT(bvc->nse);
|
|
|
|
struct gbproxy_config *cfg = bvc->nse->cfg;
|
2020-11-26 17:19:21 +00:00
|
|
|
OSMO_ASSERT(cfg);
|
2019-08-30 17:48:34 +00:00
|
|
|
|
|
|
|
osmo_clock_gettime(CLOCK_MONOTONIC, &ts);
|
|
|
|
now = ts.tv_sec;
|
2020-12-04 21:24:47 +00:00
|
|
|
gbproxy_remove_stale_link_infos(bvc, now);
|
2020-11-26 17:19:21 +00:00
|
|
|
if (cfg->clean_stale_timer_freq != 0)
|
2020-12-04 21:24:47 +00:00
|
|
|
osmo_timer_schedule(&bvc->clean_stale_timer,
|
2020-11-26 17:19:21 +00:00
|
|
|
cfg->clean_stale_timer_freq, 0);
|
2019-08-30 17:48:34 +00:00
|
|
|
}
|
|
|
|
|
2020-12-04 21:24:47 +00:00
|
|
|
struct gbproxy_bvc *gbproxy_bvc_alloc(struct gbproxy_nse *nse, uint16_t bvci)
|
2019-08-30 17:48:34 +00:00
|
|
|
{
|
2020-12-04 21:24:47 +00:00
|
|
|
struct gbproxy_bvc *bvc;
|
2020-11-26 17:19:21 +00:00
|
|
|
OSMO_ASSERT(nse);
|
|
|
|
struct gbproxy_config *cfg = nse->cfg;
|
|
|
|
OSMO_ASSERT(cfg);
|
2019-08-30 17:48:34 +00:00
|
|
|
|
2020-12-04 21:24:47 +00:00
|
|
|
bvc = talloc_zero(tall_sgsn_ctx, struct gbproxy_bvc);
|
|
|
|
if (!bvc)
|
2019-08-30 17:48:34 +00:00
|
|
|
return NULL;
|
|
|
|
|
2020-12-04 21:24:47 +00:00
|
|
|
bvc->bvci = bvci;
|
|
|
|
bvc->ctrg = rate_ctr_group_alloc(bvc, &bvc_ctrg_desc, bvci);
|
|
|
|
if (!bvc->ctrg) {
|
|
|
|
talloc_free(bvc);
|
2019-08-30 17:48:34 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
2020-12-04 21:24:47 +00:00
|
|
|
bvc->nse = nse;
|
2019-08-30 17:48:34 +00:00
|
|
|
|
2020-12-04 21:24:47 +00:00
|
|
|
llist_add(&bvc->list, &nse->bvcs);
|
2019-08-30 17:48:34 +00:00
|
|
|
|
2020-12-04 21:24:47 +00:00
|
|
|
INIT_LLIST_HEAD(&bvc->patch_state.logical_links);
|
2019-08-30 17:48:34 +00:00
|
|
|
|
2020-12-04 21:24:47 +00:00
|
|
|
osmo_timer_setup(&bvc->clean_stale_timer, clean_stale_timer_cb, bvc);
|
2020-11-26 17:19:21 +00:00
|
|
|
if (cfg->clean_stale_timer_freq != 0)
|
2020-12-04 21:24:47 +00:00
|
|
|
osmo_timer_schedule(&bvc->clean_stale_timer,
|
2020-11-26 17:19:21 +00:00
|
|
|
cfg->clean_stale_timer_freq, 0);
|
2019-08-30 17:48:34 +00:00
|
|
|
|
2020-12-04 21:24:47 +00:00
|
|
|
return bvc;
|
2019-08-30 17:48:34 +00:00
|
|
|
}
|
|
|
|
|
2020-12-04 21:24:47 +00:00
|
|
|
void gbproxy_bvc_free(struct gbproxy_bvc *bvc)
|
2019-08-30 17:48:34 +00:00
|
|
|
{
|
2020-12-04 21:24:47 +00:00
|
|
|
if (!bvc)
|
2020-12-04 16:38:46 +00:00
|
|
|
return;
|
2020-11-26 17:19:21 +00:00
|
|
|
|
2020-12-04 21:24:47 +00:00
|
|
|
llist_del(&bvc->list);
|
|
|
|
osmo_timer_del(&bvc->clean_stale_timer);
|
|
|
|
gbproxy_delete_link_infos(bvc);
|
2019-08-30 17:48:34 +00:00
|
|
|
|
2020-12-04 21:24:47 +00:00
|
|
|
rate_ctr_group_free(bvc->ctrg);
|
|
|
|
bvc->ctrg = NULL;
|
2019-08-30 17:48:34 +00:00
|
|
|
|
2020-12-04 21:24:47 +00:00
|
|
|
talloc_free(bvc);
|
2019-08-30 17:48:34 +00:00
|
|
|
}
|
|
|
|
|
2020-12-04 21:24:47 +00:00
|
|
|
void gbproxy_bvc_move(struct gbproxy_bvc *bvc, struct gbproxy_nse *nse)
|
2020-11-30 16:14:24 +00:00
|
|
|
{
|
2020-12-04 21:24:47 +00:00
|
|
|
llist_del(&bvc->list);
|
|
|
|
llist_add(&bvc->list, &nse->bvcs);
|
|
|
|
bvc->nse = nse;
|
2020-11-30 16:14:24 +00:00
|
|
|
}
|
|
|
|
|
2020-12-04 21:24:47 +00:00
|
|
|
/*! remove bvcs (BVCs) on NSE specified by NSEI.
|
|
|
|
* \param[in] cfg proxy in which we operate
|
|
|
|
* \param[in] nsei NS entity in which we should clean up
|
|
|
|
* \param[in] bvci if 0: remove all BVCs; if != 0: BVCI of the single BVC to clean up */
|
|
|
|
int gbproxy_cleanup_bvcs(struct gbproxy_config *cfg, uint16_t nsei, uint16_t bvci)
|
2019-08-30 17:48:34 +00:00
|
|
|
{
|
2020-12-04 23:31:07 +00:00
|
|
|
int i, counter = 0;
|
|
|
|
struct gbproxy_nse *nse;
|
|
|
|
struct hlist_node *ntmp;
|
2020-11-26 17:19:21 +00:00
|
|
|
OSMO_ASSERT(cfg);
|
2019-08-30 17:48:34 +00:00
|
|
|
|
2020-12-04 23:31:07 +00:00
|
|
|
hash_for_each_safe(cfg->bss_nses, i, ntmp, nse, list) {
|
2020-12-04 21:24:47 +00:00
|
|
|
struct gbproxy_bvc *bvc, *tmp;
|
2020-11-26 17:19:21 +00:00
|
|
|
if (nse->nsei != nsei)
|
2019-08-30 17:48:34 +00:00
|
|
|
continue;
|
2020-12-04 21:24:47 +00:00
|
|
|
llist_for_each_entry_safe(bvc, tmp, &nse->bvcs, list) {
|
|
|
|
if (bvci && bvc->bvci != bvci)
|
2020-11-26 17:19:21 +00:00
|
|
|
continue;
|
2019-08-30 17:48:34 +00:00
|
|
|
|
2020-12-04 21:24:47 +00:00
|
|
|
gbproxy_bvc_free(bvc);
|
2020-11-26 17:19:21 +00:00
|
|
|
counter += 1;
|
|
|
|
}
|
2019-08-30 17:48:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return counter;
|
|
|
|
}
|
2020-11-26 17:19:21 +00:00
|
|
|
|
|
|
|
struct gbproxy_nse *gbproxy_nse_alloc(struct gbproxy_config *cfg, uint16_t nsei)
|
|
|
|
{
|
|
|
|
struct gbproxy_nse *nse;
|
|
|
|
OSMO_ASSERT(cfg);
|
|
|
|
|
|
|
|
nse = talloc_zero(tall_sgsn_ctx, struct gbproxy_nse);
|
|
|
|
if (!nse)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
nse->nsei = nsei;
|
|
|
|
nse->cfg = cfg;
|
|
|
|
|
2020-12-04 23:31:07 +00:00
|
|
|
hash_add(cfg->bss_nses, &nse->list, nsei);
|
2020-11-26 17:19:21 +00:00
|
|
|
|
2020-12-04 21:24:47 +00:00
|
|
|
INIT_LLIST_HEAD(&nse->bvcs);
|
2020-11-26 17:19:21 +00:00
|
|
|
|
|
|
|
return nse;
|
|
|
|
}
|
|
|
|
|
|
|
|
void gbproxy_nse_free(struct gbproxy_nse *nse)
|
|
|
|
{
|
2020-12-04 21:24:47 +00:00
|
|
|
struct gbproxy_bvc *bvc, *tmp;
|
2020-12-04 16:38:46 +00:00
|
|
|
if (!nse)
|
|
|
|
return;
|
2020-11-26 17:19:21 +00:00
|
|
|
|
2020-12-04 23:31:07 +00:00
|
|
|
hash_del(&nse->list);
|
2020-11-26 17:19:21 +00:00
|
|
|
|
2020-12-04 21:24:47 +00:00
|
|
|
llist_for_each_entry_safe(bvc, tmp, &nse->bvcs, list)
|
|
|
|
gbproxy_bvc_free(bvc);
|
2020-11-26 17:19:21 +00:00
|
|
|
|
|
|
|
talloc_free(nse);
|
|
|
|
}
|
|
|
|
|
|
|
|
struct gbproxy_nse *gbproxy_nse_by_nsei(struct gbproxy_config *cfg, uint16_t nsei)
|
|
|
|
{
|
|
|
|
struct gbproxy_nse *nse;
|
|
|
|
OSMO_ASSERT(cfg);
|
|
|
|
|
2020-12-04 23:31:07 +00:00
|
|
|
hash_for_each_possible(cfg->bss_nses, nse, list, nsei) {
|
2020-11-26 17:19:21 +00:00
|
|
|
if (nse->nsei == nsei)
|
|
|
|
return nse;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct gbproxy_nse *gbproxy_nse_by_nsei_or_new(struct gbproxy_config *cfg, uint16_t nsei)
|
|
|
|
{
|
|
|
|
struct gbproxy_nse *nse;
|
|
|
|
OSMO_ASSERT(cfg);
|
|
|
|
|
|
|
|
nse = gbproxy_nse_by_nsei(cfg, nsei);
|
|
|
|
if (!nse)
|
|
|
|
nse = gbproxy_nse_alloc(cfg, nsei);
|
|
|
|
|
|
|
|
return nse;
|
2020-12-04 21:24:47 +00:00
|
|
|
}
|