From dd1552dc6f1461e673325765ce0510550798bed8 Mon Sep 17 00:00:00 2001 From: tedu Date: Thu, 15 Oct 2015 21:35:27 +0000 Subject: [PATCH] the inet sockets don't work well with inet6 addrs. pick family from addr. detected by naddy --- usr.sbin/rebound/rebound.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/usr.sbin/rebound/rebound.c b/usr.sbin/rebound/rebound.c index 3595a1eeb5b..87146d23aa7 100644 --- a/usr.sbin/rebound/rebound.c +++ b/usr.sbin/rebound/rebound.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rebound.c,v 1.7 2015/10/15 21:25:05 tedu Exp $ */ +/* $OpenBSD: rebound.c,v 1.8 2015/10/15 21:35:27 tedu Exp $ */ /* * Copyright (c) 2015 Ted Unangst * @@ -180,7 +180,7 @@ newrequest(int ud, struct sockaddr *remoteaddr) } req->cacheent = hit; - req->s = socket(AF_INET, SOCK_DGRAM, 0); + req->s = socket(remoteaddr->sa_family, SOCK_DGRAM, 0); if (req->s == -1) goto fail; if (connect(req->s, remoteaddr, remoteaddr->sa_len) == -1) { @@ -259,7 +259,7 @@ newtcprequest(int ld, struct sockaddr *remoteaddr) if (req->client == -1) goto fail; - req->s = socket(AF_INET, SOCK_STREAM, 0); + req->s = socket(remoteaddr->sa_family, SOCK_STREAM, 0); if (req->s == -1) goto fail; if (connect(req->s, remoteaddr, remoteaddr->sa_len) == -1) -- 2.20.1