]> jfr.im git - irc/rqf/shadowircd.git/commitdiff
ip_cloaking: clarify logic
authorJilles Tjoelker <redacted>
Fri, 19 Sep 2008 22:30:35 +0000 (00:30 +0200)
committerJilles Tjoelker <redacted>
Fri, 19 Sep 2008 22:30:35 +0000 (00:30 +0200)
This also slightly changes mangled IPs but the
mangling is on the same level.

extensions/ip_cloaking.c

index e0e4ca22a4d290727024766a8bb540c0803e6f8e..035913e9b3f068c317fb0c54e85ff228c3341dfd 100644 (file)
@@ -106,19 +106,13 @@ do_host_cloak_ip(const char *inbuf, char *outbuf)
                        continue;
                }
 
-               switch (ipv6)
-               {
-               case 1:
-                       if (sepcount < totalcount / 2)
-                               break;
-               case 0:
-                       if (sepcount < 2)
-                               break;
-               default:
-                       *tptr = chartable[(*tptr + accum) % 20];
+               if (ipv6 && sepcount < totalcount / 2)
+                       continue;
 
-               }
+               if (!ipv6 && sepcount < 2)
+                       continue;
 
+               *tptr = chartable[(*tptr + accum) % 20];
                accum = (accum << 1) | (accum >> 31);
        }
 }