]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
net: Simplify makesock().
authorAndre Noll <maan@systemlinux.org>
Fri, 6 Sep 2013 23:17:17 +0000 (23:17 +0000)
committerAndre Noll <maan@systemlinux.org>
Sun, 22 Dec 2013 16:39:20 +0000 (16:39 +0000)
l3type is always AF_UNSPEC in this function.

net.c

diff --git a/net.c b/net.c
index caf84c90f0680538140bc77b840befb2ec8cd9c8..70d3ec0f2d1ad297a8249acb3bd0f1a1a0815eb9 100644 (file)
--- a/net.c
+++ b/net.c
@@ -377,7 +377,6 @@ int makesock(unsigned l4type, bool passive,
 {
        struct addrinfo *local = NULL, *src = NULL, *remote = NULL,
                *dst = NULL, hints;
 {
        struct addrinfo *local = NULL, *src = NULL, *remote = NULL,
                *dst = NULL, hints;
-       unsigned int    l3type = AF_UNSPEC;
        int             rc, on = 1, sockfd = -1,
                        socktype = sock_type(l4type);
        char port[6]; /* port number has at most 5 digits */
        int             rc, on = 1, sockfd = -1,
                        socktype = sock_type(l4type);
        char port[6]; /* port number has at most 5 digits */
@@ -385,7 +384,7 @@ int makesock(unsigned l4type, bool passive,
        sprintf(port, "%u", port_number);
        /* Set up address hint structure */
        memset(&hints, 0, sizeof(hints));
        sprintf(port, "%u", port_number);
        /* Set up address hint structure */
        memset(&hints, 0, sizeof(hints));
-       hints.ai_family = l3type;
+       hints.ai_family = AF_UNSPEC;
        hints.ai_socktype = socktype;
        /* 
         * getaddrinfo does not support SOCK_DCCP, so for the sake of lookup
        hints.ai_socktype = socktype;
        /* 
         * getaddrinfo does not support SOCK_DCCP, so for the sake of lookup
@@ -396,9 +395,6 @@ int makesock(unsigned l4type, bool passive,
 
        /* only use addresses available on the host */
        hints.ai_flags = AI_ADDRCONFIG;
 
        /* only use addresses available on the host */
        hints.ai_flags = AI_ADDRCONFIG;
-       if (l3type == AF_INET6)
-               /* use v4-mapped-v6 if no v6 addresses found */
-               hints.ai_flags |= AI_V4MAPPED | AI_ALL;
 
        if (passive && host == NULL)
                hints.ai_flags |= AI_PASSIVE;
 
        if (passive && host == NULL)
                hints.ai_flags |= AI_PASSIVE;