summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/libalias/alias.c16
-rw-r--r--lib/libalias/libalias.37
-rw-r--r--sys/netinet/libalias/alias.c16
-rw-r--r--sys/netinet/libalias/libalias.37
4 files changed, 36 insertions, 10 deletions
diff --git a/lib/libalias/alias.c b/lib/libalias/alias.c
index 10e0ccc..8b18a73 100644
--- a/lib/libalias/alias.c
+++ b/lib/libalias/alias.c
@@ -1174,8 +1174,12 @@ PacketAliasIn(char *ptr, int maxpacketsize)
struct ip *pip;
int iresult;
- if (packetAliasMode & PKT_ALIAS_REVERSE)
- return PacketAliasOut(ptr, maxpacketsize);
+ if (packetAliasMode & PKT_ALIAS_REVERSE) {
+ packetAliasMode &= ~PKT_ALIAS_REVERSE;
+ iresult = PacketAliasOut(ptr, maxpacketsize);
+ packetAliasMode |= PKT_ALIAS_REVERSE;
+ return iresult;
+ }
HouseKeeping();
ClearCheckNewLink();
@@ -1256,8 +1260,12 @@ PacketAliasOut(char *ptr, /* valid IP packet */
struct in_addr addr_save;
struct ip *pip;
- if (packetAliasMode & PKT_ALIAS_REVERSE)
- return PacketAliasIn(ptr, maxpacketsize);
+ if (packetAliasMode & PKT_ALIAS_REVERSE) {
+ packetAliasMode &= ~PKT_ALIAS_REVERSE;
+ iresult = PacketAliasIn(ptr, maxpacketsize);
+ packetAliasMode |= PKT_ALIAS_REVERSE;
+ return iresult;
+ }
HouseKeeping();
ClearCheckNewLink();
diff --git a/lib/libalias/libalias.3 b/lib/libalias/libalias.3
index fa6cad7..8e38d91 100644
--- a/lib/libalias/libalias.3
+++ b/lib/libalias/libalias.3
@@ -247,7 +247,7 @@ If this mode bit is not set, it the link table
will never be reset in the event of an
address change.
.It PKT_ALIAS_PUNCH_FW.
-This option make libalias `punch holes' in an
+This option makes libalias `punch holes' in an
ipfw based firewall for FTP/IRC DCC connections.
The holes punched are bound by from/to IP address
and port; it will not be possible to use a hole
@@ -259,6 +259,11 @@ clear the entire ipfw range allocated for holes.
This will also happen on the initial call to
PacketAliasSetFWBase(). This call must happen
prior to setting this flag.
+.It PKT_ALIAS_REVERSE.
+This option makes libalias reverse the way it
+handles incoming and outgoing packets, allowing
+it to be fed data that passes through the internal
+interface rather than the external one.
.El
diff --git a/sys/netinet/libalias/alias.c b/sys/netinet/libalias/alias.c
index 10e0ccc..8b18a73 100644
--- a/sys/netinet/libalias/alias.c
+++ b/sys/netinet/libalias/alias.c
@@ -1174,8 +1174,12 @@ PacketAliasIn(char *ptr, int maxpacketsize)
struct ip *pip;
int iresult;
- if (packetAliasMode & PKT_ALIAS_REVERSE)
- return PacketAliasOut(ptr, maxpacketsize);
+ if (packetAliasMode & PKT_ALIAS_REVERSE) {
+ packetAliasMode &= ~PKT_ALIAS_REVERSE;
+ iresult = PacketAliasOut(ptr, maxpacketsize);
+ packetAliasMode |= PKT_ALIAS_REVERSE;
+ return iresult;
+ }
HouseKeeping();
ClearCheckNewLink();
@@ -1256,8 +1260,12 @@ PacketAliasOut(char *ptr, /* valid IP packet */
struct in_addr addr_save;
struct ip *pip;
- if (packetAliasMode & PKT_ALIAS_REVERSE)
- return PacketAliasIn(ptr, maxpacketsize);
+ if (packetAliasMode & PKT_ALIAS_REVERSE) {
+ packetAliasMode &= ~PKT_ALIAS_REVERSE;
+ iresult = PacketAliasIn(ptr, maxpacketsize);
+ packetAliasMode |= PKT_ALIAS_REVERSE;
+ return iresult;
+ }
HouseKeeping();
ClearCheckNewLink();
diff --git a/sys/netinet/libalias/libalias.3 b/sys/netinet/libalias/libalias.3
index fa6cad7..8e38d91 100644
--- a/sys/netinet/libalias/libalias.3
+++ b/sys/netinet/libalias/libalias.3
@@ -247,7 +247,7 @@ If this mode bit is not set, it the link table
will never be reset in the event of an
address change.
.It PKT_ALIAS_PUNCH_FW.
-This option make libalias `punch holes' in an
+This option makes libalias `punch holes' in an
ipfw based firewall for FTP/IRC DCC connections.
The holes punched are bound by from/to IP address
and port; it will not be possible to use a hole
@@ -259,6 +259,11 @@ clear the entire ipfw range allocated for holes.
This will also happen on the initial call to
PacketAliasSetFWBase(). This call must happen
prior to setting this flag.
+.It PKT_ALIAS_REVERSE.
+This option makes libalias reverse the way it
+handles incoming and outgoing packets, allowing
+it to be fed data that passes through the internal
+interface rather than the external one.
.El
OpenPOWER on IntegriCloud