aboutsummaryrefslogtreecommitdiff
path: root/sys/netinet
diff options
context:
space:
mode:
authorRuslan Ermilov <ru@FreeBSD.org>2000-04-12 18:44:50 +0000
committerRuslan Ermilov <ru@FreeBSD.org>2000-04-12 18:44:50 +0000
commitf167e54283d2f578c1267f3a88b5aae52e13b127 (patch)
tree7d8e84487914d3a23abaa98bf1500fac637e35a0 /sys/netinet
parent70c1e1b6d919a1e5d3c4658a53071f728d159dcf (diff)
downloadsrc-f167e54283d2f578c1267f3a88b5aae52e13b127.tar.gz
src-f167e54283d2f578c1267f3a88b5aae52e13b127.zip
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
Notes
Notes: svn path=/head/; revision=59181
Diffstat (limited to 'sys/netinet')
-rw-r--r--sys/netinet/libalias/alias_db.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/sys/netinet/libalias/alias_db.c b/sys/netinet/libalias/alias_db.c
index b0a26427bab6..86223cd22e40 100644
--- a/sys/netinet/libalias/alias_db.c
+++ b/sys/netinet/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,