diff options
| author | David Woodhouse <dwmw2@shinybook.infradead.org> | 2005-08-09 16:51:35 +0100 |
|---|---|---|
| committer | David Woodhouse <dwmw2@shinybook.infradead.org> | 2005-08-09 16:51:35 +0100 |
| commit | c973b112c76c9d8fd042991128f218a738cc8d0a (patch) | |
| tree | e813b0da5d0a0e19e06de6462d145a29ad683026 /net/core/utils.c | |
| parent | c5fbc3966f48279dbebfde10248c977014aa9988 (diff) | |
| parent | 00dd1e433967872f3997a45d5adf35056fdf2f56 (diff) | |
Merge with /shiny/git/linux-2.6/.git
Diffstat (limited to 'net/core/utils.c')
| -rw-r--r-- | net/core/utils.c | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/net/core/utils.c b/net/core/utils.c index e11a8654f363..88eb8b68e26b 100644 --- a/net/core/utils.c +++ b/net/core/utils.c @@ -23,10 +23,10 @@ #include <linux/percpu.h> #include <linux/init.h> +#include <asm/byteorder.h> #include <asm/system.h> #include <asm/uaccess.h> - /* This is a maximally equidistributed combined Tausworthe generator based on code from GNU Scientific Library 1.5 (30 Jun 2004) @@ -153,3 +153,38 @@ int net_ratelimit(void) EXPORT_SYMBOL(net_random); EXPORT_SYMBOL(net_ratelimit); EXPORT_SYMBOL(net_srandom); + +/* + * Convert an ASCII string to binary IP. + * This is outside of net/ipv4/ because various code that uses IP addresses + * is otherwise not dependent on the TCP/IP stack. + */ + +__u32 in_aton(const char *str) +{ + unsigned long l; + unsigned int val; + int i; + + l = 0; + for (i = 0; i < 4; i++) + { + l <<= 8; + if (*str != '\0') + { + val = 0; + while (*str != '\0' && *str != '.') + { + val *= 10; + val += *str - '0'; + str++; + } + l |= val; + if (*str != '\0') + str++; + } + } + return(htonl(l)); +} + +EXPORT_SYMBOL(in_aton); |
