Commit 576018a4 authored by David S. Miller's avatar David S. Miller

Merge kernel.bkbits.net:/home/acme/net-2.5

into nuts.ninka.net:/home/davem/src/BK/net-2.5
parents 33bc7fff 31c37b27
...@@ -277,5 +277,6 @@ static inline void fib_res_put(struct fib_result *res) ...@@ -277,5 +277,6 @@ static inline void fib_res_put(struct fib_result *res)
} }
extern int fib_proc_init(void); extern int fib_proc_init(void);
extern void fib_proc_exit(void);
#endif /* _NET_FIB_H */ #endif /* _NET_FIB_H */
...@@ -2,13 +2,14 @@ ...@@ -2,13 +2,14 @@
# Makefile for the Linux TCP/IP (INET) layer. # Makefile for the Linux TCP/IP (INET) layer.
# #
obj-y := utils.o route.o inetpeer.o proc.o protocol.o \ obj-y := utils.o route.o inetpeer.o protocol.o \
ip_input.o ip_fragment.o ip_forward.o ip_options.o \ ip_input.o ip_fragment.o ip_forward.o ip_options.o \
ip_output.o ip_sockglue.o \ ip_output.o ip_sockglue.o \
tcp.o tcp_input.o tcp_output.o tcp_timer.o tcp_ipv4.o tcp_minisocks.o \ tcp.o tcp_input.o tcp_output.o tcp_timer.o tcp_ipv4.o tcp_minisocks.o \
tcp_diag.o raw.o udp.o arp.o icmp.o devinet.o af_inet.o igmp.o \ tcp_diag.o raw.o udp.o arp.o icmp.o devinet.o af_inet.o igmp.o \
sysctl_net_ipv4.o fib_frontend.o fib_semantics.o fib_hash.o sysctl_net_ipv4.o fib_frontend.o fib_semantics.o fib_hash.o
obj-$(CONFIG_PROC_FS) += proc.o
obj-$(CONFIG_IP_MULTIPLE_TABLES) += fib_rules.o obj-$(CONFIG_IP_MULTIPLE_TABLES) += fib_rules.o
obj-$(CONFIG_IP_ROUTE_NAT) += ip_nat_dumb.o obj-$(CONFIG_IP_ROUTE_NAT) += ip_nat_dumb.o
obj-$(CONFIG_IP_MROUTE) += ipmr.o obj-$(CONFIG_IP_MROUTE) += ipmr.o
......
...@@ -1155,12 +1155,9 @@ module_init(inet_init); ...@@ -1155,12 +1155,9 @@ module_init(inet_init);
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
extern int ip_misc_proc_init(void);
extern int raw_get_info(char *, char **, off_t, int); extern int raw_get_info(char *, char **, off_t, int);
extern int snmp_get_info(char *, char **, off_t, int);
extern int netstat_get_info(char *, char **, off_t, int);
extern int afinet_get_info(char *, char **, off_t, int);
extern int tcp_get_info(char *, char **, off_t, int); extern int tcp_get_info(char *, char **, off_t, int);
extern int udp_get_info(char *, char **, off_t, int);
int __init ipv4_proc_init(void) int __init ipv4_proc_init(void)
{ {
...@@ -1168,45 +1165,29 @@ int __init ipv4_proc_init(void) ...@@ -1168,45 +1165,29 @@ int __init ipv4_proc_init(void)
if (!proc_net_create("raw", 0, raw_get_info)) if (!proc_net_create("raw", 0, raw_get_info))
goto out_raw; goto out_raw;
if (!proc_net_create("netstat", 0, netstat_get_info))
goto out_netstat;
if (!proc_net_create("snmp", 0, snmp_get_info))
goto out_snmp;
if (!proc_net_create("sockstat", 0, afinet_get_info))
goto out_sockstat;
if (!proc_net_create("tcp", 0, tcp_get_info)) if (!proc_net_create("tcp", 0, tcp_get_info))
goto out_tcp; goto out_tcp;
if (udp_proc_init()) if (udp_proc_init())
goto out_udp; goto out_udp;
if (fib_proc_init()) if (fib_proc_init())
goto out_fib; goto out_fib;
if (ip_misc_proc_init())
goto out_misc;
out: out:
return rc; return rc;
out_misc:
fib_proc_exit();
out_fib: out_fib:
udp_proc_exit(); udp_proc_exit();
out_udp: out_udp:
proc_net_remove("tcp"); proc_net_remove("tcp");
out_tcp: out_tcp:
proc_net_remove("sockstat");
out_sockstat:
proc_net_remove("snmp");
out_snmp:
proc_net_remove("netstat");
out_netstat:
proc_net_remove("raw"); proc_net_remove("raw");
out_raw: out_raw:
rc = -ENOMEM; rc = -ENOMEM;
goto out; goto out;
} }
int ip_seq_release(struct inode *inode, struct file *file)
{
struct seq_file *seq = (struct seq_file *)file->private_data;
kfree(seq->private);
seq->private = NULL;
return seq_release(inode, file);
}
#else /* CONFIG_PROC_FS */ #else /* CONFIG_PROC_FS */
int __init ipv4_proc_init(void) int __init ipv4_proc_init(void)
{ {
......
...@@ -1086,9 +1086,21 @@ int __init fib_proc_init(void) ...@@ -1086,9 +1086,21 @@ int __init fib_proc_init(void)
rc = -ENOMEM; rc = -ENOMEM;
return rc; return rc;
} }
void __init fib_proc_exit(void)
{
remove_proc_entry("route", proc_net);
}
#else /* CONFIG_PROC_FS */ #else /* CONFIG_PROC_FS */
int __init fib_proc_init(void) int __init fib_proc_init(void)
{ {
return 0; return 0;
} }
void __init fib_proc_exit(void)
{
return 0;
}
#endif /* CONFIG_PROC_FS */ #endif /* CONFIG_PROC_FS */
...@@ -47,6 +47,8 @@ ...@@ -47,6 +47,8 @@
#include <net/tcp.h> #include <net/tcp.h>
#include <net/udp.h> #include <net/udp.h>
#include <linux/skbuff.h> #include <linux/skbuff.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <net/sock.h> #include <net/sock.h>
#include <net/raw.h> #include <net/raw.h>
...@@ -212,3 +214,33 @@ int netstat_get_info(char *buffer, char **start, off_t offset, int length) ...@@ -212,3 +214,33 @@ int netstat_get_info(char *buffer, char **start, off_t offset, int length)
len = 0; len = 0;
return len; return len;
} }
int __init ip_misc_proc_init(void)
{
int rc = 0;
if (!proc_net_create("netstat", 0, netstat_get_info))
goto out_netstat;
if (!proc_net_create("snmp", 0, snmp_get_info))
goto out_snmp;
if (!proc_net_create("sockstat", 0, afinet_get_info))
goto out_sockstat;
out:
return rc;
out_sockstat:
proc_net_remove("snmp");
out_snmp:
proc_net_remove("netstat");
out_netstat:
rc = -ENOMEM;
goto out;
}
int ip_seq_release(struct inode *inode, struct file *file)
{
struct seq_file *seq = (struct seq_file *)file->private_data;
kfree(seq->private);
seq->private = NULL;
return seq_release(inode, file);
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment