diff options
author | brian <brian@FreeBSD.org> | 1999-06-22 11:20:03 +0000 |
---|---|---|
committer | brian <brian@FreeBSD.org> | 1999-06-22 11:20:03 +0000 |
commit | c630b9512122039558f73abb4efdedc98da7e268 (patch) | |
tree | e8e9b7a26a41f420e4d29a0f13e43753599061db /sys | |
parent | ec871a354c08172834bebb1450ec8f2c31ad2a6c (diff) | |
download | FreeBSD-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 'sys')
-rw-r--r-- | sys/netinet/libalias/alias.c | 16 | ||||
-rw-r--r-- | sys/netinet/libalias/libalias.3 | 7 |
2 files changed, 18 insertions, 5 deletions
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 |