Linux Netfilter discussions
 help / color / mirror / Atom feed
* MARK target with unsigned long
@ 2003-09-05 15:25 Eric Crossman
  0 siblings, 0 replies; only message in thread
From: Eric Crossman @ 2003-09-05 15:25 UTC (permalink / raw)
  To: netfilter list

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?

diff -Naur iptables-1.2.8.orig/iptables.c iptables-1.2.8/iptables.c
--- iptables-1.2.8.orig/iptables.c      2003-03-31 07:11:55.000000000 -0500
+++ iptables-1.2.8/iptables.c   2003-08-30 16:08:05.000000000 -0400
@@ -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 <eric.crossman@critical.com>
Critical Technologies Inc.
1001 Broad St., Suite 400
Utica, NY 13501



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

only message in thread, other threads:[~2003-09-05 15:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-09-05 15:25 MARK target with unsigned long Eric Crossman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox