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
This commit is contained in:
Brian Somers 1999-06-22 11:20:03 +00:00
parent 378d10a91d
commit 0622eafc89
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=48102
4 changed files with 36 additions and 10 deletions

View File

@ -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();

View File

@ -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

View File

@ -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();

View File

@ -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