On Fri, Apr 26, 2013 at 11:03:00PM +0200, PiBa-NL wrote: > Hi Willy / Lukas, > > It seams to me OpenBSD doesn't support the IP_BINDANY flag..: > http://www.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/netinet/in.h > <http://www.openbsd.org/cgi-bin/cvsweb/%7Echeckout%7E/src/sys/netinet/in.h>
it seems it has, but differently : http://unix.derkeiler.com/Mailing-Lists/FreeBSD/net/2008-07/msg00399.html > While FreeBSD does: > http://svnweb.freebsd.org/base/head/sys/netinet/in.h?view=markup > > But then again neither of them supports SOL_IP, so i would expect > compilation to simply 'fail'. When trying to compile with the > USE_LINUX_TPROXY option. Which is exactly the reason I don't want to remap these things which are linux-specific, and instead use the proper call depending on the available flags. Eg something like this : #if defined(SOL_IP) && defined(IP_TRANSPARENT) /* linux */ ret = setsockop(fd, SOL_IP, IP_TRANSPARENT, &one, sizeof(one)); #elif defined (IP_PROTOIP) && defined(IP_BINDANY) /* freebsd */ ret = setsockop(fd, IP_PROTOIP, IP_BINDANY, &one, sizeof(one)); #elif defined (IP_PROTOIP) && defined(IP_BINDANY) /* openbsd */ ret = setsockop(fd, SOL_SOCKET, SO_BINDANY, &one, sizeof(one)); #else /* unsupported platform */ ret = -1; #endif > The combination i think is unlikely to cause problems for other > currently working builds/systems.. > > If you want i can probably come up with a combination that makes it work > for FreeBSD with a special USE_FREEBSD_TPROXY make option. No, really I think something like above is much better for the long term. It's more work to adapt existing code first but will pay in the long term, even in the short term if it allows us to support OpenBSD at the same time. > Or go for the 'full automatic inclusion' depending on available flags. > Which i think is even 'nicer'. But probably needs more testing to > confirm proper working.. > I would be willing to make these changes. Is this the way to go? As you like, if you feel comfortable with changing the way the current code works (the linux-specific one), feel free to try, otherwise I can do it over the week-end, and then a second patch derived from yours will bring in support for FreeBSD then OpenBSD if someone here is able to test it. > Thanks for reviewing my proposed changes sofar. you're welcome :-) Willy

