Changed the way UE's IPs are assigned

master
Pedro Alvarez 7 years ago
parent a8f268c55b
commit 80780bfb2f

@ -41,4 +41,4 @@ db_file = user_db.csv
[spgw] [spgw]
gtpu_bind_addr=127.0.1.100 gtpu_bind_addr=127.0.1.100
sgi_if_addr=172.0.0.1 sgi_if_addr=172.16.0.1

@ -87,6 +87,8 @@ private:
srslte::error_t init_sgi_if(spgw_args_t *args); srslte::error_t init_sgi_if(spgw_args_t *args);
srslte::error_t init_s1u(spgw_args_t *args); srslte::error_t init_s1u(spgw_args_t *args);
srslte::error_t init_ue_ip(spgw_args_t *args);
uint64_t get_new_ctrl_teid(); uint64_t get_new_ctrl_teid();
uint64_t get_new_user_teid(); uint64_t get_new_user_teid();
in_addr_t get_new_ue_ipv4(); in_addr_t get_new_ue_ipv4();
@ -112,6 +114,8 @@ private:
std::map<uint32_t,spgw_tunnel_ctx*> m_teid_to_tunnel_ctx; //Map control TEID to tunnel ctx. Usefull to get reply ctrl TEID, UE IP, etc. std::map<uint32_t,spgw_tunnel_ctx*> m_teid_to_tunnel_ctx; //Map control TEID to tunnel ctx. Usefull to get reply ctrl TEID, UE IP, etc.
std::map<in_addr_t,srslte::gtpc_f_teid_ie> m_ip_to_teid; //Map IP to User-plane TEID for downlink traffic std::map<in_addr_t,srslte::gtpc_f_teid_ie> m_ip_to_teid; //Map IP to User-plane TEID for downlink traffic
uint32_t m_h_next_ue_ip;
/*Logs*/ /*Logs*/
srslte::log_filter *m_spgw_log; srslte::log_filter *m_spgw_log;

@ -104,6 +104,13 @@ spgw::init(spgw_args_t* args, srslte::log_filter *spgw_log)
m_spgw_log->console("Could not initialize the S1-U interface.\n"); m_spgw_log->console("Could not initialize the S1-U interface.\n");
return -1; return -1;
} }
//Initialize UE ip pool
err = init_ue_ip(args);
if (err != srslte::ERROR_NONE)
{
m_spgw_log->console("Could not initialize the S1-U interface.\n");
return -1;
}
//Init mutex //Init mutex
pthread_mutex_init(&m_mutex,NULL); pthread_mutex_init(&m_mutex,NULL);
@ -237,6 +244,13 @@ spgw::init_s1u(spgw_args_t *args)
return srslte::ERROR_NONE; return srslte::ERROR_NONE;
} }
srslte::error_t
spgw::init_ue_ip(spgw_args_t *args)
{
m_h_next_ue_ip = ntohl(inet_addr(args->sgi_if_addr.c_str()));
return srslte::ERROR_NONE;
}
void void
spgw::run_thread() spgw::run_thread()
{ {
@ -395,7 +409,8 @@ spgw::get_new_user_teid()
in_addr_t in_addr_t
spgw::get_new_ue_ipv4() spgw::get_new_ue_ipv4()
{ {
return inet_addr("172.0.0.2");//FIXME Tmp hack m_h_next_ue_ip++;
return ntohl(m_h_next_ue_ip);//FIXME Tmp hack
} }
void void

Loading…
Cancel
Save