Merge branch 'ip_check' into next

master
Pedro Alvarez 7 years ago
commit aee66c3624

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

Loading…
Cancel
Save