From c630b9512122039558f73abb4efdedc98da7e268 Mon Sep 17 00:00:00 2001 From: brian Date: Tue, 22 Jun 1999 11:20:03 +0000 Subject: Don't get caught in an infinite recursion when PKT_ALIAS_REVERSE is set. Document PKT_ALIAS_REVERSE. Pointed out by: Jonathan Hanna PR: 12304 --- lib/libalias/alias.c | 16 ++++++++++++---- lib/libalias/libalias.3 | 7 ++++++- 2 files changed, 18 insertions(+), 5 deletions(-) (limited to 'lib/libalias') 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 -- cgit v1.1