2

This is not a programming question, but a question about NetBSD.

Linux, FreeBSD and OpenBSD have mutually exclusive but similar interfaces to allow binding the local end of a connection to an address that is not present on any local interface. E.g. make a connection from 8.8.8.8. I've been poking around without success in NetBSD to see if there is something to the same effect there. Is there?

Here's (my) sample code, for reference:

https://github.com/UlricE/pen/blob/master/server.c

Function spoof_bind, line ~250.

Greatly simplified examples to illustrate the concept:

Linux:

setsockopt(upfd, SOL_IP, IP_TRANSPARENT, &one, sizeof one);
bind(upfd, (struct sockaddr *)&addr, sizeof addr);

FreeBSD:

setsockopt(upfd, IPPROTO_IP, IP_BINDANY, &one, sizeof one);
bind(upfd, (struct sockaddr *)&addr, sizeof addr);

OpenBSD:

setsockopt(upfd, SOL_SOCKET, SO_BINDANY, &one, sizeof one);
bind(upfd, (struct sockaddr *)&addr, sizeof addr);

Again, this is not a programming question but a question whether such an interface exists on NetBSD.

7
  • What are you trying to achieve? Commented Jun 4, 2015 at 18:35
  • A client connects to a load balancing proxy which connects to a backend server. The objective is to allow the server to see a connection as coming from the client's IP address. Commented Jun 4, 2015 at 18:40
  • morestuff.siag.nu/2015/05/29/transparent-reverse-proxy for more details. Commented Jun 4, 2015 at 18:40
  • Can you add ammendments to the question, and make it a bit clearer. What you say fills my head with ideas, but still I am not certain about what you are trying to do. Do not expect us to read a manual to allow us to understand your question, just because you can not be bothered to tell us clearly what you are trying, do not assume that we know. Commented Jun 4, 2015 at 18:45
  • I have added a few examples. This is something you either know or not; if you don't, you are not expected to answer. Commented Jun 4, 2015 at 18:55

0

You must log in to answer this question.

Browse other questions tagged .