Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
fc3437fa
Commit
fc3437fa
authored
Apr 02, 2003
by
Randy Dunlap
Committed by
David S. Miller
Apr 02, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[IPV6]: Convert /proc/net/{sockstat6,snmp6} to seq_file.
parent
a802e299
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
67 additions
and
30 deletions
+67
-30
net/ipv6/af_inet6.c
net/ipv6/af_inet6.c
+9
-9
net/ipv6/proc.c
net/ipv6/proc.c
+58
-21
No files found.
net/ipv6/af_inet6.c
View file @
fc3437fa
...
...
@@ -702,7 +702,9 @@ static void cleanup_ipv6_mibs(void)
kfree_percpu
(
udp_stats_in6
[
0
]);
kfree_percpu
(
udp_stats_in6
[
1
]);
}
extern
int
ipv6_misc_proc_init
(
void
);
static
int
__init
inet6_init
(
void
)
{
struct
sk_buff
*
dummy_skb
;
...
...
@@ -786,10 +788,9 @@ static int __init inet6_init(void)
goto
proc_tcp6_fail
;
if
(
!
proc_net_create
(
"udp6"
,
0
,
udp6_get_info
))
goto
proc_udp6_fail
;
if
(
!
proc_net_create
(
"sockstat6"
,
0
,
afinet6_get_info
))
goto
proc_sockstat6_fail
;
if
(
!
proc_net_create
(
"snmp6"
,
0
,
afinet6_get_snmp
))
goto
proc_snmp6_fail
;
if
(
ipv6_misc_proc_init
())
goto
proc_misc6_fail
;
if
(
!
proc_net_create
(
"anycast6"
,
0
,
anycast6_get_info
))
goto
proc_anycast6_fail
;
#endif
...
...
@@ -800,7 +801,7 @@ static int __init inet6_init(void)
addrconf_init
();
sit_init
();
/* Init v6 exten
t
ion headers. */
/* Init v6 exten
s
ion headers. */
ipv6_hopopts_init
();
ipv6_rthdr_init
();
ipv6_frag_init
();
...
...
@@ -815,10 +816,9 @@ static int __init inet6_init(void)
#ifdef CONFIG_PROC_FS
proc_anycast6_fail:
proc_net_remove
(
"anycast6"
);
proc_snmp6_fail:
proc_net_remove
(
"snmp6"
);
proc_net_remove
(
"sockstat6"
);
proc_
sockstat
6_fail:
proc_
misc
6_fail:
proc_net_remove
(
"udp6"
);
proc_udp6_fail:
proc_net_remove
(
"tcp6"
);
...
...
net/ipv6/proc.c
View file @
fc3437fa
...
...
@@ -20,6 +20,8 @@
#include <linux/socket.h>
#include <linux/net.h>
#include <linux/ipv6.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <linux/stddef.h>
#include <net/sock.h>
#include <net/tcp.h>
...
...
@@ -37,22 +39,17 @@ static int fold_prot_inuse(struct proto *proto)
return
res
;
}
int
afinet6_get_info
(
char
*
buffer
,
char
**
start
,
off_t
offset
,
int
length
)
static
int
sockstat6_seq_show
(
struct
seq_file
*
seq
,
void
*
v
)
{
int
len
=
0
;
len
+=
sprintf
(
buffer
+
len
,
"TCP6: inuse %d
\n
"
,
seq_printf
(
seq
,
"TCP6: inuse %d
\n
"
,
fold_prot_inuse
(
&
tcpv6_prot
));
len
+=
sprintf
(
buffer
+
len
,
"UDP6: inuse %d
\n
"
,
seq_printf
(
seq
,
"UDP6: inuse %d
\n
"
,
fold_prot_inuse
(
&
udpv6_prot
));
len
+=
sprintf
(
buffer
+
len
,
"RAW6: inuse %d
\n
"
,
seq_printf
(
seq
,
"RAW6: inuse %d
\n
"
,
fold_prot_inuse
(
&
rawv6_prot
));
len
+=
sprintf
(
buffer
+
len
,
"FRAG6: inuse %d memory %d
\n
"
,
seq_printf
(
seq
,
"FRAG6: inuse %d memory %d
\n
"
,
ip6_frag_nqueues
,
atomic_read
(
&
ip6_frag_mem
));
*
start
=
buffer
+
offset
;
len
-=
offset
;
if
(
len
>
length
)
len
=
length
;
return
len
;
return
0
;
}
...
...
@@ -154,23 +151,63 @@ fold_field(void *mib[], int offt)
return
res
;
}
int
afinet6_get_snmp
(
char
*
buffer
,
char
**
start
,
off_t
offset
,
int
length
)
static
int
snmp6_seq_show
(
struct
seq_file
*
seq
,
void
*
v
)
{
int
len
=
0
;
int
i
;
for
(
i
=
0
;
i
<
sizeof
(
snmp6_list
)
/
sizeof
(
snmp6_list
[
0
]);
i
++
)
len
+=
sprintf
(
buffer
+
len
,
"%-32s
\t
%ld
\n
"
,
snmp6_list
[
i
].
name
,
seq_printf
(
seq
,
"%-32s
\t
%ld
\n
"
,
snmp6_list
[
i
].
name
,
fold_field
(
snmp6_list
[
i
].
mib
,
snmp6_list
[
i
].
offset
));
len
-=
offset
;
return
0
;
}
static
int
sockstat6_seq_open
(
struct
inode
*
inode
,
struct
file
*
file
)
{
return
single_open
(
file
,
sockstat6_seq_show
,
NULL
);
}
static
struct
file_operations
sockstat6_seq_fops
=
{
.
open
=
sockstat6_seq_open
,
.
read
=
seq_read
,
.
llseek
=
seq_lseek
,
.
release
=
single_release
,
};
if
(
len
>
length
)
len
=
length
;
if
(
len
<
0
)
len
=
0
;
static
int
snmp6_seq_open
(
struct
inode
*
inode
,
struct
file
*
file
)
{
return
single_open
(
file
,
snmp6_seq_show
,
NULL
);
}
static
struct
file_operations
snmp6_seq_fops
=
{
.
open
=
snmp6_seq_open
,
.
read
=
seq_read
,
.
llseek
=
seq_lseek
,
.
release
=
single_release
,
};
int
__init
ipv6_misc_proc_init
(
void
)
{
int
rc
=
0
;
struct
proc_dir_entry
*
p
;
*
start
=
buffer
+
offset
;
p
=
create_proc_entry
(
"snmp6"
,
S_IRUGO
,
proc_net
);
if
(
!
p
)
goto
proc_snmp6_fail
;
else
p
->
proc_fops
=
&
snmp6_seq_fops
;
p
=
create_proc_entry
(
"sockstat6"
,
S_IRUGO
,
proc_net
);
if
(
!
p
)
goto
proc_sockstat6_fail
;
else
p
->
proc_fops
=
&
sockstat6_seq_fops
;
out:
return
rc
;
return
len
;
proc_sockstat6_fail:
remove_proc_entry
(
"snmp6"
,
proc_net
);
proc_snmp6_fail:
rc
=
-
ENOMEM
;
goto
out
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment