aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Willmann <dwillmann@sysmocom.de>2020-11-30 17:14:24 +0100
committerDaniel Willmann <dwillmann@sysmocom.de>2020-11-30 18:30:35 +0100
commit9e583c8d893a0eb902dc7ef772f2f069188a7a69 (patch)
tree3f0a2a5514f08962e7ae93a368b6e29a57a98ce5
parent5937dfd39f11d205b73126a6350544af97e43814 (diff)
gbproxy: Separate function to move gbproxy_peer to different nse
-rw-r--r--include/osmocom/sgsn/gb_proxy.h1
-rw-r--r--src/gbproxy/gb_proxy.c4
-rw-r--r--src/gbproxy/gb_proxy_peer.c7
3 files changed, 9 insertions, 3 deletions
diff --git a/include/osmocom/sgsn/gb_proxy.h b/include/osmocom/sgsn/gb_proxy.h
index 54d4548c..9f91bd68 100644
--- a/include/osmocom/sgsn/gb_proxy.h
+++ b/include/osmocom/sgsn/gb_proxy.h
@@ -344,6 +344,7 @@ struct gbproxy_peer *gbproxy_peer_by_bssgp_tlv(
struct gbproxy_config *cfg, struct tlv_parsed *tp);
struct gbproxy_peer *gbproxy_peer_alloc(struct gbproxy_nse *nse, uint16_t bvci);
void gbproxy_peer_free(struct gbproxy_peer *peer);
+void gbproxy_peer_move(struct gbproxy_peer *peer, struct gbproxy_nse *nse);
int gbproxy_cleanup_peers(struct gbproxy_config *cfg, uint16_t nsei, uint16_t bvci);
/* NSE handling */
diff --git a/src/gbproxy/gb_proxy.c b/src/gbproxy/gb_proxy.c
index db7f55b3..bd58617e 100644
--- a/src/gbproxy/gb_proxy.c
+++ b/src/gbproxy/gb_proxy.c
@@ -1114,9 +1114,7 @@ static int gbprox_rx_sig_from_bss(struct gbproxy_config *cfg,
LOGP(DGPRS, LOGL_NOTICE, "Peer for BVCI=%u moved from NSEI=%u to NSEI=%u\n", bvci, nse_old->nsei, nsei);
/* Move peer to different NSE */
- llist_del(&from_peer->list);
- llist_add(&from_peer->list, &nse_new->bts_peers);
- from_peer->nse = nse_new;
+ gbproxy_peer_move(from_peer, nse_new);
}
if (TLVP_PRESENT(&tp, BSSGP_IE_CELL_ID)) {
diff --git a/src/gbproxy/gb_proxy_peer.c b/src/gbproxy/gb_proxy_peer.c
index 920547c9..62c4d94f 100644
--- a/src/gbproxy/gb_proxy_peer.c
+++ b/src/gbproxy/gb_proxy_peer.c
@@ -253,6 +253,13 @@ void gbproxy_peer_free(struct gbproxy_peer *peer)
talloc_free(peer);
}
+void gbproxy_peer_move(struct gbproxy_peer *peer, struct gbproxy_nse *nse)
+{
+ llist_del(&peer->list);
+ llist_add(&peer->list, &nse->bts_peers);
+ peer->nse = nse;
+}
+
int gbproxy_cleanup_peers(struct gbproxy_config *cfg, uint16_t nsei, uint16_t bvci)
{
int counter = 0;