From: Andre Noll Date: Fri, 6 Sep 2013 23:17:17 +0000 (+0000) Subject: net: Simplify makesock(). X-Git-Tag: v0.5.2~11^2~17 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=7d2c2777c3cc16ef50f580f5ff548d8ad6bb0c9b;ds=inline net: Simplify makesock(). l3type is always AF_UNSPEC in this function. --- diff --git a/net.c b/net.c index caf84c90..70d3ec0f 100644 --- 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; - 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 */ @@ -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)); - 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 @@ -396,9 +395,6 @@ int makesock(unsigned l4type, bool passive, /* 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;