Re: No cmsg for SOCK_STREAM?

From: Rémi Denis-Courmont
Date: Sat Jul 14 2007 - 12:59:20 EST


Le samedi 14 juillet 2007, Daniel Schaffrath a écrit :
> 'man 7 ip' sais that IP_RECVOPTS is not supported for SOCK_STREAM
> sockets.
>
> But what if for debugging/measuring purposes I wanted to record the
> route of the datagrams containing the stream segments? Are there any
> other ways to get the IP options? Like a second raw socket to deliver
> cmsgs to user space and later resubmit for kernel TCP processing and
> normal delivery to application -- if that is possible at all.

The STREAM does not return data on a per-packet basis, so it would be
total non-sense to have IP_RECVOPTS on STREAM sockets. What would the
kernel do when there is re-assembly before delivery to userland, or if
a retransmitted segment has different options?!

FYI, the "advanced" socket API (for IPv6) consistently notes that
sending/receiving IP(v6) options per-packet is only defined for DGRAM
and RAW sockets.

You have to raw sockets, or better yet, BPF to do this.

--
Rémi Denis-Courmont
http://www.remlab.net/
-
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html