Date: Sun, 8 May 2016 23:35:04 +0200 From: Victor Toni <victor.toni@gmail.com> To: Eric van Gyzen <vangyzen@freebsd.org> Cc: freebsd-net@freebsd.org Subject: Re: <netinet/in.h> setsourcefilter/getsourcefilter missing const qualifier? Message-ID: <CAG0OSgfi0N0G5NNh_v8bgFCcORXi6QBrKPZGLJQ%2BzA8YKaWEiw@mail.gmail.com> In-Reply-To: <f930ce15-5e79-bbf1-22cc-edc0dd0ffcea@FreeBSD.org> References: <CAG0OSgek6hN-yUV8aQZYtAHmo1o0k_AYTQmertOhW1rrc5jQHw@mail.gmail.com> <f930ce15-5e79-bbf1-22cc-edc0dd0ffcea@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Thank for the explanation. Changed the code respectively. 2016-05-05 2:23 GMT+02:00 Eric van Gyzen <vangyzen@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 >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAG0OSgfi0N0G5NNh_v8bgFCcORXi6QBrKPZGLJQ%2BzA8YKaWEiw>