]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
ipban: support v6 IPs (mapping mask 1 to /16, 2 to /32, 3 to /48, 4 to /64)
authorRudolf Polzer <divverent@alientrap.org>
Sat, 2 Oct 2010 19:17:04 +0000 (21:17 +0200)
committerRudolf Polzer <divverent@alientrap.org>
Sat, 2 Oct 2010 19:17:04 +0000 (21:17 +0200)
qcsrc/server/ipban.qc

index ebc58cea7e2847982efb41ace84d6089f001ca1c..ad09772a5354548b64bbc12e656622cf1076f83a 100644 (file)
@@ -336,19 +336,27 @@ float Ban_GetClientIP(entity client)
        string s;
 
        s = client.netaddress;
-       
+
        i1 = strstrofs(s, ".", 0);
+       if(i1 < 0)
+               i1 = strstrofs(s, ":", 0);
        if(i1 < 0)
                return FALSE;
        i2 = strstrofs(s, ".", i1 + 1);
+       if(i2 < 0)
+               i2 = strstrofs(s, ":", i1 + 1);
        if(i2 < 0)
                return FALSE;
        i3 = strstrofs(s, ".", i2 + 1);
+       if(i3 < 0)
+               i3 = strstrofs(s, ":", i2 + 1);
        if(i3 < 0)
                return FALSE;
        i4 = strstrofs(s, ".", i3 + 1);
+       if(i4 < 0)
+               i4 = strstrofs(s, ":", i3 + 1);
        if(i4 >= 0)
-               return FALSE;
+               s = substring(s, 0, i4);
        
        ban_ip1 = substring(s, 0, i1);
        ban_ip2 = substring(s, 0, i2);