[reSIProcate] PATCH: UdpTransport.cxx MSG_PEEK

Theo Zourzouvillys theo at crazygreek.co.uk
Tue Sep 13 15:17:45 CDT 2005


Hi,

This patch peeks the socket first to allocate the correct amount of memory for 
the incoming packet, or bail out before allocating any on encountering an 
error.

Tested on linux 2.6 + 2.4, It should work fine on any sane OS, but i suggest 
people give it a once over to confirm.

Regarding detecting truncated messages - well, we should in theory never see 
them now (in linux anyway), but i'm not betting that all os'es don't still 
push just the received chunk within the SO_RECVBUF size down to userspace.  
in that case i can't really see any way to detect it.

hmm, just checked.  stevens rekons the datagram might be truncated on some 
implementations [1] if the packet size is greater than SO_RECVBUF, but i've 
not seen this behaviour happen in a good few years on any platforms i develop 
on (*bsd, linux + solaris).

Which brings me on to another question: which platforms does the resip stack 
"officially" support, and patches need to ensure work on?

 ~ Theo

1 - tcp/ip illustrated vol 1, 11.10 Maximum UDP Datagram Size, p160 

-- 
Theo P. Zourzouvillys

People who enjoy waiving flags don't deserve to have one
  -- Santa's Ghetto 2004, Banksy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: resip-udp-peek-01-theo.diff
Type: text/x-diff
Size: 3000 bytes
Desc: not available
URL: <http://list.resiprocate.org/pipermail/resiprocate-devel/attachments/20050913/24e6ae79/attachment.diff>


More information about the resiprocate-devel mailing list