Skip to content

Commit 4238225

Browse files
committed
Custom strtoul => simple_strtoul.
I've verified and traced this back to the initial import into git, around version 2.6.12 of the kernel. If anybody fails to compile against older than that I think we can look into this but highly doubt that'll be an issue. Signed-off-by: Jaco Kroon <jaco@uls.co.za>
1 parent df33a7d commit 4238225

File tree

2 files changed

+2
-36
lines changed

2 files changed

+2
-36
lines changed

compat.h

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -716,40 +716,6 @@ static inline void do_gettimeofday(struct timeval *tv)
716716
}
717717
#endif
718718

719-
#define TOLOWER(x) ((x) | 0x20)
720-
unsigned long long strtoul(const char *cp, char **endp, unsigned int base)
721-
{
722-
unsigned long long result = 0;
723-
724-
if (!base) {
725-
if (cp[0] == '0') {
726-
if (TOLOWER(cp[1]) == 'x' && isxdigit(cp[2]))
727-
base = 16;
728-
else
729-
base = 8;
730-
} else {
731-
base = 10;
732-
}
733-
}
734-
735-
if (base == 16 && cp[0] == '0' && TOLOWER(cp[1]) == 'x')
736-
cp += 2;
737-
738-
while (isxdigit(*cp)) {
739-
unsigned int value;
740-
741-
value = isdigit(*cp) ? *cp - '0' : TOLOWER(*cp) - 'a' + 10;
742-
if (value >= base)
743-
break;
744-
result = result * base + value;
745-
cp++;
746-
}
747-
if (endp)
748-
*endp = (char *)cp;
749-
750-
return result;
751-
}
752-
753719
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,12,0)) \
754720
|| ((LINUX_VERSION_CODE >= KERNEL_VERSION(5,10,220)) && (LINUX_VERSION_CODE < KERNEL_VERSION(5,11,0)))
755721
/*

ipt_NETFLOW.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2402,7 +2402,7 @@ static int add_destinations(const char *ptr)
24022402
++end;
24032403
if (succ &&
24042404
(*end == ':' || *end == '.' || *end == 'p' || *end == '#'))
2405-
sin6->sin6_port = htons(strtoul(++end, (char **)&end, 0));
2405+
sin6->sin6_port = htons(simple_strtoul(++end, (char **)&end, 0));
24062406
if (succ && *end == '@') {
24072407
++end;
24082408
sout->sin6_family = AF_INET6;
@@ -2417,7 +2417,7 @@ static int add_destinations(const char *ptr)
24172417
sin->sin_port = htons(2055);
24182418
succ = in4_pton(ptr, len, (u8 *)&sin->sin_addr, -1, &end);
24192419
if (succ && *end == ':')
2420-
sin->sin_port = htons(strtoul(++end, (char **)&end, 0));
2420+
sin->sin_port = htons(simple_strtoul(++end, (char **)&end, 0));
24212421
if (succ && *end == '@') {
24222422
++end;
24232423
sout->sin_family = AF_INET;

0 commit comments

Comments
 (0)