Date: Wed, 4 May 2016 19:23:26 -0500 From: Eric van Gyzen <vangyzen@FreeBSD.org> To: Victor Toni <victor.toni@gmail.com>, freebsd-net@freebsd.org Subject: Re: <netinet/in.h> setsourcefilter/getsourcefilter missing const qualifier? Message-ID: <f930ce15-5e79-bbf1-22cc-edc0dd0ffcea@FreeBSD.org> In-Reply-To: <CAG0OSgek6hN-yUV8aQZYtAHmo1o0k_AYTQmertOhW1rrc5jQHw@mail.gmail.com> References: <CAG0OSgek6hN-yUV8aQZYtAHmo1o0k_AYTQmertOhW1rrc5jQHw@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?f930ce15-5e79-bbf1-22cc-edc0dd0ffcea>