Merge branch 'ip_check' into next

This commit is contained in:
Pedro Alvarez 2018-06-28 14:08:16 +01:00
commit aee66c3624
1 changed files with 12 additions and 13 deletions

View File

@ -329,21 +329,20 @@ spgw::handle_sgi_pdu(srslte::byte_buffer_t *msg)
bool ip_found = false; bool ip_found = false;
srslte::gtpc_f_teid_ie enb_fteid; srslte::gtpc_f_teid_ie enb_fteid;
struct timeval t_now, t_delta; struct iphdr *iph = (struct iphdr *) msg->msg;
if(iph->version != 4)
version = msg->msg[0]>>4; {
((uint8_t*)&dest_ip)[0] = msg->msg[16]; m_spgw_log->warning("IPv6 not supported yet.\n");
((uint8_t*)&dest_ip)[1] = msg->msg[17]; return;
((uint8_t*)&dest_ip)[2] = msg->msg[18]; }
((uint8_t*)&dest_ip)[3] = msg->msg[19]; if(iph->tot_len < 20)
{
dest_addr.s_addr = dest_ip; m_spgw_log->warning("Invalid IP header length.\n");
return;
//m_spgw_log->console("IP version: %d\n", version); }
//m_spgw_log->console("Received packet to IP: %s\n", inet_ntoa(dest_addr));
pthread_mutex_lock(&m_mutex); pthread_mutex_lock(&m_mutex);
gtp_fteid_it = m_ip_to_teid.find(dest_ip); gtp_fteid_it = m_ip_to_teid.find(iph->daddr);
if(gtp_fteid_it != m_ip_to_teid.end()) if(gtp_fteid_it != m_ip_to_teid.end())
{ {
ip_found = true; ip_found = true;