diff options
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); | ||