]> git.ipfire.org Git - people/stevee/ipfire-2.x.git/commitdiff
guardianctrl: Allow to (un)block subnets.
authorStefan Schantl <stefan.schantl@ipfire.org>
Sun, 8 Jun 2014 10:38:35 +0000 (12:38 +0200)
committerStefan Schantl <stefan.schantl@ipfire.org>
Sun, 22 Jun 2014 09:23:40 +0000 (11:23 +0200)
src/misc-progs/guardianctrl.c

index e94d23305c6e5e629ca686384b1168b882c55b06..cde38f7da3c709a55db9dab722ee32b0b645e011 100644 (file)
@@ -47,8 +47,8 @@ int main(int argc, char *argv[]) {
         } else if (strcmp(argv[1], "block") == 0) {
                if (argc == 3) {
                        char* ipaddress = argv[2];
-                       if (!VALID_IP(ipaddress)) {
-                               fprintf(stderr, "A valid IP address is required.\n");
+                       if ((!VALID_IP(ipaddress)) && (!VALID_IP_AND_MASK(ipaddress))) {
+                               fprintf(stderr, "A valid IP address or subnet is required.\n");
                                exit(1);
                        }
 
@@ -61,8 +61,8 @@ int main(int argc, char *argv[]) {
         } else if (strcmp(argv[1], "unblock") == 0) {
                if (argc == 3) {
                        char* ipaddress = argv[2];
-                       if (!VALID_IP(ipaddress)) {
-                               fprintf(stderr, "A valid IP address is required.\n");
+                       if ((!VALID_IP(ipaddress)) && (!VALID_IP_AND_MASK(ipaddress))) {
+                               fprintf(stderr, "A valid IP address or subnet is required.\n");
                                exit(1);
                        }