Avoid overflow on M-TMSI allocation.

master
Pedro Alvarez 7 years ago
parent 5f9e0adbb6
commit 308efd4fdc

@ -542,8 +542,9 @@ s1ap::activate_eps_bearer(uint64_t imsi, uint8_t ebi)
uint32_t uint32_t
s1ap::allocate_m_tmsi(uint64_t imsi) s1ap::allocate_m_tmsi(uint64_t imsi)
{ {
uint32_t m_tmsi = m_next_m_tmsi++; uint32_t m_tmsi = m_next_m_tmsi;
//uint32_t m_tmsi = m_next_m_tmsi; m_next_m_tmsi = (m_next_m_tmsi + 1) % UINT32_MAX;
m_tmsi_to_imsi.insert(std::pair<uint32_t,uint64_t>(m_tmsi,imsi)); m_tmsi_to_imsi.insert(std::pair<uint32_t,uint64_t>(m_tmsi,imsi));
m_s1ap_log->debug("Allocated M-TMSI 0x%x to IMSI %015lu,\n",m_tmsi,imsi); m_s1ap_log->debug("Allocated M-TMSI 0x%x to IMSI %015lu,\n",m_tmsi,imsi);
return m_tmsi; return m_tmsi;

Loading…
Cancel
Save