From fbd7c04554808bd9d40f136443fea46d86c409d2 Mon Sep 17 00:00:00 2001 From: ru Date: Wed, 22 Sep 1999 13:22:26 +0000 Subject: ReLink() partial links in FindLinkOut() in the same manner as we do it in FindLinkIn(). This will make TcpMonitorIn()/TcpMonitorOut() happy. Reviewed by: eivind --- lib/libalias/alias_db.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'lib') diff --git a/lib/libalias/alias_db.c b/lib/libalias/alias_db.c index 4ac9f43..e52656a 100644 --- a/lib/libalias/alias_db.c +++ b/lib/libalias/alias_db.c @@ -510,7 +510,7 @@ ReLink(struct alias_link *, u_short, u_short, int, int); 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 * 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, u_short src_port, u_short dst_port, - int link_type) + int link_type, + int replace_partial_links) { u_int i; struct alias_link *link; @@ -1063,11 +1064,18 @@ FindLinkOut(struct in_addr src_addr, { 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) { - 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, id, NO_DEST_PORT, - LINK_ICMP); + LINK_ICMP, 0); if (link == NULL) { struct in_addr alias_addr; @@ -1381,7 +1389,7 @@ FindUdpTcpOut(struct in_addr src_addr, 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) { @@ -1428,7 +1436,7 @@ FindAliasAddress(struct in_addr original_addr) struct alias_link *link; link = FindLinkOut(original_addr, nullAddress, - 0, 0, LINK_ADDR); + 0, 0, LINK_ADDR, 0); if (link == NULL) { return aliasAddress; -- cgit v1.1