gbproxy: Separate function to move gbproxy_peer to different nse
Change-Id: I0a8b1e4b78384ea99d50109f050ca501b18ba5d9
Related: SYS#5226
diff --git a/include/osmocom/sgsn/gb_proxy.h b/include/osmocom/sgsn/gb_proxy.h
index 54d4548..9f91bd6 100644
--- a/include/osmocom/sgsn/gb_proxy.h
+++ b/include/osmocom/sgsn/gb_proxy.h
@@ -344,6 +344,7 @@
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/gb_proxy.c b/src/gb_proxy.c
index db7f55b..bd58617 100644
--- a/src/gb_proxy.c
+++ b/src/gb_proxy.c
@@ -1114,9 +1114,7 @@
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/gb_proxy_peer.c b/src/gb_proxy_peer.c
index 920547c..62c4d94 100644
--- a/src/gb_proxy_peer.c
+++ b/src/gb_proxy_peer.c
@@ -253,6 +253,13 @@
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;