MOXA linux-2.6.x / linux-2.6.9-uc0 from sdlinux-moxaart.tgz
[linux-2.6.9-moxart.git] / net / ipv4 / utils.c
blob6aecd7a43534a399b14a5afb7926612fad30ea2d
1 /*
2 * INET An implementation of the TCP/IP protocol suite for the LINUX
3 * operating system. INET is implemented using the BSD Socket
4 * interface as the means of communication with the user level.
6 * Various kernel-resident INET utility functions; mainly
7 * for format conversion and debugging output.
9 * Version: $Id: utils.c,v 1.8 2000/10/03 07:29:01 anton Exp $
11 * Author: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
13 * Fixes:
14 * Alan Cox : verify_area check.
15 * Alan Cox : removed old debugging.
16 * Andi Kleen : add net_ratelimit()
18 * This program is free software; you can redistribute it and/or
19 * modify it under the terms of the GNU General Public License
20 * as published by the Free Software Foundation; either version
21 * 2 of the License, or (at your option) any later version.
24 #include <linux/module.h>
25 #include <linux/types.h>
26 #include <asm/byteorder.h>
29 * Convert an ASCII string to binary IP.
32 __u32 in_aton(const char *str)
34 unsigned long l;
35 unsigned int val;
36 int i;
38 l = 0;
39 for (i = 0; i < 4; i++)
41 l <<= 8;
42 if (*str != '\0')
44 val = 0;
45 while (*str != '\0' && *str != '.')
47 val *= 10;
48 val += *str - '0';
49 str++;
51 l |= val;
52 if (*str != '\0')
53 str++;
56 return(htonl(l));
59 EXPORT_SYMBOL(in_aton);