gb_proxy: Rename gbproxy_peer to gbproxy_bvc
I cannot really read the code while it contains its historical weird
naming. A "peer" used to be a strange amalgamation of NSE + BVC,
while in reality we can have any number of BVC on top of each NSE.
We recently started to split the peer into a gbproxy_nse_peer + gbproxy_peer.
This takes it one step further and renames gbproxy_peer to gbproxy_bvc,
as that's really what it is.
Change-Id: Iae01067282a6401f6af4cab731202872d2cdb080
diff --git a/src/gbproxy/gb_proxy.c b/src/gbproxy/gb_proxy.c
index c130466..94944f9 100644
--- a/src/gbproxy/gb_proxy.c
+++ b/src/gbproxy/gb_proxy.c
@@ -77,21 +77,21 @@
.class_id = OSMO_STATS_CLASS_GLOBAL,
};
-static int gbprox_relay2peer(struct msgb *old_msg, struct gbproxy_peer *peer,
+static int gbprox_relay2peer(struct msgb *old_msg, struct gbproxy_bvc *bvc,
uint16_t ns_bvci);
static int gbprox_relay2sgsn(struct gbproxy_config *cfg, struct msgb *old_msg,
uint16_t ns_bvci, uint16_t sgsn_nsei);
static void gbproxy_reset_imsi_acquisition(struct gbproxy_link_info* link_info);
-static int check_peer_nsei(struct gbproxy_peer *peer, uint16_t nsei)
+static int check_bvc_nsei(struct gbproxy_bvc *bvc, uint16_t nsei)
{
- OSMO_ASSERT(peer);
- OSMO_ASSERT(peer->nse);
+ OSMO_ASSERT(bvc);
+ OSMO_ASSERT(bvc->nse);
- if (peer->nse->nsei != nsei) {
- LOGPBVC(peer, LOGL_NOTICE, "Peer entry doesn't match current NSEI "
+ if (bvc->nse->nsei != nsei) {
+ LOGPBVC(bvc, LOGL_NOTICE, "Peer entry doesn't match current NSEI "
"via NSE(%05u/BSS)\n", nsei);
- rate_ctr_inc(&peer->ctrg->ctr[GBPROX_PEER_CTR_INV_NSEI]);
+ rate_ctr_inc(&bvc->ctrg->ctr[GBPROX_PEER_CTR_INV_NSEI]);
return 0;
}
@@ -190,16 +190,16 @@
msgb_tlli(msg) = tlli;
}
-/* update peer according to the BSS message */
+/* update bvc according to the BSS message */
static void gbprox_update_current_raid(uint8_t *raid_enc,
- struct gbproxy_peer *peer,
+ struct gbproxy_bvc *bvc,
const char *log_text)
{
- struct gbproxy_patch_state *state = &peer->patch_state;
+ struct gbproxy_patch_state *state = &bvc->patch_state;
const struct osmo_plmn_id old_plmn = state->local_plmn;
struct gprs_ra_id raid;
- OSMO_ASSERT(peer->nse);
- struct gbproxy_config *cfg = peer->nse->cfg;
+ OSMO_ASSERT(bvc->nse);
+ struct gbproxy_config *cfg = bvc->nse->cfg;
OSMO_ASSERT(cfg);
if (!raid_enc)
@@ -225,7 +225,7 @@
}
if (osmo_plmn_cmp(&old_plmn, &state->local_plmn))
- LOGPBVC(peer, LOGL_NOTICE,
+ LOGPBVC(bvc, LOGL_NOTICE,
"Patching RAID %sactivated, msg: %s, "
"local: %s, core: %s\n",
state->local_plmn.mcc || state->local_plmn.mnc ?
@@ -235,12 +235,12 @@
osmo_plmn_name2(&cfg->core_plmn));
}
-uint32_t gbproxy_make_bss_ptmsi(struct gbproxy_peer *peer,
+uint32_t gbproxy_make_bss_ptmsi(struct gbproxy_bvc *bvc,
uint32_t sgsn_ptmsi)
{
uint32_t bss_ptmsi;
int max_retries = 23, rc = 0;
- if (!peer->nse->cfg->patch_ptmsi) {
+ if (!bvc->nse->cfg->patch_ptmsi) {
bss_ptmsi = sgsn_ptmsi;
} else {
do {
@@ -252,24 +252,24 @@
bss_ptmsi = bss_ptmsi | GSM23003_TMSI_SGSN_MASK;
- if (gbproxy_link_info_by_ptmsi(peer, bss_ptmsi))
+ if (gbproxy_link_info_by_ptmsi(bvc, bss_ptmsi))
bss_ptmsi = GSM_RESERVED_TMSI;
} while (bss_ptmsi == GSM_RESERVED_TMSI && max_retries--);
}
if (bss_ptmsi == GSM_RESERVED_TMSI)
- LOGPBVC(peer, LOGL_ERROR, "Failed to allocate a BSS P-TMSI: %d (%s)\n", rc, strerror(-rc));
+ LOGPBVC(bvc, LOGL_ERROR, "Failed to allocate a BSS P-TMSI: %d (%s)\n", rc, strerror(-rc));
return bss_ptmsi;
}
-uint32_t gbproxy_make_sgsn_tlli(struct gbproxy_peer *peer,
+uint32_t gbproxy_make_sgsn_tlli(struct gbproxy_bvc *bvc,
struct gbproxy_link_info *link_info,
uint32_t bss_tlli)
{
uint32_t sgsn_tlli;
int max_retries = 23, rc = 0;
- if (!peer->nse->cfg->patch_ptmsi) {
+ if (!bvc->nse->cfg->patch_ptmsi) {
sgsn_tlli = bss_tlli;
} else if (link_info->sgsn_tlli.ptmsi != GSM_RESERVED_TMSI &&
gprs_tlli_type(bss_tlli) == TLLI_FOREIGN) {
@@ -290,13 +290,13 @@
sgsn_tlli = (sgsn_tlli & 0x7fffffff) | 0x78000000;
- if (gbproxy_link_info_by_any_sgsn_tlli(peer, sgsn_tlli))
+ if (gbproxy_link_info_by_any_sgsn_tlli(bvc, sgsn_tlli))
sgsn_tlli = 0;
} while (!sgsn_tlli && max_retries--);
}
if (!sgsn_tlli)
- LOGPBVC(peer, LOGL_ERROR, "Failed to allocate an SGSN TLLI: %d (%s)\n", rc, strerror(-rc));
+ LOGPBVC(bvc, LOGL_ERROR, "Failed to allocate an SGSN TLLI: %d (%s)\n", rc, strerror(-rc));
return sgsn_tlli;
}
@@ -330,15 +330,15 @@
/* Got identity response with IMSI, assuming the request had
* been generated by the gbproxy */
-static int gbproxy_flush_stored_messages(struct gbproxy_peer *peer,
+static int gbproxy_flush_stored_messages(struct gbproxy_bvc *bvc,
time_t now,
struct gbproxy_link_info* link_info)
{
int rc;
struct msgb *stored_msg;
- OSMO_ASSERT(peer);
- OSMO_ASSERT(peer->nse);
- struct gbproxy_config *cfg = peer->nse->cfg;
+ OSMO_ASSERT(bvc);
+ OSMO_ASSERT(bvc->nse);
+ struct gbproxy_config *cfg = bvc->nse->cfg;
OSMO_ASSERT(cfg);
/* Patch and flush stored messages towards the SGSN */
@@ -354,13 +354,13 @@
&tmp_parse_ctx);
gbproxy_patch_bssgp(stored_msg, msgb_bssgph(stored_msg),
msgb_bssgp_len(stored_msg),
- peer, link_info, &len_change,
+ bvc, link_info, &len_change,
&tmp_parse_ctx);
- rc = gbproxy_update_link_state_after(peer, link_info, now,
+ rc = gbproxy_update_link_state_after(bvc, link_info, now,
&tmp_parse_ctx);
if (rc == 1) {
- LOGPBVC_CAT(peer, DLLC, LOGL_NOTICE, "link_info deleted while flushing stored messages\n");
+ LOGPBVC_CAT(bvc, DLLC, LOGL_NOTICE, "link_info deleted while flushing stored messages\n");
msgb_free(stored_msg);
return -1;
}
@@ -369,7 +369,7 @@
msgb_bvci(stored_msg), link_info->sgsn_nsei);
if (rc < 0)
- LOGPBVC_CAT(peer, DLLC, LOGL_ERROR,
+ LOGPBVC_CAT(bvc, DLLC, LOGL_ERROR,
"failed to send stored message "
"(%s)\n",
tmp_parse_ctx.llc_msg_name ?
@@ -380,7 +380,7 @@
return 0;
}
-static int gbproxy_gsm48_to_peer(struct gbproxy_peer *peer,
+static int gbproxy_gsm48_to_bvc(struct gbproxy_bvc *bvc,
struct gbproxy_link_info* link_info,
uint16_t bvci,
struct msgb *msg /* Takes msg ownership */)
@@ -397,12 +397,12 @@
gprs_push_bssgp_dl_unitdata(msg, link_info->tlli.current);
msg->l3h = msg->data;
- rc = gbprox_relay2peer(msg, peer, bvci);
+ rc = gbprox_relay2peer(msg, bvc, bvci);
msgb_free(msg);
return rc;
}
-static void gbproxy_acquire_imsi(struct gbproxy_peer *peer,
+static void gbproxy_acquire_imsi(struct gbproxy_bvc *bvc,
struct gbproxy_link_info* link_info,
uint16_t bvci)
{
@@ -411,10 +411,10 @@
/* Send IDENT REQ */
idreq_msg = gsm48_msgb_alloc_name("GSM 04.08 ACQ IMSI");
gprs_put_identity_req(idreq_msg, GSM_MI_TYPE_IMSI);
- gbproxy_gsm48_to_peer(peer, link_info, bvci, idreq_msg);
+ gbproxy_gsm48_to_bvc(bvc, link_info, bvci, idreq_msg);
}
-static void gbproxy_tx_detach_acc(struct gbproxy_peer *peer,
+static void gbproxy_tx_detach_acc(struct gbproxy_bvc *bvc,
struct gbproxy_link_info* link_info,
uint16_t bvci)
{
@@ -423,20 +423,20 @@
/* Send DETACH ACC */
detacc_msg = gsm48_msgb_alloc_name("GSM 04.08 DET ACC");
gprs_put_mo_detach_acc(detacc_msg);
- gbproxy_gsm48_to_peer(peer, link_info, bvci, detacc_msg);
+ gbproxy_gsm48_to_bvc(bvc, link_info, bvci, detacc_msg);
}
/* Return != 0 iff msg still needs to be processed */
-static int gbproxy_imsi_acquisition(struct gbproxy_peer *peer,
+static int gbproxy_imsi_acquisition(struct gbproxy_bvc *bvc,
struct msgb *msg,
time_t now,
struct gbproxy_link_info* link_info,
struct gprs_gb_parse_context *parse_ctx)
{
struct msgb *stored_msg;
- OSMO_ASSERT(peer);
- OSMO_ASSERT(peer->nse);
- struct gbproxy_config *cfg = peer->nse->cfg;
+ OSMO_ASSERT(bvc);
+ OSMO_ASSERT(bvc->nse);
+ struct gbproxy_config *cfg = bvc->nse->cfg;
OSMO_ASSERT(cfg);
if (!link_info)
@@ -451,7 +451,7 @@
case GSM48_MT_GMM_RA_UPD_REQ:
case GSM48_MT_GMM_ATTACH_REQ:
if (gbproxy_restart_imsi_acquisition(link_info)) {
- LOGPBVC_CAT(peer, DLLC, LOGL_INFO,
+ LOGPBVC_CAT(bvc, DLLC, LOGL_INFO,
" IMSI acquisition was in progress "
"when receiving an %s.\n",
parse_ctx->llc_msg_name);
@@ -460,19 +460,19 @@
case GSM48_MT_GMM_DETACH_REQ:
/* Nothing has been sent to the SGSN yet */
if (link_info->imsi_acq_pending) {
- LOGPBVC_CAT(peer, DLLC, LOGL_INFO,
+ LOGPBVC_CAT(bvc, DLLC, LOGL_INFO,
"IMSI acquisition was in progress "
"when receiving a DETACH_REQ.\n");
}
if (!parse_ctx->invalidate_tlli) {
- LOGPBVC_CAT(peer, DLLC, LOGL_INFO,
+ LOGPBVC_CAT(bvc, DLLC, LOGL_INFO,
"IMSI not yet acquired, "
"faking a DETACH_ACC.\n");
- gbproxy_tx_detach_acc(peer, link_info, msgb_bvci(msg));
+ gbproxy_tx_detach_acc(bvc, link_info, msgb_bvci(msg));
parse_ctx->invalidate_tlli = 1;
}
gbproxy_reset_imsi_acquisition(link_info);
- gbproxy_update_link_state_after(peer, link_info, now,
+ gbproxy_update_link_state_after(bvc, link_info, now,
parse_ctx);
return 0;
}
@@ -483,13 +483,13 @@
gsm48_hdr_pdisc(parse_ctx->g48_hdr) == GSM48_PDISC_MM_GPRS &&
gsm48_hdr_msg_type(parse_ctx->g48_hdr) == GSM48_MT_GMM_ID_RESP;
- LOGPBVC_CAT(peer, DLLC, LOGL_DEBUG,
+ LOGPBVC_CAT(bvc, DLLC, LOGL_DEBUG,
"IMSI acquisition succeeded, "
"flushing stored messages\n");
/* The IMSI is now available. If flushing the messages fails,
* then link_info has been deleted and we should return
* immediately. */
- if (gbproxy_flush_stored_messages(peer, now, link_info) < 0)
+ if (gbproxy_flush_stored_messages(bvc, now, link_info) < 0)
return 0;
gbproxy_reset_imsi_acquisition(link_info);
@@ -511,7 +511,7 @@
struct msgb *msgb_drop;
msgb_drop = msgb_dequeue_count(&link_info->stored_msgs,
&link_info->stored_msgs_len);
- LOGPBVC_CAT(peer, DLLC, LOGL_INFO,
+ LOGPBVC_CAT(bvc, DLLC, LOGL_INFO,
"Dropping stored msgb from list "
"(!acq imsi, length %d, max_len exceeded)\n",
link_info->stored_msgs_len);
@@ -521,7 +521,7 @@
}
/* Enqueue unpatched messages */
- LOGPBVC_CAT(peer, DLLC, LOGL_INFO,
+ LOGPBVC_CAT(bvc, DLLC, LOGL_INFO,
"IMSI acquisition in progress, "
"storing message (%s)\n",
parse_ctx->llc_msg_name ? parse_ctx->llc_msg_name : "BSSGP");
@@ -531,12 +531,12 @@
&link_info->stored_msgs_len);
if (!link_info->imsi_acq_pending) {
- LOGPBVC_CAT(peer, DLLC, LOGL_INFO,
+ LOGPBVC_CAT(bvc, DLLC, LOGL_INFO,
"IMSI is required but not available, "
"initiating identification procedure (%s)\n",
parse_ctx->llc_msg_name ? parse_ctx->llc_msg_name : "BSSGP");
- gbproxy_acquire_imsi(peer, link_info, msgb_bvci(msg));
+ gbproxy_acquire_imsi(bvc, link_info, msgb_bvci(msg));
/* There is no explicit retransmission handling, the
* implementation relies on the MS doing proper retransmissions
@@ -548,37 +548,37 @@
return 0;
}
-struct gbproxy_peer *gbproxy_find_peer(struct gbproxy_config *cfg,
+struct gbproxy_bvc *gbproxy_find_bvc(struct gbproxy_config *cfg,
struct msgb *msg,
struct gprs_gb_parse_context *parse_ctx)
{
- struct gbproxy_peer *peer = NULL;
+ struct gbproxy_bvc *bvc = NULL;
if (msgb_bvci(msg) >= 2)
- peer = gbproxy_peer_by_bvci(cfg, msgb_bvci(msg));
+ bvc = gbproxy_bvc_by_bvci(cfg, msgb_bvci(msg));
- if (!peer && !parse_ctx->to_bss)
- peer = gbproxy_peer_by_nsei(cfg, msgb_nsei(msg));
+ if (!bvc && !parse_ctx->to_bss)
+ bvc = gbproxy_bvc_by_nsei(cfg, msgb_nsei(msg));
- if (!peer)
- peer = gbproxy_peer_by_bssgp_tlv(cfg, &parse_ctx->bssgp_tp);
+ if (!bvc)
+ bvc = gbproxy_bvc_by_bssgp_tlv(cfg, &parse_ctx->bssgp_tp);
- if (!peer) {
+ if (!bvc) {
LOGP(DLLC, LOGL_INFO,
- "NSE(%05u/%s) patching: didn't find peer for message, "
+ "NSE(%05u/%s) patching: didn't find bvc for message, "
"PDU %d\n",
msgb_nsei(msg), parse_ctx->to_bss ? "BSS" : "SGSN",
parse_ctx->pdu_type);
/* Increment counter */
rate_ctr_inc(&cfg->ctrg->ctr[GBPROX_GLOB_CTR_PATCH_PEER_ERR]);
}
- return peer;
+ return bvc;
}
/* patch BSSGP message */
static int gbprox_process_bssgp_ul(struct gbproxy_config *cfg,
struct msgb *msg,
- struct gbproxy_peer *peer)
+ struct gbproxy_bvc *bvc)
{
struct gprs_gb_parse_context parse_ctx = {0};
int rc;
@@ -610,49 +610,49 @@
return 0;
}
- /* Get peer */
- if (!peer)
- peer = gbproxy_find_peer(cfg, msg, &parse_ctx);
+ /* Get bvc */
+ if (!bvc)
+ bvc = gbproxy_find_bvc(cfg, msg, &parse_ctx);
- if (!peer)
+ if (!bvc)
return 0;
osmo_clock_gettime(CLOCK_MONOTONIC, &ts);
now = ts.tv_sec;
- gbprox_update_current_raid(parse_ctx.bssgp_raid_enc, peer,
+ gbprox_update_current_raid(parse_ctx.bssgp_raid_enc, bvc,
parse_ctx.llc_msg_name);
gprs_gb_log_parse_context(LOGL_DEBUG, &parse_ctx, "NS_UNITDATA");
- link_info = gbproxy_update_link_state_ul(peer, now, &parse_ctx);
+ link_info = gbproxy_update_link_state_ul(bvc, now, &parse_ctx);
if (parse_ctx.g48_hdr) {
switch (parse_ctx.g48_hdr->msg_type) {
case GSM48_MT_GMM_ATTACH_REQ:
- rate_ctr_inc(&peer->ctrg->ctr[GBPROX_PEER_CTR_ATTACH_REQS]);
+ rate_ctr_inc(&bvc->ctrg->ctr[GBPROX_PEER_CTR_ATTACH_REQS]);
break;
case GSM48_MT_GMM_DETACH_REQ:
- rate_ctr_inc(&peer->ctrg->ctr[GBPROX_PEER_CTR_DETACH_REQS]);
+ rate_ctr_inc(&bvc->ctrg->ctr[GBPROX_PEER_CTR_DETACH_REQS]);
break;
case GSM48_MT_GMM_ATTACH_COMPL:
- rate_ctr_inc(&peer->ctrg->ctr[GBPROX_PEER_CTR_ATTACH_COMPLS]);
+ rate_ctr_inc(&bvc->ctrg->ctr[GBPROX_PEER_CTR_ATTACH_COMPLS]);
break;
case GSM48_MT_GMM_RA_UPD_REQ:
- rate_ctr_inc(&peer->ctrg->ctr[GBPROX_PEER_CTR_RA_UPD_REQS]);
+ rate_ctr_inc(&bvc->ctrg->ctr[GBPROX_PEER_CTR_RA_UPD_REQS]);
break;
case GSM48_MT_GMM_RA_UPD_COMPL:
- rate_ctr_inc(&peer->ctrg->ctr[GBPROX_PEER_CTR_RA_UPD_COMPLS]);
+ rate_ctr_inc(&bvc->ctrg->ctr[GBPROX_PEER_CTR_RA_UPD_COMPLS]);
break;
case GSM48_MT_GMM_STATUS:
- rate_ctr_inc(&peer->ctrg->ctr[GBPROX_PEER_CTR_GMM_STATUS_BSS]);
+ rate_ctr_inc(&bvc->ctrg->ctr[GBPROX_PEER_CTR_GMM_STATUS_BSS]);
break;
case GSM48_MT_GSM_ACT_PDP_REQ:
- rate_ctr_inc(&peer->ctrg->ctr[GBPROX_PEER_CTR_PDP_ACT_REQS]);
+ rate_ctr_inc(&bvc->ctrg->ctr[GBPROX_PEER_CTR_PDP_ACT_REQS]);
break;
case GSM48_MT_GSM_DEACT_PDP_REQ:
- rate_ctr_inc(&peer->ctrg->ctr[GBPROX_PEER_CTR_PDP_DEACT_REQS]);
+ rate_ctr_inc(&bvc->ctrg->ctr[GBPROX_PEER_CTR_PDP_DEACT_REQS]);
break;
default:
@@ -673,16 +673,16 @@
/* Handle IMSI acquisition */
if (cfg->acquire_imsi) {
- rc = gbproxy_imsi_acquisition(peer, msg, now, link_info,
+ rc = gbproxy_imsi_acquisition(bvc, msg, now, link_info,
&parse_ctx);
if (rc <= 0)
return rc;
}
gbproxy_patch_bssgp(msg, msgb_bssgph(msg), msgb_bssgp_len(msg),
- peer, link_info, &len_change, &parse_ctx);
+ bvc, link_info, &len_change, &parse_ctx);
- gbproxy_update_link_state_after(peer, link_info, now, &parse_ctx);
+ gbproxy_update_link_state_after(bvc, link_info, now, &parse_ctx);
if (sgsn_nsei != cfg->nsip_sgsn_nsei) {
/* Send message directly to the selected SGSN */
@@ -697,7 +697,7 @@
/* patch BSSGP message to use core_plmn.mcc/mnc on the SGSN side */
static void gbprox_process_bssgp_dl(struct gbproxy_config *cfg,
struct msgb *msg,
- struct gbproxy_peer *peer)
+ struct gbproxy_bvc *bvc)
{
struct gprs_gb_parse_context parse_ctx = {0};
int rc;
@@ -727,11 +727,11 @@
return;
}
- /* Get peer */
- if (!peer)
- peer = gbproxy_find_peer(cfg, msg, &parse_ctx);
+ /* Get bvc */
+ if (!bvc)
+ bvc = gbproxy_find_bvc(cfg, msg, &parse_ctx);
- if (!peer)
+ if (!bvc)
return;
osmo_clock_gettime(CLOCK_MONOTONIC, &ts);
@@ -740,31 +740,31 @@
if (parse_ctx.g48_hdr) {
switch (parse_ctx.g48_hdr->msg_type) {
case GSM48_MT_GMM_ATTACH_ACK:
- rate_ctr_inc(&peer->ctrg->ctr[GBPROX_PEER_CTR_ATTACH_ACKS]);
+ rate_ctr_inc(&bvc->ctrg->ctr[GBPROX_PEER_CTR_ATTACH_ACKS]);
break;
case GSM48_MT_GMM_ATTACH_REJ:
- rate_ctr_inc(&peer->ctrg->ctr[GBPROX_PEER_CTR_ATTACH_REJS]);
+ rate_ctr_inc(&bvc->ctrg->ctr[GBPROX_PEER_CTR_ATTACH_REJS]);
break;
case GSM48_MT_GMM_DETACH_ACK:
- rate_ctr_inc(&peer->ctrg->ctr[GBPROX_PEER_CTR_DETACH_ACKS]);
+ rate_ctr_inc(&bvc->ctrg->ctr[GBPROX_PEER_CTR_DETACH_ACKS]);
break;
case GSM48_MT_GMM_RA_UPD_ACK:
- rate_ctr_inc(&peer->ctrg->ctr[GBPROX_PEER_CTR_RA_UPD_ACKS]);
+ rate_ctr_inc(&bvc->ctrg->ctr[GBPROX_PEER_CTR_RA_UPD_ACKS]);
break;
case GSM48_MT_GMM_RA_UPD_REJ:
- rate_ctr_inc(&peer->ctrg->ctr[GBPROX_PEER_CTR_RA_UPD_REJS]);
+ rate_ctr_inc(&bvc->ctrg->ctr[GBPROX_PEER_CTR_RA_UPD_REJS]);
break;
case GSM48_MT_GMM_STATUS:
- rate_ctr_inc(&peer->ctrg->ctr[GBPROX_PEER_CTR_GMM_STATUS_SGSN]);
+ rate_ctr_inc(&bvc->ctrg->ctr[GBPROX_PEER_CTR_GMM_STATUS_SGSN]);
break;
case GSM48_MT_GSM_ACT_PDP_ACK:
- rate_ctr_inc(&peer->ctrg->ctr[GBPROX_PEER_CTR_PDP_ACT_ACKS]);
+ rate_ctr_inc(&bvc->ctrg->ctr[GBPROX_PEER_CTR_PDP_ACT_ACKS]);
break;
case GSM48_MT_GSM_ACT_PDP_REJ:
- rate_ctr_inc(&peer->ctrg->ctr[GBPROX_PEER_CTR_PDP_ACT_REJS]);
+ rate_ctr_inc(&bvc->ctrg->ctr[GBPROX_PEER_CTR_PDP_ACT_REJS]);
break;
case GSM48_MT_GSM_DEACT_PDP_ACK:
- rate_ctr_inc(&peer->ctrg->ctr[GBPROX_PEER_CTR_PDP_DEACT_ACKS]);
+ rate_ctr_inc(&bvc->ctrg->ctr[GBPROX_PEER_CTR_PDP_DEACT_ACKS]);
break;
default:
@@ -774,17 +774,17 @@
gprs_gb_log_parse_context(LOGL_DEBUG, &parse_ctx, "NS_UNITDATA");
- link_info = gbproxy_update_link_state_dl(peer, now, &parse_ctx);
+ link_info = gbproxy_update_link_state_dl(bvc, now, &parse_ctx);
gbproxy_patch_bssgp(msg, msgb_bssgph(msg), msgb_bssgp_len(msg),
- peer, link_info, &len_change, &parse_ctx);
+ bvc, link_info, &len_change, &parse_ctx);
- gbproxy_update_link_state_after(peer, link_info, now, &parse_ctx);
+ gbproxy_update_link_state_after(bvc, link_info, now, &parse_ctx);
return;
}
-/* feed a message down the NS-VC associated with the specified peer */
+/* feed a message down the NS-VC associated with the specified bvc */
static int gbprox_relay2sgsn(struct gbproxy_config *cfg, struct msgb *old_msg,
uint16_t ns_bvci, uint16_t sgsn_nsei)
{
@@ -847,32 +847,32 @@
rc = gprs_ns2_recv_prim(nsi, &nsp.oph);
/* FIXME: We need a counter group for gbproxy_nse */
//if (rc < 0)
- // rate_ctr_inc(&peer->ctrg->ctr[GBPROX_PEER_CTR_TX_ERR]);
+ // rate_ctr_inc(&bvc->ctrg->ctr[GBPROX_PEER_CTR_TX_ERR]);
return rc;
}
-/* feed a message down the NS-VC associated with the specified peer */
-static int gbprox_relay2peer(struct msgb *old_msg, struct gbproxy_peer *peer,
+/* feed a message down the NS-VC associated with the specified bvc */
+static int gbprox_relay2peer(struct msgb *old_msg, struct gbproxy_bvc *bvc,
uint16_t ns_bvci)
{
int rc;
- struct gbproxy_nse *nse = peer->nse;
+ struct gbproxy_nse *nse = bvc->nse;
OSMO_ASSERT(nse);
rc = gbprox_relay2nse(old_msg, nse, ns_bvci);
if (rc < 0)
- rate_ctr_inc(&peer->ctrg->ctr[GBPROX_PEER_CTR_TX_ERR]);
+ rate_ctr_inc(&bvc->ctrg->ctr[GBPROX_PEER_CTR_TX_ERR]);
return rc;
}
-static int block_unblock_peer(struct gbproxy_config *cfg, uint16_t ptp_bvci, uint8_t pdu_type)
+static int block_unblock_bvc(struct gbproxy_config *cfg, uint16_t ptp_bvci, uint8_t pdu_type)
{
- struct gbproxy_peer *peer;
+ struct gbproxy_bvc *bvc;
- peer = gbproxy_peer_by_bvci(cfg, ptp_bvci);
- if (!peer) {
+ bvc = gbproxy_bvc_by_bvci(cfg, ptp_bvci);
+ if (!bvc) {
LOGP(DGPRS, LOGL_ERROR, "BVC(%05u/??) Cannot find BSS\n",
ptp_bvci);
rate_ctr_inc(&cfg->ctrg->ctr[GBPROX_GLOB_CTR_INV_BVCI]);
@@ -881,12 +881,12 @@
switch (pdu_type) {
case BSSGP_PDUT_BVC_BLOCK_ACK:
- peer->blocked = true;
- rate_ctr_inc(&peer->ctrg->ctr[GBPROX_PEER_CTR_BLOCKED]);
+ bvc->blocked = true;
+ rate_ctr_inc(&bvc->ctrg->ctr[GBPROX_PEER_CTR_BLOCKED]);
break;
case BSSGP_PDUT_BVC_UNBLOCK_ACK:
- peer->blocked = false;
- rate_ctr_inc(&peer->ctrg->ctr[GBPROX_PEER_CTR_UNBLOCKED]);
+ bvc->blocked = false;
+ rate_ctr_inc(&bvc->ctrg->ctr[GBPROX_PEER_CTR_UNBLOCKED]);
break;
default:
break;
@@ -894,22 +894,22 @@
return 0;
}
-/* Send a message to a peer identified by ptp_bvci but using ns_bvci
+/* Send a message to a bvc identified by ptp_bvci but using ns_bvci
* in the NS hdr */
static int gbprox_relay2bvci(struct gbproxy_config *cfg, struct msgb *msg, uint16_t ptp_bvci,
uint16_t ns_bvci)
{
- struct gbproxy_peer *peer;
+ struct gbproxy_bvc *bvc;
- peer = gbproxy_peer_by_bvci(cfg, ptp_bvci);
- if (!peer) {
+ bvc = gbproxy_bvc_by_bvci(cfg, ptp_bvci);
+ if (!bvc) {
LOGP(DGPRS, LOGL_ERROR, "BVC(%05u/??) Cannot find BSS\n",
ptp_bvci);
rate_ctr_inc(&cfg->ctrg->ctr[GBPROX_GLOB_CTR_INV_BVCI]);
return -ENOENT;
}
- return gbprox_relay2peer(msg, peer, ns_bvci);
+ return gbprox_relay2peer(msg, bvc, ns_bvci);
}
int bssgp_prim_cb(struct osmo_prim_hdr *oph, void *ctx)
@@ -922,14 +922,14 @@
struct msgb *msg, uint16_t nsei,
uint16_t ns_bvci)
{
- struct gbproxy_peer *peer;
+ struct gbproxy_bvc *bvc;
struct bssgp_normal_hdr *bgph = (struct bssgp_normal_hdr *) msgb_bssgph(msg);
uint8_t pdu_type = bgph->pdu_type;
int rc;
- peer = gbproxy_peer_by_bvci(cfg, ns_bvci);
- if (!peer) {
- LOGP(DGPRS, LOGL_NOTICE, "BVC(%05u/??) Didn't find peer "
+ bvc = gbproxy_bvc_by_bvci(cfg, ns_bvci);
+ if (!bvc) {
+ LOGP(DGPRS, LOGL_NOTICE, "BVC(%05u/??) Didn't find bvc "
"for PTP message from NSE(%05u/BSS), "
"discarding message\n",
ns_bvci, nsei);
@@ -938,9 +938,9 @@
}
/* TODO: Should we discard this message if the check fails */
- check_peer_nsei(peer, nsei);
+ check_bvc_nsei(bvc, nsei);
- rc = gbprox_process_bssgp_ul(cfg, msg, peer);
+ rc = gbprox_process_bssgp_ul(cfg, msg, bvc);
if (!rc)
return 0;
@@ -965,16 +965,16 @@
struct msgb *msg, uint16_t nsei,
uint16_t ns_bvci)
{
- struct gbproxy_peer *peer;
+ struct gbproxy_bvc *bvc;
struct bssgp_normal_hdr *bgph = (struct bssgp_normal_hdr *) msgb_bssgph(msg);
uint8_t pdu_type = bgph->pdu_type;
- peer = gbproxy_peer_by_bvci(cfg, ns_bvci);
+ bvc = gbproxy_bvc_by_bvci(cfg, ns_bvci);
/* Send status messages before patching */
- if (!peer) {
- LOGP(DGPRS, LOGL_INFO, "BVC(%05u/??) Didn't find peer for "
+ if (!bvc) {
+ LOGP(DGPRS, LOGL_INFO, "BVC(%05u/??) Didn't find bvc for "
"for message from NSE(%05u/SGSN)\n",
ns_bvci, nsei);
rate_ctr_inc(&cfg->ctrg->
@@ -983,10 +983,10 @@
&ns_bvci, msg);
}
- if (peer->blocked) {
- LOGPBVC(peer, LOGL_NOTICE, "Dropping PDU for "
+ if (bvc->blocked) {
+ LOGPBVC(bvc, LOGL_NOTICE, "Dropping PDU for "
"blocked BVC via NSE(%05u/SGSN)\n", nsei);
- rate_ctr_inc(&peer->ctrg->ctr[GBPROX_PEER_CTR_DROPPED]);
+ rate_ctr_inc(&bvc->ctrg->ctr[GBPROX_PEER_CTR_DROPPED]);
return bssgp_tx_status(BSSGP_CAUSE_BVCI_BLOCKED, &ns_bvci, msg);
}
@@ -1004,9 +1004,9 @@
}
/* Optionally patch the message */
- gbprox_process_bssgp_dl(cfg, msg, peer);
+ gbprox_process_bssgp_dl(cfg, msg, bvc);
- return gbprox_relay2peer(msg, peer, ns_bvci);
+ return gbprox_relay2peer(msg, bvc, ns_bvci);
}
/* process a BVC-RESET message from the BSS side */
@@ -1014,7 +1014,7 @@
uint16_t nsei, struct tlv_parsed *tp,
int *copy_to_sgsn2)
{
- struct gbproxy_peer *from_peer = NULL;
+ struct gbproxy_bvc *from_bvc = NULL;
uint16_t bvci;
if (!TLVP_PRES_LEN(tp, BSSGP_IE_BVCI, 2) || !TLVP_PRES_LEN(tp, BSSGP_IE_CAUSE, 1)) {
@@ -1029,7 +1029,7 @@
* don't want the SGSN to reset, as the signalling endpoint
* is common for all point-to-point BVCs (and thus all BTS) */
- /* Ensure the NSE peer is there and clear all PtP BVCs */
+ /* Ensure the NSE bvc is there and clear all PtP BVCs */
struct gbproxy_nse *nse = gbproxy_nse_by_nsei_or_new(cfg, nsei);
if (!nse) {
LOGP(DGPRS, LOGL_ERROR, "Could not create NSE(%05u)\n", nsei);
@@ -1037,15 +1037,15 @@
return 0;
}
- gbproxy_cleanup_peers(cfg, nsei, 0);
+ gbproxy_cleanup_bvcs(cfg, nsei, 0);
/* FIXME: only do this if SGSN is alive! */
LOGPNSE(nse, LOGL_INFO, "Tx fake BVC RESET ACK of BVCI=0\n");
bssgp_tx_simple_bvci(BSSGP_PDUT_BVC_RESET_ACK, nsei, 0, 0);
return 0;
} else {
- from_peer = gbproxy_peer_by_bvci(cfg, bvci);
- if (!from_peer) {
+ from_bvc = gbproxy_bvc_by_bvci(cfg, bvci);
+ if (!from_bvc) {
struct gbproxy_nse *nse = gbproxy_nse_by_nsei(cfg, nsei);
if (!nse) {
LOGP(DGPRS, LOGL_NOTICE, "NSE(%05u) Got PtP BVC reset before signalling reset for "
@@ -1054,15 +1054,15 @@
return 0;
}
/* if a PTP-BVC is reset, and we don't know that
- * PTP-BVCI yet, we should allocate a new peer */
- from_peer = gbproxy_peer_alloc(nse, bvci);
- OSMO_ASSERT(from_peer);
- LOGPBVC(from_peer, LOGL_INFO, "Allocated new peer\n");
+ * PTP-BVCI yet, we should allocate a new bvc */
+ from_bvc = gbproxy_bvc_alloc(nse, bvci);
+ OSMO_ASSERT(from_bvc);
+ LOGPBVC(from_bvc, LOGL_INFO, "Allocated new bvc\n");
}
/* Could have moved to a different NSE */
- if (!check_peer_nsei(from_peer, nsei)) {
- LOGPBVC(from_peer, LOGL_NOTICE, "moving peer to NSE(%05u)\n", nsei);
+ if (!check_bvc_nsei(from_bvc, nsei)) {
+ LOGPBVC(from_bvc, LOGL_NOTICE, "moving bvc to NSE(%05u)\n", nsei);
struct gbproxy_nse *nse_new = gbproxy_nse_by_nsei(cfg, nsei);
if (!nse_new) {
@@ -1072,8 +1072,8 @@
return 0;
}
- /* Move peer to different NSE */
- gbproxy_peer_move(from_peer, nse_new);
+ /* Move bvc to different NSE */
+ gbproxy_bvc_move(from_bvc, nse_new);
}
if (TLVP_PRES_LEN(tp, BSSGP_IE_CELL_ID, 8)) {
@@ -1082,9 +1082,9 @@
* PDU, this means we can extend our local
* state information about this particular cell
* */
- memcpy(from_peer->ra, TLVP_VAL(tp, BSSGP_IE_CELL_ID), sizeof(from_peer->ra));
- gsm48_parse_ra(&raid, from_peer->ra);
- LOGPBVC(from_peer, LOGL_INFO, "Cell ID %s\n", osmo_rai_name(&raid));
+ memcpy(from_bvc->ra, TLVP_VAL(tp, BSSGP_IE_CELL_ID), sizeof(from_bvc->ra));
+ gsm48_parse_ra(&raid, from_bvc->ra);
+ LOGPBVC(from_bvc, LOGL_INFO, "Cell ID %s\n", osmo_rai_name(&raid));
}
if (cfg->route_to_sgsn2)
*copy_to_sgsn2 = 1;
@@ -1102,7 +1102,7 @@
struct tlv_parsed tp;
uint8_t pdu_type = bgph->pdu_type;
int data_len = msgb_bssgp_len(msg) - sizeof(*bgph);
- struct gbproxy_peer *from_peer = NULL;
+ struct gbproxy_bvc *from_bvc = NULL;
struct gprs_ra_id raid;
int copy_to_sgsn2 = 0;
int rc;
@@ -1128,19 +1128,19 @@
case BSSGP_PDUT_SUSPEND:
case BSSGP_PDUT_RESUME:
/* We implement RAI snooping during SUSPEND/RESUME, since it
- * establishes a relationsip between BVCI/peer and the routeing
+ * establishes a relationsip between BVCI/bvc and the routeing
* area identification. The snooped information is then used
* for routing the {SUSPEND,RESUME}_[N]ACK back to the correct
* BSSGP */
if (!TLVP_PRES_LEN(&tp, BSSGP_IE_ROUTEING_AREA, 6))
goto err_mand_ie;
- from_peer = gbproxy_peer_by_nsei(cfg, nsei);
- if (!from_peer)
- goto err_no_peer;
- memcpy(from_peer->ra, TLVP_VAL(&tp, BSSGP_IE_ROUTEING_AREA),
- sizeof(from_peer->ra));
- gsm48_parse_ra(&raid, from_peer->ra);
- LOGPBVC(from_peer, LOGL_INFO, "BSSGP SUSPEND/RESUME "
+ from_bvc = gbproxy_bvc_by_nsei(cfg, nsei);
+ if (!from_bvc)
+ goto err_no_bvc;
+ memcpy(from_bvc->ra, TLVP_VAL(&tp, BSSGP_IE_ROUTEING_AREA),
+ sizeof(from_bvc->ra));
+ gsm48_parse_ra(&raid, from_bvc->ra);
+ LOGPBVC(from_bvc, LOGL_INFO, "BSSGP SUSPEND/RESUME "
"RAI snooping: RAI %s\n",
osmo_rai_name(&raid));
/* FIXME: This only supports one BSS per RA */
@@ -1155,7 +1155,7 @@
/* Normally, we can simply pass on all signalling messages from BSS to
* SGSN */
- rc = gbprox_process_bssgp_ul(cfg, msg, from_peer);
+ rc = gbprox_process_bssgp_ul(cfg, msg, from_bvc);
if (!rc)
return 0;
@@ -1163,8 +1163,8 @@
gbprox_relay2sgsn(cfg, msg, ns_bvci, cfg->nsip_sgsn2_nsei);
return gbprox_relay2sgsn(cfg, msg, ns_bvci, cfg->nsip_sgsn_nsei);
-err_no_peer:
- LOGP(DGPRS, LOGL_ERROR, "NSE(%05u/BSS) cannot find peer based on NSEI\n",
+err_no_bvc:
+ LOGP(DGPRS, LOGL_ERROR, "NSE(%05u/BSS) cannot find bvc based on NSEI\n",
nsei);
rate_ctr_inc(&cfg->ctrg->ctr[GBPROX_GLOB_CTR_INV_NSEI]);
return bssgp_tx_status(BSSGP_CAUSE_INV_MAND_INF, NULL, msg);
@@ -1180,7 +1180,7 @@
uint32_t nsei, uint16_t ns_bvci)
{
struct gbproxy_nse *nse;
- struct gbproxy_peer *peer;
+ struct gbproxy_bvc *bvc;
unsigned int n_nses = 0;
int errctr = GBPROX_GLOB_CTR_PROTO_ERR_SGSN;
@@ -1191,21 +1191,21 @@
if (TLVP_PRES_LEN(tp, BSSGP_IE_BVCI, 2)) {
uint16_t bvci = ntohs(tlvp_val16_unal(tp, BSSGP_IE_BVCI));
errctr = GBPROX_GLOB_CTR_OTHER_ERR;
- peer = gbproxy_peer_by_bvci(cfg, bvci);
- if (!peer) {
+ bvc = gbproxy_bvc_by_bvci(cfg, bvci);
+ if (!bvc) {
LOGP(DGPRS, LOGL_NOTICE, "NSE(%05u/SGSN) BSSGP PAGING: "
"unable to route: BVCI=%05u unknown\n", nsei, bvci);
rate_ctr_inc(&cfg->ctrg->ctr[errctr]);
return -EINVAL;
}
- LOGPBVC(peer, LOGL_INFO, "routing by BVCI\n");
- return gbprox_relay2peer(msg, peer, ns_bvci);
+ LOGPBVC(bvc, LOGL_INFO, "routing by BVCI\n");
+ return gbprox_relay2peer(msg, bvc, ns_bvci);
} else if (TLVP_PRES_LEN(tp, BSSGP_IE_ROUTEING_AREA, 6)) {
errctr = GBPROX_GLOB_CTR_INV_RAI;
- /* iterate over all peers and dispatch the paging to each matching one */
- llist_for_each_entry(nse, &cfg->nse_peers, list) {
- llist_for_each_entry(peer, &nse->bts_peers, list) {
- if (!memcmp(peer->ra, TLVP_VAL(tp, BSSGP_IE_ROUTEING_AREA), 6)) {
+ /* iterate over all bvcs and dispatch the paging to each matching one */
+ llist_for_each_entry(nse, &cfg->nses, list) {
+ llist_for_each_entry(bvc, &nse->bvcs, list) {
+ if (!memcmp(bvc->ra, TLVP_VAL(tp, BSSGP_IE_ROUTEING_AREA), 6)) {
LOGPNSE(nse, LOGL_INFO, "routing to NSE (RAI match)\n");
gbprox_relay2nse(msg, nse, ns_bvci);
n_nses++;
@@ -1216,10 +1216,10 @@
}
} else if (TLVP_PRES_LEN(tp, BSSGP_IE_LOCATION_AREA, 5)) {
errctr = GBPROX_GLOB_CTR_INV_LAI;
- /* iterate over all peers and dispatch the paging to each matching one */
- llist_for_each_entry(nse, &cfg->nse_peers, list) {
- llist_for_each_entry(peer, &nse->bts_peers, list) {
- if (!memcmp(peer->ra, TLVP_VAL(tp, BSSGP_IE_LOCATION_AREA), 5)) {
+ /* iterate over all bvcs and dispatch the paging to each matching one */
+ llist_for_each_entry(nse, &cfg->nses, list) {
+ llist_for_each_entry(bvc, &nse->bvcs, list) {
+ if (!memcmp(bvc->ra, TLVP_VAL(tp, BSSGP_IE_LOCATION_AREA), 5)) {
LOGPNSE(nse, LOGL_INFO, "routing to NSE (LAI match)\n");
gbprox_relay2nse(msg, nse, ns_bvci);
n_nses++;
@@ -1229,9 +1229,9 @@
}
}
} else if (TLVP_PRES_LEN(tp, BSSGP_IE_BSS_AREA_ID, 1)) {
- /* iterate over all peers and dispatch the paging to each matching one */
- llist_for_each_entry(nse, &cfg->nse_peers, list) {
- llist_for_each_entry(peer, &nse->bts_peers, list) {
+ /* iterate over all bvcs and dispatch the paging to each matching one */
+ llist_for_each_entry(nse, &cfg->nses, list) {
+ llist_for_each_entry(bvc, &nse->bvcs, list) {
LOGPNSE(nse, LOGL_INFO, "routing to NSE (broadcast)\n");
gbprox_relay2nse(msg, nse, ns_bvci);
n_nses++;
@@ -1261,7 +1261,7 @@
uint32_t nsei, uint16_t ns_bvci)
{
struct gbproxy_nse *nse;
- struct gbproxy_peer *peer;
+ struct gbproxy_bvc *bvc;
uint16_t ptp_bvci;
if (!TLVP_PRES_LEN(tp, BSSGP_IE_BVCI, 2)) {
@@ -1274,9 +1274,9 @@
if (ptp_bvci >= 2) {
/* A reset for a PTP BVC was received, forward it to its
- * respective peer */
- peer = gbproxy_peer_by_bvci(cfg, ptp_bvci);
- if (!peer) {
+ * respective bvc */
+ bvc = gbproxy_bvc_by_bvci(cfg, ptp_bvci);
+ if (!bvc) {
LOGP(DGPRS, LOGL_ERROR, "NSE(%05u/SGSN) BVCI=%05u: Cannot find BSS\n",
nsei, ptp_bvci);
rate_ctr_inc(&cfg->ctrg->
@@ -1284,16 +1284,16 @@
return bssgp_tx_status(BSSGP_CAUSE_UNKNOWN_BVCI,
&ptp_bvci, orig_msg);
}
- return gbprox_relay2peer(msg, peer, ns_bvci);
+ return gbprox_relay2peer(msg, bvc, ns_bvci);
}
/* A reset for the Signalling entity has been received
* from the SGSN. As the signalling BVCI is shared
* among all the BSS's that we multiplex, it needs to
* be relayed */
- llist_for_each_entry(nse, &cfg->nse_peers, list) {
- llist_for_each_entry(peer, &nse->bts_peers, list)
- gbprox_relay2peer(msg, peer, ns_bvci);
+ llist_for_each_entry(nse, &cfg->nses, list) {
+ llist_for_each_entry(bvc, &nse->bvcs, list)
+ gbprox_relay2peer(msg, bvc, ns_bvci);
}
return 0;
@@ -1310,7 +1310,7 @@
uint8_t pdu_type = bgph->pdu_type;
int data_len;
struct gbproxy_nse *nse;
- struct gbproxy_peer *peer;
+ struct gbproxy_bvc *bvc;
uint16_t bvci;
struct msgb *msg;
int rc = 0;
@@ -1397,10 +1397,10 @@
/* RAI IE is mandatory */
if (!TLVP_PRES_LEN(&tp, BSSGP_IE_ROUTEING_AREA, 6))
goto err_mand_ie;
- peer = gbproxy_peer_by_rai(cfg, TLVP_VAL(&tp, BSSGP_IE_ROUTEING_AREA));
- if (!peer)
- goto err_no_peer;
- rc = gbprox_relay2peer(msg, peer, ns_bvci);
+ bvc = gbproxy_bvc_by_rai(cfg, TLVP_VAL(&tp, BSSGP_IE_ROUTEING_AREA));
+ if (!bvc)
+ goto err_no_bvc;
+ rc = gbprox_relay2peer(msg, bvc, ns_bvci);
break;
case BSSGP_PDUT_BVC_BLOCK_ACK:
case BSSGP_PDUT_BVC_UNBLOCK_ACK:
@@ -1416,7 +1416,7 @@
ctr[GBPROX_GLOB_CTR_INV_BVCI]);
} else {
/* Mark BVC as (un)blocked */
- block_unblock_peer(cfg, bvci, pdu_type);
+ block_unblock_bvc(cfg, bvci, pdu_type);
}
rc = gbprox_relay2bvci(cfg, msg, bvci, ns_bvci);
break;
@@ -1424,8 +1424,8 @@
case BSSGP_PDUT_OVERLOAD:
LOGP(DGPRS, LOGL_DEBUG,
"NSE(%05u/SGSN) BSSGP %s: broadcasting\n", nsei, bssgp_pdu_str(pdu_type));
- /* broadcast to all BSS-side peers */
- llist_for_each_entry(nse, &cfg->nse_peers, list) {
+ /* broadcast to all BSS-side bvcs */
+ llist_for_each_entry(nse, &cfg->nses, list) {
gbprox_relay2nse(msg, nse, 0);
}
break;
@@ -1448,8 +1448,8 @@
ctr[GBPROX_GLOB_CTR_PROTO_ERR_SGSN]);
msgb_free(msg);
return bssgp_tx_status(BSSGP_CAUSE_MISSING_MAND_IE, NULL, orig_msg);
-err_no_peer:
- LOGP(DGPRS, LOGL_ERROR, "NSE(%05u/SGSN) cannot find peer based on RAI\n",
+err_no_bvc:
+ LOGP(DGPRS, LOGL_ERROR, "NSE(%05u/SGSN) cannot find bvc based on RAI\n",
nsei);
rate_ctr_inc(&cfg->ctrg-> ctr[GBPROX_GLOB_CTR_INV_RAI]);
msgb_free(msg);
@@ -1519,10 +1519,10 @@
void gprs_ns_prim_status_cb(struct gbproxy_config *cfg, struct osmo_gprs_ns2_prim *nsp)
{
- /* TODO: bss nsei available/unavailable bssgp_tx_simple_bvci(BSSGP_PDUT_BVC_BLOCK, nsvc->nsei, peer->bvci, 0);
+ /* TODO: bss nsei available/unavailable bssgp_tx_simple_bvci(BSSGP_PDUT_BVC_BLOCK, nsvc->nsei, bvc->bvci, 0);
* TODO: sgsn nsei available/unavailable
*/
- struct gbproxy_peer *peer;
+ struct gbproxy_bvc *bvc;
switch (nsp->u.status.cause) {
case NS_AFF_CAUSE_SNS_FAILURE:
@@ -1549,18 +1549,18 @@
} else {
/* bss became unavailable
* TODO: Block all BVC belonging to that NSE */
- peer = gbproxy_peer_by_nsei(cfg, nsp->nsei);
- if (!peer) {
+ bvc = gbproxy_bvc_by_nsei(cfg, nsp->nsei);
+ if (!bvc) {
/* TODO: use primitive name + status cause name */
- LOGP(DGPRS, LOGL_NOTICE, "Received ns2 primitive %d for unknown peer NSEI=%u\n",
+ LOGP(DGPRS, LOGL_NOTICE, "Received ns2 primitive %d for unknown bvc NSEI=%u\n",
nsp->u.status.cause, nsp->nsei);
break;
}
- if (!peer->blocked)
+ if (!bvc->blocked)
break;
bssgp_tx_simple_bvci(BSSGP_PDUT_BVC_BLOCK, cfg->nsip_sgsn_nsei,
- peer->bvci, 0);
+ bvc->bvci, 0);
}
LOGP(DPCU, LOGL_NOTICE, "NS-NSE %d became unavailable\n", nsp->nsei);
break;
@@ -1620,10 +1620,10 @@
{
struct gbproxy_nse *nse, *ntmp;
- llist_for_each_entry_safe(nse, ntmp, &cfg->nse_peers, list) {
- struct gbproxy_peer *peer, *tmp;
- llist_for_each_entry_safe(peer, tmp, &nse->bts_peers, list)
- gbproxy_peer_free(peer);
+ llist_for_each_entry_safe(nse, ntmp, &cfg->nses, list) {
+ struct gbproxy_bvc *bvc, *tmp;
+ llist_for_each_entry_safe(bvc, tmp, &nse->bvcs, list)
+ gbproxy_bvc_free(bvc);
gbproxy_nse_free(nse);
}
@@ -1636,7 +1636,7 @@
{
struct timespec tp;
- INIT_LLIST_HEAD(&cfg->nse_peers);
+ INIT_LLIST_HEAD(&cfg->nses);
cfg->ctrg = rate_ctr_group_alloc(tall_sgsn_ctx, &global_ctrg_desc, 0);
if (!cfg->ctrg) {
LOGP(DGPRS, LOGL_ERROR, "Cannot allocate global counter group!\n");