aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorMatt Mackall <mpm@selenic.com>2005-07-27 18:24:42 -0400
committerDavid S. Miller <davem@davemloft.net>2005-07-27 18:24:42 -0400
commit5e43db7730e7cef7d37968ea789c41392519a864 (patch)
treefc62684947bba192c649af7701ba85e2eedaabe5 /net
parent7cee432a22bb328ea7a4012dacc5a3471fabeb07 (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')
-rw-r--r--net/core/utils.c37
-rw-r--r--net/ipv4/Makefile2
-rw-r--r--net/ipv4/utils.c59
3 files changed, 37 insertions, 61 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)
153EXPORT_SYMBOL(net_random); 153EXPORT_SYMBOL(net_random);
154EXPORT_SYMBOL(net_ratelimit); 154EXPORT_SYMBOL(net_ratelimit);
155EXPORT_SYMBOL(net_srandom); 155EXPORT_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
190EXPORT_SYMBOL(in_aton);
diff --git a/net/ipv4/Makefile b/net/ipv4/Makefile
index 5718cdb3a61e..55dc6cca1e7b 100644
--- a/net/ipv4/Makefile
+++ b/net/ipv4/Makefile
@@ -2,7 +2,7 @@
2# Makefile for the Linux TCP/IP (INET) layer. 2# Makefile for the Linux TCP/IP (INET) layer.
3# 3#
4 4
5obj-y := utils.o route.o inetpeer.o protocol.o \ 5obj-y := route.o inetpeer.o protocol.o \
6 ip_input.o ip_fragment.o ip_forward.o ip_options.o \ 6 ip_input.o ip_fragment.o ip_forward.o ip_options.o \
7 ip_output.o ip_sockglue.o \ 7 ip_output.o ip_sockglue.o \
8 tcp.o tcp_input.o tcp_output.o tcp_timer.o tcp_ipv4.o \ 8 tcp.o tcp_input.o tcp_output.o tcp_timer.o tcp_ipv4.o \
diff --git a/net/ipv4/utils.c b/net/ipv4/utils.c
deleted file mode 100644
index 6aecd7a43534..000000000000
--- a/net/ipv4/utils.c
+++ /dev/null
@@ -1,59 +0,0 @@
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.
5 *
6 * Various kernel-resident INET utility functions; mainly
7 * for format conversion and debugging output.
8 *
9 * Version: $Id: utils.c,v 1.8 2000/10/03 07:29:01 anton Exp $
10 *
11 * Author: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
12 *
13 * Fixes:
14 * Alan Cox : verify_area check.
15 * Alan Cox : removed old debugging.
16 * Andi Kleen : add net_ratelimit()
17 *
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.
22 */
23
24#include <linux/module.h>
25#include <linux/types.h>
26#include <asm/byteorder.h>
27
28/*
29 * Convert an ASCII string to binary IP.
30 */
31
32__u32 in_aton(const char *str)
33{
34 unsigned long l;
35 unsigned int val;
36 int i;
37
38 l = 0;
39 for (i = 0; i < 4; i++)
40 {
41 l <<= 8;
42 if (*str != '\0')
43 {
44 val = 0;
45 while (*str != '\0' && *str != '.')
46 {
47 val *= 10;
48 val += *str - '0';
49 str++;
50 }
51 l |= val;
52 if (*str != '\0')
53 str++;
54 }
55 }
56 return(htonl(l));
57}
58
59EXPORT_SYMBOL(in_aton);