[Openib-windows] Malformed check of IP packet sizes
    Tzachi Dar 
    tzachid at mellanox.co.il
       
    Mon Mar 13 12:45:13 PST 2006
    
    
  
Hi Fab,
 
Although more than 99.9% of IP packets in the network have a header of
20 bytes it is possible to have packets with a bigger header. The extra
data goes to the options.
 
In the function __send_mgr_filter_ip if the packet is identified as a
UDP packet, there is a need to start the UDP packet after the size of
the IP header.
As a result, the code 
	buf_len -= sizeof(ip_hdr_t);
	cl_perf_start( FilterUdp );
	status = __send_mgr_filter_udp(
Should be replaced with 
	buf_len -= IpHeaderSize(ip_hdr_t);
	cl_perf_start( FilterUdp );
	status = __send_mgr_filter_udp(
Where IpHeaderSize is defined as
inline uint8_t IpHeaderSize (const ip_hdr_t * const p_ip)
{
	return ((p_ip->ver_hl & 0x0f) << 2);
} 
This is probably also true for other places in which sizeof(ip_hdr_t) is
used.
(Please note that before finding the size of an IP header there is a
need to check that we have at least 20 bytes of data).
    
    
More information about the ofw
mailing list