summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReyk Floeter <reyk@cvs.openbsd.org>2008-07-09 14:57:02 +0000
committerReyk Floeter <reyk@cvs.openbsd.org>2008-07-09 14:57:02 +0000
commit7380abfdfb9b44f720cd869edca8afe8998e47ae (patch)
tree58f5fe78d23a754255273a96d807deb7853a5cc2
parent9615e8c8bcf3c4ae99a33e347222a640415f9c45 (diff)
also set the protocol, either TCP or UDP, in the NAT lookup. this
unbreaks NAT lookups with UDP; tested as a transparent DNS relay.
-rw-r--r--usr.sbin/relayd/pfe_filter.c4
-rw-r--r--usr.sbin/relayd/relay.c3
-rw-r--r--usr.sbin/relayd/relay_udp.c3
-rw-r--r--usr.sbin/relayd/relayd.h3
4 files changed, 8 insertions, 5 deletions
diff --git a/usr.sbin/relayd/pfe_filter.c b/usr.sbin/relayd/pfe_filter.c
index da754cb435f..843c61a09c5 100644
--- a/usr.sbin/relayd/pfe_filter.c
+++ b/usr.sbin/relayd/pfe_filter.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfe_filter.c,v 1.30 2008/06/11 18:21:19 reyk Exp $ */
+/* $OpenBSD: pfe_filter.c,v 1.31 2008/07/09 14:57:01 reyk Exp $ */
/*
* Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -510,7 +510,7 @@ natlook(struct relayd *env, struct ctl_natlook *cnl)
bcopy(&out6->sin6_addr, &pnl.daddr.addr8, out6->sin6_len);
pnl.dport = out6->sin6_port;
}
- pnl.proto = IPPROTO_TCP;
+ pnl.proto = cnl->proto;
pnl.direction = PF_IN;
cnl->in = 1;
diff --git a/usr.sbin/relayd/relay.c b/usr.sbin/relayd/relay.c
index 325c4195bd2..005ca6852c2 100644
--- a/usr.sbin/relayd/relay.c
+++ b/usr.sbin/relayd/relay.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: relay.c,v 1.90 2008/06/11 18:21:19 reyk Exp $ */
+/* $OpenBSD: relay.c,v 1.91 2008/07/09 14:57:01 reyk Exp $ */
/*
* Copyright (c) 2006, 2007, 2008 Reyk Floeter <reyk@openbsd.org>
@@ -1964,6 +1964,7 @@ relay_accept(int fd, short sig, void *arg)
cnl->in = -1;
cnl->id = con->se_id;
cnl->proc = proc_id;
+ cnl->proto = IPPROTO_TCP;
bcopy(&con->se_in.ss, &cnl->src, sizeof(cnl->src));
bcopy(&rlay->rl_conf.ss, &cnl->dst, sizeof(cnl->dst));
imsg_compose(ibuf_pfe, IMSG_NATLOOK, 0, 0, -1, cnl,
diff --git a/usr.sbin/relayd/relay_udp.c b/usr.sbin/relayd/relay_udp.c
index 91083706f34..a2971a65f7a 100644
--- a/usr.sbin/relayd/relay_udp.c
+++ b/usr.sbin/relayd/relay_udp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: relay_udp.c,v 1.12 2008/07/09 10:50:34 reyk Exp $ */
+/* $OpenBSD: relay_udp.c,v 1.13 2008/07/09 14:57:01 reyk Exp $ */
/*
* Copyright (c) 2007, 2008 Reyk Floeter <reyk@openbsd.org>
@@ -301,6 +301,7 @@ relay_udp_server(int fd, short sig, void *arg)
cnl->in = -1;
cnl->id = con->se_id;
cnl->proc = proc_id;
+ cnl->proto = IPPROTO_UDP;
bcopy(&con->se_in.ss, &cnl->src, sizeof(cnl->src));
bcopy(&rlay->rl_conf.ss, &cnl->dst, sizeof(cnl->dst));
imsg_compose(ibuf_pfe, IMSG_NATLOOK, 0, 0, -1, cnl,
diff --git a/usr.sbin/relayd/relayd.h b/usr.sbin/relayd/relayd.h
index 432f4606204..b9b81a707ab 100644
--- a/usr.sbin/relayd/relayd.h
+++ b/usr.sbin/relayd/relayd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: relayd.h,v 1.104 2008/07/09 10:50:34 reyk Exp $ */
+/* $OpenBSD: relayd.h,v 1.105 2008/07/09 14:57:01 reyk Exp $ */
/*
* Copyright (c) 2006, 2007 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -275,6 +275,7 @@ struct ctl_natlook {
in_port_t rsport;
in_port_t rdport;
int in;
+ int proto;
};
struct ctl_bindany {