<netinet/in.h> setsourcefilter/getsourcefilter missing const qualifier?

Victor Toni victor.toni at gmail.com
Sun May 8 21:35:37 UTC 2016


Thank for the explanation. Changed the code respectively.

2016-05-05 2:23 GMT+02:00 Eric van Gyzen <vangyzen at freebsd.org>:

> On 05/ 3/16 03:50 PM, Victor Toni wrote:
>
>> When trying to compile some linux-originated code on FreeBSD I get the
>> following errors:
>>
>> /usr/include/netinet/in.h:585:5: note: candidate function not viable: 3rd
>> argument ('const sockaddr *') would lose const qualifier
>> int     setsourcefilter(int, uint32_t, struct sockaddr *, socklen_t,
>>          ^
>> /usr/include/netinet/in.h:587:5: note: candidate function not viable: 3rd
>> argument ('const sockaddr *') would lose const qualifier
>> int     getsourcefilter(int, uint32_t, struct sockaddr *, socklen_t,
>>          ^
>>
>> the main difference is that the linux version makes guarantees about
>> the parameters.
>>
>>
>> Wouldn't it be safe for the FreeBSD version to make the same assumption?
>>
>
> Yes, it would be safe in practice, since the implementation does not
> modify those parameters.  However, RFC 3678 does not specify them as const,
> and neither do illumos (Solaris) and Mac OS X, so code that tries to pass
> const parameters is not portable.  I would suggest changing the code to
> pass non-const parameters.
>
> Eric
>


More information about the freebsd-net mailing list