All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dstlimit does not support invert
@ 2004-09-20 23:52 Phil Oester
  0 siblings, 0 replies; only message in thread
From: Phil Oester @ 2004-09-20 23:52 UTC (permalink / raw)
  To: netfilter-devel

[-- Attachment #1: Type: text/plain, Size: 109 bytes --]

Like limit match, userspace only partially handled invert case.  Patch
below handles the other one.

Phil




[-- Attachment #2: patch-dstlimit --]
[-- Type: text/plain, Size: 3575 bytes --]

diff -ru ipt-orig/extensions/libipt_dstlimit.c ipt-new/extensions/libipt_dstlimit.c
--- ipt-orig/extensions/libipt_dstlimit.c	2004-02-23 03:10:55.000000000 -0800
+++ ipt-new/extensions/libipt_dstlimit.c	2004-09-20 16:45:19.587967284 -0700
@@ -132,9 +132,7 @@
 
 	switch(c) {
 	case '%':
-		if (check_inverse(optarg, &invert, NULL, 0))
-			exit_error(PARAMETER_PROBLEM,
-				   "Unexpected `!' after --dstlimit");
+		if (check_inverse(argv[optind-1], &invert, &optind, 0)) break;
 		if (!parse_rate(optarg, &r->cfg.avg))
 			exit_error(PARAMETER_PROBLEM,
 				   "bad rate `%s'", optarg);
@@ -142,10 +140,7 @@
 		break;
 
 	case '$':
-		if (check_inverse(optarg, &invert, NULL, 0))
-			exit_error(PARAMETER_PROBLEM,
-				   "Unexpected `!' after --dstlimit-burst");
-
+		if (check_inverse(argv[optind-1], &invert, &optind, 0)) break;
 		if (string_to_number(optarg, 0, 10000, &num) == -1)
 			exit_error(PARAMETER_PROBLEM,
 				   "bad --dstlimit-burst `%s'", optarg);
@@ -153,10 +148,7 @@
 		*flags |= PARAM_BURST;
 		break;
 	case '&':
-		if (check_inverse(optarg, &invert, NULL, 0))
-			exit_error(PARAMETER_PROBLEM,
-				"Unexpected `!' after --dstlimit-htable-size");
-
+		if (check_inverse(argv[optind-1], &invert, &optind, 0)) break;
 		if (string_to_number(optarg, 0, 0xffffffff, &num) == -1)
 			exit_error(PARAMETER_PROBLEM,
 				"bad --dstlimit-htable-size: `%s'", optarg);
@@ -164,9 +156,7 @@
 		*flags |= PARAM_SIZE;
 		break;
 	case '*':
-		if (check_inverse(optarg, &invert, NULL, 0))
-			exit_error(PARAMETER_PROBLEM,
-				"Unexpected `!' after --dstlimit-htable-max");
+		if (check_inverse(argv[optind-1], &invert, &optind, 0)) break;
 		if (string_to_number(optarg, 0, 0xffffffff, &num) == -1)
 			exit_error(PARAMETER_PROBLEM,
 				"bad --dstlimit-htable-max: `%s'", optarg);
@@ -174,9 +164,7 @@
 		*flags |= PARAM_MAX;
 		break;
 	case '(':
-		if (check_inverse(optarg, &invert, NULL, 0))
-			exit_error(PARAMETER_PROBLEM, "Unexpected `!' after "
-					"--dstlimit-htable-gcinterval");
+		if (check_inverse(argv[optind-1], &invert, &optind, 0)) break;
 		if (string_to_number(optarg, 0, 0xffffffff, &num) == -1)
 			exit_error(PARAMETER_PROBLEM,
 				"bad --dstlimit-htable-gcinterval: `%s'", 
@@ -186,9 +174,7 @@
 		*flags |= PARAM_GCINTERVAL;
 		break;
 	case ')':
-		if (check_inverse(optarg, &invert, NULL, 0))
-			exit_error(PARAMETER_PROBLEM, "Unexpected `!' after " 
-					"--dstlimit-htable-expire");
+		if (check_inverse(argv[optind-1], &invert, &optind, 0)) break;
 		if (string_to_number(optarg, 0, 0xffffffff, &num) == -1)
 			exit_error(PARAMETER_PROBLEM,
 				"bad --dstlimit-htable-expire: `%s'", optarg);
@@ -197,9 +183,7 @@
 		*flags |= PARAM_EXPIRE;
 		break;
 	case '_':
-		if (check_inverse(optarg, &invert, NULL, 0))
-			exit_error(PARAMETER_PROBLEM, "Unexpected `!' after "
-					"--dstlimit-mode");
+		if (check_inverse(argv[optind-1], &invert, &optind, 0)) break;
 		if (!strcmp(optarg, "dstip"))
 			r->cfg.mode = IPT_DSTLIMIT_HASH_DIP;
 		else if (!strcmp(optarg, "dstip-destport") ||
@@ -216,9 +200,7 @@
 		*flags |= PARAM_MODE;
 		break;
 	case '"':
-		if (check_inverse(optarg, &invert, NULL, 0))
-			exit_error(PARAMETER_PROBLEM, "Unexpected `!' after "
-					"--dstlimit-name");
+		if (check_inverse(argv[optind-1], &invert, &optind, 0)) break;
 		if (strlen(optarg) == 0)
 			exit_error(PARAMETER_PROBLEM, "Zero-length name?");
 		strncpy(r->name, optarg, sizeof(r->name));
@@ -228,6 +210,10 @@
 		return 0;
 	}
 
+	if (invert)
+		exit_error(PARAMETER_PROBLEM,
+			   "dstlimit does not support invert");
+
 	return 1;
 }
 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-09-20 23:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-09-20 23:52 [PATCH] dstlimit does not support invert Phil Oester

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.