Casting sock to inet_timewait_sock

Michael Blizek michi1 at michaelblizek.twilightparadox.com
Fri Jan 14 16:23:00 EST 2011


Hi!

On 16:47 Fri 14 Jan     , Daniel Baluta wrote:
> Hello,
> 
> When casting sock to inet_timewait_sock ([1]) it is assumed
> that sock points to a structure of type inet_timewait_sock.
> 
> Is there a way to check if a sock struct wraps around
> a inet_timewait_sock struct?

By looking at the callers of inet_twsk it seems as if sk->sk_state has to be
either TCP_TIME_WAIT or DCCP_TIME_WAIT. It even seems as if both actually have
the same value (see
http://lxr.linux.no/linux+v2.6.36/include/linux/dccp.h#L256 ).

	-Michi
-- 
programing a layer 3+4 network protocol for mesh networks
see http://michaelblizek.twilightparadox.com




More information about the Kernelnewbies mailing list