natd core dumps when -reverse switch is used because of a bug in
libalias. In /usr/src/lib/libalias/alias.c, the functions LibAliasIn and LibAliasOutTry call the legacy PacketAliasIn/PacketAliasOut instead of LibAliasIn/LibAliasOut when the PKT_ALIAS_REVERSE option is set. In this case, the context variable "la" gets lost because the legacy compatibility routines expect "la" to be global. This was obviously an oversight when rewriting the PacketAlias* functions to the LibAlias* functions. The fix (as shown in the patch below) is to remove the legacy subroutine calls and replace with the new ones using the "la" struct as the first arg. Submitted by: Gil Kloepfer <fgil@kloepfer.org> Confirmed by: <nicolai@catpipe.net> PR: 76839 MFC after: 3 days
This commit is contained in:
parent
506e445a6c
commit
a8bc22b47a
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=144666
@ -1170,7 +1170,7 @@ LibAliasIn(struct libalias *la, char *ptr, int maxpacketsize)
|
||||
|
||||
if (la->packetAliasMode & PKT_ALIAS_REVERSE) {
|
||||
la->packetAliasMode &= ~PKT_ALIAS_REVERSE;
|
||||
iresult = PacketAliasOut(ptr, maxpacketsize);
|
||||
iresult = LibAliasOut(la, ptr, maxpacketsize);
|
||||
la->packetAliasMode |= PKT_ALIAS_REVERSE;
|
||||
return (iresult);
|
||||
}
|
||||
@ -1264,7 +1264,7 @@ LibAliasOutTry(struct libalias *la, char *ptr, /* valid IP packet */
|
||||
|
||||
if (la->packetAliasMode & PKT_ALIAS_REVERSE) {
|
||||
la->packetAliasMode &= ~PKT_ALIAS_REVERSE;
|
||||
iresult = PacketAliasIn(ptr, maxpacketsize);
|
||||
iresult = LibAliasIn(la, ptr, maxpacketsize);
|
||||
la->packetAliasMode |= PKT_ALIAS_REVERSE;
|
||||
return (iresult);
|
||||
}
|
||||
|
@ -1170,7 +1170,7 @@ LibAliasIn(struct libalias *la, char *ptr, int maxpacketsize)
|
||||
|
||||
if (la->packetAliasMode & PKT_ALIAS_REVERSE) {
|
||||
la->packetAliasMode &= ~PKT_ALIAS_REVERSE;
|
||||
iresult = PacketAliasOut(ptr, maxpacketsize);
|
||||
iresult = LibAliasOut(la, ptr, maxpacketsize);
|
||||
la->packetAliasMode |= PKT_ALIAS_REVERSE;
|
||||
return (iresult);
|
||||
}
|
||||
@ -1264,7 +1264,7 @@ LibAliasOutTry(struct libalias *la, char *ptr, /* valid IP packet */
|
||||
|
||||
if (la->packetAliasMode & PKT_ALIAS_REVERSE) {
|
||||
la->packetAliasMode &= ~PKT_ALIAS_REVERSE;
|
||||
iresult = PacketAliasIn(ptr, maxpacketsize);
|
||||
iresult = LibAliasIn(la, ptr, maxpacketsize);
|
||||
la->packetAliasMode |= PKT_ALIAS_REVERSE;
|
||||
return (iresult);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user