Implement removal of endpoint
For unit testing, allow to remove endpoints such that we could reuse a port/IP combination. The function does not take care of endpoints that are still "dangling", it is the user's responsibility to remove all existing TEIDs.
This commit is contained in:
@@ -613,6 +613,20 @@ instance_t gtpv1Init(openAddr_t context)
|
||||
return id;
|
||||
}
|
||||
|
||||
/* \brief remove the GTP instance from the list of instances. Does not make an
|
||||
* attempt to free corresponding TEIDs, as we have many and will simply not
|
||||
* reuse it later. */
|
||||
int gtpv1Term(instance_t instance)
|
||||
{
|
||||
pthread_mutex_lock(&globGtp.gtp_lock);
|
||||
getInstRetInt(compatInst(instance));
|
||||
gtpv1uReceiverCancel(inst->thrData.t);
|
||||
close(instance);
|
||||
globGtp.instances.erase(instance);
|
||||
pthread_mutex_unlock(&globGtp.gtp_lock);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void GtpuUpdateTunnelOutgoingAddressAndTeid(instance_t instance,
|
||||
ue_id_t ue_id,
|
||||
ebi_t bearer_id,
|
||||
|
||||
@@ -130,6 +130,7 @@ typedef struct gtpv1u_gnb_delete_tunnel_req_s gtpv1u_gnb_delete_tunnel_req_t;
|
||||
size_t len);
|
||||
|
||||
instance_t gtpv1Init(openAddr_t context);
|
||||
int gtpv1Term(instance_t inst);
|
||||
void *gtpv1uTask(void *args);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -136,6 +136,11 @@ static void run_basic_test(uint32_t ue_id,
|
||||
EXPECT_EQ(ret, 0);
|
||||
ret = newGtpuDeleteAllTunnels(ep2, ue_id);
|
||||
EXPECT_EQ(ret, 0);
|
||||
|
||||
ret = gtpv1Term(ep1);
|
||||
EXPECT_EQ(ret, 0);
|
||||
ret = gtpv1Term(ep2);
|
||||
EXPECT_EQ(ret, 0);
|
||||
}
|
||||
|
||||
static int recv_count_qfi = 0;
|
||||
|
||||
Reference in New Issue
Block a user