summaryrefslogtreecommitdiffstats
path: root/lib/libalias/alias_db.c
diff options
context:
space:
mode:
authorru <ru@FreeBSD.org>2000-04-12 18:44:50 +0000
committerru <ru@FreeBSD.org>2000-04-12 18:44:50 +0000
commitc93d494562c83aeaf960ba067bc0e9c1abcc2f2d (patch)
tree5c3692896457fd32a78dbd692d3b355912b26f97 /lib/libalias/alias_db.c
parentc3fb68865735f4e9708766b6c6e77ce7c67f370a (diff)
downloadFreeBSD-src-c93d494562c83aeaf960ba067bc0e9c1abcc2f2d.zip
FreeBSD-src-c93d494562c83aeaf960ba067bc0e9c1abcc2f2d.tar.gz
Make partially specified permanent links without `dst_addr'
but with `dst_port' work for outgoing packets. This case was not handled properly when I first fixed this in revision 1.17. This change is also required for the upcoming improved PPTP support patches -- that is how I found the problem. Before this change: # natd -v -a aliasIP \ -redirect_port tcp localIP:localPORT publicIP:publicPORT 0:remotePORT Out [TCP] [TCP] localIP:localPORT -> remoteIP:remotePORT aliased to [TCP] aliasIP:localPORT -> remoteIP:remotePORT After this change: # natd -v -a aliasIP \ -redirect_port tcp localIP:localPORT publicIP:publicPORT 0:remotePORT Out [TCP] [TCP] localIP:localPORT -> remoteIP:remotePORT aliased to [TCP] publicIP:publicPORT -> remoteIP:remotePORT
Diffstat (limited to 'lib/libalias/alias_db.c')
-rw-r--r--lib/libalias/alias_db.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/lib/libalias/alias_db.c b/lib/libalias/alias_db.c
index b0a2642..86223cd 100644
--- a/lib/libalias/alias_db.c
+++ b/lib/libalias/alias_db.c
@@ -1046,25 +1046,29 @@ _FindLinkOut(struct in_addr src_addr,
}
/* Search for partially specified links. */
- if (link == NULL)
+ if (link == NULL && replace_partial_links)
{
- if (dst_port != 0)
+ if (dst_port != 0 && dst_addr.s_addr != INADDR_ANY)
{
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);
- }
+ if (link == NULL)
+ link = _FindLinkOut(src_addr, nullAddress, src_port,
+ dst_port, link_type, 0);
}
- else if (dst_addr.s_addr != 0)
+ if (link == NULL &&
+ (dst_port != 0 || dst_addr.s_addr != INADDR_ANY))
{
link = _FindLinkOut(src_addr, nullAddress, src_port, 0,
link_type, 0);
}
+ if (link != NULL)
+ {
+ link = ReLink(link,
+ src_addr, dst_addr, link->alias_addr,
+ src_port, dst_port, link->alias_port,
+ link_type);
+ }
}
return(link);
@@ -1228,7 +1232,7 @@ _FindLinkIn(struct in_addr dst_addr,
}
}
-struct alias_link *
+static struct alias_link *
FindLinkIn(struct in_addr dst_addr,
struct in_addr alias_addr,
u_short dst_port,
OpenPOWER on IntegriCloud