[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>
This commit is contained in:
Michael Brown
2015-02-19 14:02:07 +00:00
parent 095c007aa3
commit bb1abb2b21
3 changed files with 39 additions and 28 deletions

View File

@@ -138,6 +138,8 @@ static void ipv4_test_exec ( void ) {
inet_aton_fail_ok ( "256.0.0.1" ); /* Byte out of range */
inet_aton_fail_ok ( "212.13.204.60.1" ); /* Too long */
inet_aton_fail_ok ( "127.0.0" ); /* Too short */
inet_aton_fail_ok ( "1.2.3.a" ); /* Invalid characters */
inet_aton_fail_ok ( "127.0..1" ); /* Missing bytes */
}
/** IPv4 self-test */