ReLink() partial links in FindLinkOut() in the same manner as we do it

in FindLinkIn().  This will make TcpMonitorIn()/TcpMonitorOut() happy.

Reviewed by:	eivind
This commit is contained in:
Ruslan Ermilov 1999-09-22 13:22:26 +00:00
parent bd8beb9b80
commit bd3ed4542d
2 changed files with 30 additions and 14 deletions

View File

@ -510,7 +510,7 @@ ReLink(struct alias_link *,
u_short, u_short, int, int); u_short, u_short, int, int);
static struct alias_link * static struct alias_link *
FindLinkOut(struct in_addr, struct in_addr, u_short, u_short, int); FindLinkOut(struct in_addr, struct in_addr, u_short, u_short, int, int);
static struct alias_link * static struct alias_link *
FindLinkIn(struct in_addr, struct in_addr, u_short, u_short, int, int); FindLinkIn(struct in_addr, struct in_addr, u_short, u_short, int, int);
@ -1034,7 +1034,8 @@ FindLinkOut(struct in_addr src_addr,
struct in_addr dst_addr, struct in_addr dst_addr,
u_short src_port, u_short src_port,
u_short dst_port, u_short dst_port,
int link_type) int link_type,
int replace_partial_links)
{ {
u_int i; u_int i;
struct alias_link *link; struct alias_link *link;
@ -1063,11 +1064,18 @@ FindLinkOut(struct in_addr src_addr,
{ {
if (dst_port != 0) if (dst_port != 0)
{ {
link = FindLinkOut(src_addr, dst_addr, src_port, 0, link_type); link = FindLinkOut(src_addr, dst_addr, src_port, 0, link_type, 0);
if (link != NULL && replace_partial_links)
{
link = ReLink(link,
src_addr, dst_addr, link->alias_addr,
src_port, dst_port, link->alias_port,
link_type);
}
} }
else if (dst_addr.s_addr != 0) else if (dst_addr.s_addr != 0)
{ {
link = FindLinkOut(src_addr, nullAddress, src_port, 0, link_type); link = FindLinkOut(src_addr, nullAddress, src_port, 0, link_type, 0);
} }
} }
@ -1247,7 +1255,7 @@ FindIcmpOut(struct in_addr src_addr,
link = FindLinkOut(src_addr, dst_addr, link = FindLinkOut(src_addr, dst_addr,
id, NO_DEST_PORT, id, NO_DEST_PORT,
LINK_ICMP); LINK_ICMP, 0);
if (link == NULL) if (link == NULL)
{ {
struct in_addr alias_addr; struct in_addr alias_addr;
@ -1381,7 +1389,7 @@ FindUdpTcpOut(struct in_addr src_addr,
break; break;
} }
link = FindLinkOut(src_addr, dst_addr, src_port, dst_port, link_type); link = FindLinkOut(src_addr, dst_addr, src_port, dst_port, link_type, 1);
if (link == NULL) if (link == NULL)
{ {
@ -1428,7 +1436,7 @@ FindAliasAddress(struct in_addr original_addr)
struct alias_link *link; struct alias_link *link;
link = FindLinkOut(original_addr, nullAddress, link = FindLinkOut(original_addr, nullAddress,
0, 0, LINK_ADDR); 0, 0, LINK_ADDR, 0);
if (link == NULL) if (link == NULL)
{ {
return aliasAddress; return aliasAddress;

View File

@ -510,7 +510,7 @@ ReLink(struct alias_link *,
u_short, u_short, int, int); u_short, u_short, int, int);
static struct alias_link * static struct alias_link *
FindLinkOut(struct in_addr, struct in_addr, u_short, u_short, int); FindLinkOut(struct in_addr, struct in_addr, u_short, u_short, int, int);
static struct alias_link * static struct alias_link *
FindLinkIn(struct in_addr, struct in_addr, u_short, u_short, int, int); FindLinkIn(struct in_addr, struct in_addr, u_short, u_short, int, int);
@ -1034,7 +1034,8 @@ FindLinkOut(struct in_addr src_addr,
struct in_addr dst_addr, struct in_addr dst_addr,
u_short src_port, u_short src_port,
u_short dst_port, u_short dst_port,
int link_type) int link_type,
int replace_partial_links)
{ {
u_int i; u_int i;
struct alias_link *link; struct alias_link *link;
@ -1063,11 +1064,18 @@ FindLinkOut(struct in_addr src_addr,
{ {
if (dst_port != 0) if (dst_port != 0)
{ {
link = FindLinkOut(src_addr, dst_addr, src_port, 0, link_type); link = FindLinkOut(src_addr, dst_addr, src_port, 0, link_type, 0);
if (link != NULL && replace_partial_links)
{
link = ReLink(link,
src_addr, dst_addr, link->alias_addr,
src_port, dst_port, link->alias_port,
link_type);
}
} }
else if (dst_addr.s_addr != 0) else if (dst_addr.s_addr != 0)
{ {
link = FindLinkOut(src_addr, nullAddress, src_port, 0, link_type); link = FindLinkOut(src_addr, nullAddress, src_port, 0, link_type, 0);
} }
} }
@ -1247,7 +1255,7 @@ FindIcmpOut(struct in_addr src_addr,
link = FindLinkOut(src_addr, dst_addr, link = FindLinkOut(src_addr, dst_addr,
id, NO_DEST_PORT, id, NO_DEST_PORT,
LINK_ICMP); LINK_ICMP, 0);
if (link == NULL) if (link == NULL)
{ {
struct in_addr alias_addr; struct in_addr alias_addr;
@ -1381,7 +1389,7 @@ FindUdpTcpOut(struct in_addr src_addr,
break; break;
} }
link = FindLinkOut(src_addr, dst_addr, src_port, dst_port, link_type); link = FindLinkOut(src_addr, dst_addr, src_port, dst_port, link_type, 1);
if (link == NULL) if (link == NULL)
{ {
@ -1428,7 +1436,7 @@ FindAliasAddress(struct in_addr original_addr)
struct alias_link *link; struct alias_link *link;
link = FindLinkOut(original_addr, nullAddress, link = FindLinkOut(original_addr, nullAddress,
0, 0, LINK_ADDR); 0, 0, LINK_ADDR, 0);
if (link == NULL) if (link == NULL)
{ {
return aliasAddress; return aliasAddress;