summaryrefslogtreecommitdiffstats
path: root/usr.sbin/tftp-proxy
diff options
context:
space:
mode:
authorbenno <benno@openbsd.org>2013-12-23 11:45:39 +0000
committerbenno <benno@openbsd.org>2013-12-23 11:45:39 +0000
commitbc7a20e3b9be7b4eb4ac4bfb1178b467dafec0b3 (patch)
tree4fadbc9ce30be26bac8fcd5655f89f02aa3826c1 /usr.sbin/tftp-proxy
parentRevert previous commit. It makes resume hang on some MP systems running (diff)
downloadwireguard-openbsd-bc7a20e3b9be7b4eb4ac4bfb1178b467dafec0b3.tar.xz
wireguard-openbsd-bc7a20e3b9be7b4eb4ac4bfb1178b467dafec0b3.zip
fix IPv6 in proxy_dst6()
ok florian camield dlg
Diffstat (limited to 'usr.sbin/tftp-proxy')
-rw-r--r--usr.sbin/tftp-proxy/tftp-proxy.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/usr.sbin/tftp-proxy/tftp-proxy.c b/usr.sbin/tftp-proxy/tftp-proxy.c
index bcbecd71846..a8cc391ebca 100644
--- a/usr.sbin/tftp-proxy/tftp-proxy.c
+++ b/usr.sbin/tftp-proxy/tftp-proxy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tftp-proxy.c,v 1.6 2013/12/19 11:23:29 florian Exp $
+/* $OpenBSD: tftp-proxy.c,v 1.7 2013/12/23 11:45:39 benno Exp $
*
* Copyright (c) 2005 DLS Internet Services
* Copyright (c) 2004, 2005 Camiel Dobbelaar, <cd@sentia.nl>
@@ -540,6 +540,9 @@ proxy_listen(const char *addr, const char *port, int family)
if (setsockopt(s, IPPROTO_IPV6, IPV6_RECVPKTINFO,
&on, sizeof(on)) == -1)
errx(1, "setsockopt(IPV6_RECVPKTINFO)");
+ if (setsockopt(s, IPPROTO_IPV6, IPV6_RECVDSTPORT,
+ &on, sizeof(on)) == -1)
+ errx(1, "setsockopt(IPV6_RECVDSTPORT)");
break;
}
l->s = s;
@@ -606,8 +609,10 @@ proxy_dst6(struct cmsghdr *cmsg, struct sockaddr_storage *ss)
sin6->sin6_scope_id = ipi->ipi6_ifindex;
#endif
break;
-
- /* XXX PORT */
+ case IPV6_RECVDSTPORT:
+ memcpy(&sin6->sin6_port, CMSG_DATA(cmsg),
+ sizeof(sin6->sin6_port));
+ break;
}
return (0);