summaryrefslogtreecommitdiffstats
path: root/lib/libalias
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>1999-06-22 11:20:03 +0000
committerbrian <brian@FreeBSD.org>1999-06-22 11:20:03 +0000
commitc630b9512122039558f73abb4efdedc98da7e268 (patch)
treee8e9b7a26a41f420e4d29a0f13e43753599061db /lib/libalias
parentec871a354c08172834bebb1450ec8f2c31ad2a6c (diff)
downloadFreeBSD-src-c630b9512122039558f73abb4efdedc98da7e268.zip
FreeBSD-src-c630b9512122039558f73abb4efdedc98da7e268.tar.gz
Don't get caught in an infinite recursion when PKT_ALIAS_REVERSE
is set. Document PKT_ALIAS_REVERSE. Pointed out by: Jonathan Hanna <jh@cr1003333-a.crdva1.bc.home.com> PR: 12304
Diffstat (limited to 'lib/libalias')
-rw-r--r--lib/libalias/alias.c16
-rw-r--r--lib/libalias/libalias.37
2 files changed, 18 insertions, 5 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
OpenPOWER on IntegriCloud