summaryrefslogtreecommitdiff
path: root/usr.sbin/hoststated
diff options
context:
space:
mode:
authorReyk Floeter <reyk@cvs.openbsd.org>2007-03-17 22:22:24 +0000
committerReyk Floeter <reyk@cvs.openbsd.org>2007-03-17 22:22:24 +0000
commita92c0ac2fe007da11296fc93530ee0fd92641197 (patch)
treeade833cca064752d0fbb23caa58c03d1a9c07674 /usr.sbin/hoststated
parentc9bead7d9d0cf02043da8159b6a2a13e903caa6c (diff)
fix the natlook mode.
Diffstat (limited to 'usr.sbin/hoststated')
-rw-r--r--usr.sbin/hoststated/relay.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/usr.sbin/hoststated/relay.c b/usr.sbin/hoststated/relay.c
index f19078a69a6..20fb367ad16 100644
--- a/usr.sbin/hoststated/relay.c
+++ b/usr.sbin/hoststated/relay.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: relay.c,v 1.19 2007/03/13 12:04:52 reyk Exp $ */
+/* $OpenBSD: relay.c,v 1.20 2007/03/17 22:22:23 reyk Exp $ */
/*
* Copyright (c) 2006, 2007 Reyk Floeter <reyk@openbsd.org>
@@ -1476,6 +1476,7 @@ relay_accept(int fd, short sig, void *arg)
bzero(cnl, sizeof(*cnl));
cnl->in = -1;
cnl->id = con->id;
+ cnl->proc = proc_id;
bcopy(&con->in.ss, &cnl->src, sizeof(cnl->src));
bcopy(&rlay->ss, &cnl->dst, sizeof(cnl->dst));
imsg_compose(ibuf_pfe, IMSG_NATLOOK, 0, 0, cnl, sizeof(*cnl));
@@ -1575,12 +1576,14 @@ void
relay_natlook(int fd, short event, void *arg)
{
struct session *con = (struct session *)arg;
+ struct relay *rlay = (struct relay *)con->relay;
struct ctl_natlook *cnl = con->cnl;
if (cnl == NULL)
fatalx("invalid NAT lookup");
- if (con->out.ss.ss_family == AF_UNSPEC && cnl->in == -1) {
+ if (con->out.ss.ss_family == AF_UNSPEC && cnl->in == -1 &&
+ rlay->dstss.ss_family == AF_UNSPEC && rlay->dsttable == NULL) {
relay_close(con, "session NAT lookup failed");
return;
}
@@ -1631,7 +1634,7 @@ relay_connect(struct session *con)
if (rlay->dsttable != NULL) {
if (relay_from_table(con) != 0)
return (-1);
- } else {
+ } else if (con->out.ss.ss_family == AF_UNSPEC) {
bcopy(&rlay->dstss, &con->out.ss, sizeof(con->out.ss));
con->out.port = rlay->dstport;
}