summaryrefslogtreecommitdiffstats
path: root/sbin
diff options
context:
space:
mode:
authorru <ru@FreeBSD.org>2000-05-18 10:31:10 +0000
committerru <ru@FreeBSD.org>2000-05-18 10:31:10 +0000
commit9033edf3a8227c165daac3522007884b721a4fe7 (patch)
tree04ad9fd391427edf6a33848f33687519252243ce /sbin
parent9b2777cf0c0497b340880e4a599c9223bffa7c33 (diff)
downloadFreeBSD-src-9033edf3a8227c165daac3522007884b721a4fe7.zip
FreeBSD-src-9033edf3a8227c165daac3522007884b721a4fe7.tar.gz
Add new option (-target_addr) to control how to deal with incoming packets
not associated with any pre-existing link. Submitted by: brian
Diffstat (limited to 'sbin')
-rw-r--r--sbin/natd/natd.822
-rw-r--r--sbin/natd/natd.c13
2 files changed, 34 insertions, 1 deletions
diff --git a/sbin/natd/natd.8 b/sbin/natd/natd.8
index b6cedee..be1ac6f 100644
--- a/sbin/natd/natd.8
+++ b/sbin/natd/natd.8
@@ -15,6 +15,7 @@ Network Address Translation Daemon
.Op Fl o Ar outport
.Op Fl p Ar port
.Op Fl a Ar address
+.Op Fl t Ar address
.Op Fl n Ar interface
.Op Fl f Ar configfile
@@ -32,6 +33,7 @@ Network Address Translation Daemon
.Op Fl outport Ar outport
.Op Fl port Ar port
.Op Fl alias_address Ar address
+.Op Fl target_address Ar address
.Op Fl interface Ar interface
.Op Fl config Ar configfile
.Op Fl redirect_port Ar linkspec
@@ -291,7 +293,25 @@ and if
.Fl deny_incoming
is not specified, the packet is delivered to the local machine and port
as specified in the packet.
-
+.It Fl t | target_address Ar address
+Set the target address.
+When an incoming packet not associated with any pre-existing link
+arrives at the host machine, it will be sent to the specified
+.Ar address .
+.Pp
+The target address may be set to
+.Dq 255.255.255.255 ,
+in which case all new incoming packets go to the alias address set by
+.Fl alias_address
+or
+.Fl interface .
+.Pp
+If this option is not used, or called with
+.Dq 0.0.0.0
+argument, then all new incoming packets go to the address specified in
+the packet.
+This allows external machines to talk directly to internal machines if
+they can route packets to the machine in question.
.It Fl n | interface Ar interface
Use
.Ar interface
diff --git a/sbin/natd/natd.c b/sbin/natd/natd.c
index 6bb3584..a465ce2 100644
--- a/sbin/natd/natd.c
+++ b/sbin/natd/natd.c
@@ -860,6 +860,7 @@ enum Option {
OutPort,
Port,
AliasAddress,
+ TargetAddress,
InterfaceName,
RedirectPort,
RedirectProto,
@@ -1007,6 +1008,14 @@ static struct OptionInfo optionTable[] = {
"alias_address",
"a" },
+ { TargetAddress,
+ 0,
+ Address,
+ "x.x.x.x",
+ "address to use for incoming sessions",
+ "target_address",
+ "t" },
+
{ InterfaceName,
0,
String,
@@ -1206,6 +1215,10 @@ static void ParseOption (const char* option, const char* parms, int cmdLine)
memcpy (&aliasAddr, &addrValue, sizeof (struct in_addr));
break;
+ case TargetAddress:
+ PacketAliasSetTarget(addrValue);
+ break;
+
case RedirectPort:
SetupPortRedirect (strValue);
break;
OpenPOWER on IntegriCloud