]> git.tdb.fi Git - libs/net.git/commitdiff
Create wildcard addresses if * is passed as host
authorMikko Rasa <tdb@tdb.fi>
Wed, 10 Aug 2011 16:28:39 +0000 (19:28 +0300)
committerMikko Rasa <tdb@tdb.fi>
Wed, 10 Aug 2011 16:28:39 +0000 (19:28 +0300)
source/resolve.cpp

index 8afe0fef1bfbc39a907a754871c5834add0c85c1..6e17a1abb38a1318bfacf8e4b2fa8adf09a58583 100644 (file)
@@ -38,7 +38,14 @@ SockAddr *resolve(const string &s, Family family)
                        host = s;
        }
 
-       addrinfo hints = { 0, family_to_sys(family), 0, 0, 0, 0, 0, 0 };
+       unsigned flags = 0;
+       if(host=="*")
+       {
+               flags = AI_PASSIVE;
+               host = string();
+       }
+
+       addrinfo hints = { flags, family_to_sys(family), 0, 0, 0, 0, 0, 0 };
        addrinfo *res;
        const char *chost = (host.empty() ? 0 : host.c_str());
        const char *cserv = (serv.empty() ? 0 : serv.c_str());