[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Detecting IP_TOS (and IPPROTO_IP vs. SOL_IP)
From: |
Eric Blake |
Subject: |
Re: Detecting IP_TOS (and IPPROTO_IP vs. SOL_IP) |
Date: |
Mon, 29 Mar 2010 14:20:09 -0600 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100301 Fedora/3.0.3-1.fc12 Lightning/1.0b1 Thunderbird/3.0.3 |
[moving to gnulib, replies can drop autoconf]
On 03/28/2010 03:54 PM, Philip Prindeville wrote:
>>> 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.
Anyone want to tackle making gnulib give better SOL_IP support, for
those platforms that don't yet implement it?
--
Eric Blake address@hidden +1-801-349-2682
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature