aboutsummaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2015-02-19 14:02:07 +0000
committerMichael Brown <mcb30@ipxe.org>2015-02-19 14:02:07 +0000
commitbb1abb2b213adceb606ff458e3786c8c2ea4dc8a (patch)
tree95b4a41c9a1374798662f4a61e193de1a1836753 /src/core
parent095c007aa35259b9eb7c91d7f5c3484e8d14a7b1 (diff)
downloadipxe-bb1abb2b213adceb606ff458e3786c8c2ea4dc8a.zip
ipxe-bb1abb2b213adceb606ff458e3786c8c2ea4dc8a.tar.gz
ipxe-bb1abb2b213adceb606ff458e3786c8c2ea4dc8a.tar.bz2
[ipv4] Rewrite inet_aton()
The implementation of inet_aton() has an unknown provenance. Rewrite this code to avoid potential licensing uncertainty. Also move the code from core/misc.c to its logical home in net/ipv4.c, and add a few extra test cases. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/core')
-rw-r--r--src/core/misc.c23
1 files changed, 0 insertions, 23 deletions
diff --git a/src/core/misc.c b/src/core/misc.c
index eaceddf..84cfcd8 100644
--- a/src/core/misc.c
+++ b/src/core/misc.c
@@ -10,29 +10,6 @@ FILE_LICENCE ( GPL2_OR_LATER );
#include <ipxe/in.h>
#include <ipxe/timer.h>
-/**************************************************************************
-INET_ATON - Convert an ascii x.x.x.x to binary form
-**************************************************************************/
-int inet_aton ( const char *cp, struct in_addr *inp ) {
- const char *p = cp;
- const char *digits_start;
- unsigned long ip = 0;
- unsigned long val;
- int j;
- for(j = 0; j <= 3; j++) {
- digits_start = p;
- val = strtoul(p, ( char ** ) &p, 10);
- if ((p == digits_start) || (val > 255)) return 0;
- if ( ( j < 3 ) && ( *(p++) != '.' ) ) return 0;
- ip = (ip << 8) | val;
- }
- if ( *p == '\0' ) {
- inp->s_addr = htonl(ip);
- return 1;
- }
- return 0;
-}
-
unsigned int strtoul_charval ( unsigned int charval ) {
if ( charval >= 'a' ) {