Subject: Re: why does DCCP SO_REUSEADDR have to be SOL_DCCP?

From: Arnaldo Carvalho de Melo <[email-masked]>
Date: Sat, 2 Feb 2008 01:02:51 -0200

Em Sat, Feb 02, 2008 at 12:52:59AM -0200, Arnaldo Carvalho de Melo escreveu:
> If instead you pass SOL_DCCP we'll go down the rabbit hole till
> do_dccp_setsockopt() and SO_REUSEADDR, that is equal to 2, will be
> interpreted as DCCP_SOCKOPT_SERVICE, that is also equal to 2, so you'll
> be setting the service, not changing the SO_REUSEADDR setting.
> 
> The problem here is that you need to use:
> 
> setsockopt(fd, SOL_DCCP, DCCP_SOCKOPT_PACKET_SIZE, service,
>            sizeof(service));

Further info on DCCP service codes:

http://www.rfc.net/rfc4340.txt -> "8.1.2.  Service Codes"
 
> Again, take a look at the ttcp patch, the other patches for iperf,
> netcat, etc handles this.

- Arnaldo