diff options
author | Matt Mackall <mpm@selenic.com> | 2005-07-27 18:24:42 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2005-07-27 18:24:42 -0400 |
commit | 5e43db7730e7cef7d37968ea789c41392519a864 (patch) | |
tree | fc62684947bba192c649af7701ba85e2eedaabe5 /net/core/utils.c | |
parent | 7cee432a22bb328ea7a4012dacc5a3471fabeb07 (diff) |
[NET]: Move in_aton from net/ipv4/utils.c to net/core/utils.c
Move in_aton to allow netpoll and pktgen to work without the rest of
the IPv4 stack. Fix whitespace and add comment for the odd placement.
Delete now-empty net/ipv4/utils.c
Re-enable netpoll/netconsole without CONFIG_INET
Signed-off-by: Matt Mackall <mpm@selenic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
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 @@ | |||
23 | #include <linux/percpu.h> | 23 | #include <linux/percpu.h> |
24 | #include <linux/init.h> | 24 | #include <linux/init.h> |
25 | 25 | ||
26 | #include <asm/byteorder.h> | ||
26 | #include <asm/system.h> | 27 | #include <asm/system.h> |
27 | #include <asm/uaccess.h> | 28 | #include <asm/uaccess.h> |
28 | 29 | ||
29 | |||
30 | /* | 30 | /* |
31 | This is a maximally equidistributed combined Tausworthe generator | 31 | This is a maximally equidistributed combined Tausworthe generator |
32 | based on code from GNU Scientific Library 1.5 (30 Jun 2004) | 32 | based on code from GNU Scientific Library 1.5 (30 Jun 2004) |
@@ -153,3 +153,38 @@ int net_ratelimit(void) | |||
153 | EXPORT_SYMBOL(net_random); | 153 | EXPORT_SYMBOL(net_random); |
154 | EXPORT_SYMBOL(net_ratelimit); | 154 | EXPORT_SYMBOL(net_ratelimit); |
155 | EXPORT_SYMBOL(net_srandom); | 155 | EXPORT_SYMBOL(net_srandom); |
156 | |||
157 | /* | ||
158 | * Convert an ASCII string to binary IP. | ||
159 | * This is outside of net/ipv4/ because various code that uses IP addresses | ||
160 | * is otherwise not dependent on the TCP/IP stack. | ||
161 | */ | ||
162 | |||
163 | __u32 in_aton(const char *str) | ||
164 | { | ||
165 | unsigned long l; | ||
166 | unsigned int val; | ||
167 | int i; | ||
168 | |||
169 | l = 0; | ||
170 | for (i = 0; i < 4; i++) | ||
171 | { | ||
172 | l <<= 8; | ||
173 | if (*str != '\0') | ||
174 | { | ||
175 | val = 0; | ||
176 | while (*str != '\0' && *str != '.') | ||
177 | { | ||
178 | val *= 10; | ||
179 | val += *str - '0'; | ||
180 | str++; | ||
181 | } | ||
182 | l |= val; | ||
183 | if (*str != '\0') | ||
184 | str++; | ||
185 | } | ||
186 | } | ||
187 | return(htonl(l)); | ||
188 | } | ||
189 | |||
190 | EXPORT_SYMBOL(in_aton); | ||