]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Cleanup: make IP address show AnyAddr() as v4 or v6
authorAmos Jeffries <squid3@treenet.co.nz>
Tue, 30 Aug 2011 15:51:49 +0000 (03:51 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Tue, 30 Aug 2011 15:51:49 +0000 (03:51 +1200)
src/ip/Address.cc

index d5095d88acbf20e527bf1f73108046e59447d348..5eed2fa61dd6112980f1a52ab15f4ac64ae8b196 100644 (file)
@@ -826,7 +826,10 @@ Ip::Address::NtoA(char* buf, const unsigned int blen, int force) const
     /* some external code may have blindly memset a parent. */
     /* thats okay, our default is known */
     if ( IsAnyAddr() ) {
-        memcpy(buf,"::\0", min(static_cast<unsigned int>(3),blen));
+        if (IsIPv6())
+            memcpy(buf,"::\0", min(static_cast<unsigned int>(3),blen));
+        else if (IsIPv4())
+            memcpy(buf,"0.0.0.0\0", min(static_cast<unsigned int>(8),blen));
         return buf;
     }