the inet sockets don't work well with inet6 addrs. pick family from addr.
authortedu <tedu@openbsd.org>
Thu, 15 Oct 2015 21:35:27 +0000 (21:35 +0000)
committertedu <tedu@openbsd.org>
Thu, 15 Oct 2015 21:35:27 +0000 (21:35 +0000)
detected by naddy

usr.sbin/rebound/rebound.c

index 3595a1e..87146d2 100644 (file)
@@ -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 <tedu@openbsd.org>
  *
@@ -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)