autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Detecting IP_TOS (and IPPROTO_IP vs. SOL_IP)


From: Philip Prindeville
Subject: Re: Detecting IP_TOS (and IPPROTO_IP vs. SOL_IP)
Date: Sun, 28 Mar 2010 14:54:40 -0700
User-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.1.7) Gecko/20100111 Thunderbird/3.0.1

On 3/26/10 12:51 PM, Ralf Wildenhues wrote:
Hello Philip,

* Philip A. Prindeville wrote on Mon, Mar 22, 2010 at 08:42:51AM CET:
Calling the sequence:

setsockopt(fd, XXXX, IP_TOS,&foo, sizeof(foo));

can be tricky.  Linux uses SOL_IP for XXXX, whereas Solaris and BSD use
IPPROTO_IP for this instead.

Not sure what MacOS or HP-UX do.

Do the newer versions of autoconf have canned code for detecting what to
use?
No.

My version of Linux defines both SOL_IP and IPPROTO_IP to the same
value.  Since changing it would seem to break the API, I *think*
if looking at Linux alone you should be able to just go with IPPROTO_IP.
Untested, you get to keep the pieces if it breaks.

Except, of course, that most people widely agree that using the protocol number as a synonym for the layer number was a poor design choice, and one that was eventually corrected (via the introduction of SOL_IP).

Thus I would argue the opposite: that always using SOL_IP is the correct approach, i.e.

#ifndef SOL_IP
#define SOL_IP IPPROTO_IP
#endif
...

    r = setsockopt(s, SOL_IP,&qos, sizeof(qos));


In summary, the API was already broken, and propagating that usage model is 
probably not a good thing.



And if not, can someone please add it?

I just grepped the 2.65 tarball but didn't find anything in there.
Generally, for such issues it might be a good idea to just use gnulib if
you can; but I just looked and it doesn't address this particular issue
yet.

Cheers,
Ralf

Yeah, a lot of runtimes don't use gnulib, like APR...

-Philip





reply via email to

[Prev in Thread] Current Thread [Next in Thread]