Skip to contentSkip to conversation

MARK target with unsigned long

PATCH Eric Crossman 1 participant 1 message Sep 5, 2003

lore
Share & tools
lore
#0 lore raw

Has anyone run across a problem trying to use the high order bits in MARKing packets (i.e. 0xffffffff)? The fwmark seems to be using a signed long opposed to an unsigned long with limits the highest allowable value to 0x7fffffff. I have created the following patch which uses an unsigned long. Is this a legitimate fix that won't interfere with other parts of the iptables code?

iptables.c 2003-08-30 16:08:05.000000000 -0400 renamed from iptables.c 2003-03-31 07:11:55.000000000 -0500 +0 -0
diff -Naur iptables-1.2.8.orig/iptables.c iptables-1.2.8/iptables.c
@@ -889,12 +889,12 @@

string_to_number(const char *s, unsigned int min, unsigned int max,
unsigned int *ret)
{
- long number;

+       unsigned long number;
       char *end;

       /* Handle hex, octal, etc. */
       errno = 0;
-       number = strtol(s, &end, 0);
+       number = strtoul(s, &end, 0);
       if (*end == '\0' && end != s) {
               /* we parsed a number, let's see if we want this */
               if (errno != ERANGE && min <= number && number <= max) {

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Eric Crossman <[email protected]>
Critical Technologies Inc.
1001 Broad St., Suite 400
Utica, NY 13501