Skip to contentSkip to conversation

MARK target doesn't allow to set highest bit

PATCH In review Marcus Sundberg 2 participants 3 messages Oct 31, 2002 – Nov 4, 2002 netfilter

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 MARK target doesn't allow to set highest bit

Hi,

libipt_MARK.c has been broken since iptables 1.2.7. This patch makes it work properly again:

libipt_MARK.c +3 -2
diff -u -r1.8 -r1.6
@@ -46,9 +46,10 @@
 		= (struct ipt_mark_target_info *)(*target)->data;
 
 	switch (c) {
+		char *end;
 	case '1':
-		if (string_to_number(optarg, 0, 0xffffffff, 
-				     (unsigned int *)&markinfo->mark))
+		markinfo->mark = strtoul(optarg, &end, 0);
+		if (*end != '\0' || end == optarg)
 			exit_error(PARAMETER_PROBLEM, "Bad MARK value `%s'", optarg);
 		if (*flags)
 			exit_error(PARAMETER_PROBLEM,

//Marcus

Signature · 3 lines
---------------------------------------+--------------------------
  Marcus Sundberg <[email protected]>  | Firewalls with SIP & NAT
 Firewall Developer, Ingate Systems AB |  http://www.ingate.com/
#1 lore raw
Quoted 4 lines · Marcus Sundberg

Hi,

libipt_MARK.c has been broken since iptables 1.2.7. This patch makes it work properly again:

Broken in which way? Am I right you are talking about signed/unsigned numbers and not being able to specify the upper half of the mark range?

Quoted 1 line

//Marcus

Signature · 5 lines
Live long and prosper
- Harald Welte / [email protected]               http://www.gnumonks.org/
============================================================================
"If this were a dictatorship, it'd be a heck of a lot easier, just so long
 as I'm the dictator."  --  George W. Bush Dec 18, 2000
#2 lore raw
Quoted 6 lines · Harald Welte
Quoted 2 lines

libipt_MARK.c has been broken since iptables 1.2.7. This patch makes it work properly again:

Broken in which way? Am I right you are talking about signed/unsigned numbers and not being able to specify the upper half of the mark range?

Yes, exactly. It worked fine with the old code, but string_to_number() doesn't handle unsigned numbers.

//Marcus

Signature · 3 lines
---------------------------------------+--------------------------
  Marcus Sundberg <[email protected]>  | Firewalls with SIP & NAT
 Firewall Developer, Ingate Systems AB |  http://www.ingate.com/