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
1c7b149b
Commit
1c7b149b
authored
Nov 13, 2002
by
David S. Miller
Browse files
Options
Browse Files
Download
Plain Diff
Merge master.kernel.org:/home/acme/BK/net-2.5
into nuts.ninka.net:/home/davem/src/BK/net-2.5
parents
81b4c8d1
88de51ee
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
286 additions
and
210 deletions
+286
-210
include/linux/udp.h
include/linux/udp.h
+0
-3
include/net/ip_fib.h
include/net/ip_fib.h
+0
-3
include/net/udp.h
include/net/udp.h
+0
-2
net/ipv4/af_inet.c
net/ipv4/af_inet.c
+10
-6
net/ipv4/fib_hash.c
net/ipv4/fib_hash.c
+0
-12
net/ipv4/proc.c
net/ipv4/proc.c
+113
-97
net/ipv4/raw.c
net/ipv4/raw.c
+156
-59
net/ipv4/udp.c
net/ipv4/udp.c
+0
-12
net/socket.c
net/socket.c
+7
-16
No files found.
include/linux/udp.h
View file @
1c7b149b
...
@@ -57,7 +57,4 @@ struct udp_sock {
...
@@ -57,7 +57,4 @@ struct udp_sock {
#define udp_sk(__sk) (&((struct udp_sock *)__sk)->udp)
#define udp_sk(__sk) (&((struct udp_sock *)__sk)->udp)
extern
int
udp_proc_init
(
void
);
extern
void
udp_proc_exit
(
void
);
#endif
/* _LINUX_UDP_H */
#endif
/* _LINUX_UDP_H */
include/net/ip_fib.h
View file @
1c7b149b
...
@@ -276,7 +276,4 @@ static inline void fib_res_put(struct fib_result *res)
...
@@ -276,7 +276,4 @@ static inline void fib_res_put(struct fib_result *res)
#endif
#endif
}
}
extern
int
fib_proc_init
(
void
);
extern
void
fib_proc_exit
(
void
);
#endif
/* _NET_FIB_H */
#endif
/* _NET_FIB_H */
include/net/udp.h
View file @
1c7b149b
...
@@ -76,6 +76,4 @@ extern struct udp_mib udp_statistics[NR_CPUS*2];
...
@@ -76,6 +76,4 @@ extern struct udp_mib udp_statistics[NR_CPUS*2];
#define UDP_INC_STATS_BH(field) SNMP_INC_STATS_BH(udp_statistics, field)
#define UDP_INC_STATS_BH(field) SNMP_INC_STATS_BH(udp_statistics, field)
#define UDP_INC_STATS_USER(field) SNMP_INC_STATS_USER(udp_statistics, field)
#define UDP_INC_STATS_USER(field) SNMP_INC_STATS_USER(udp_statistics, field)
extern
int
udp_proc_init
(
void
);
#endif
/* _UDP_H */
#endif
/* _UDP_H */
net/ipv4/af_inet.c
View file @
1c7b149b
...
@@ -1160,16 +1160,20 @@ module_init(inet_init);
...
@@ -1160,16 +1160,20 @@ module_init(inet_init);
/* ------------------------------------------------------------------------ */
/* ------------------------------------------------------------------------ */
#ifdef CONFIG_PROC_FS
#ifdef CONFIG_PROC_FS
extern
int
fib_proc_init
(
void
);
extern
int
ip_misc_proc_init
(
void
);
extern
void
fib_proc_exit
(
void
);
extern
int
raw_get_info
(
char
*
,
char
**
,
off_t
,
int
);
extern
int
ip_misc_proc_init
(
void
);
extern
int
tcp_get_info
(
char
*
,
char
**
,
off_t
,
int
);
extern
int
raw_proc_init
(
void
);
extern
void
raw_proc_exit
(
void
);
extern
int
tcp_get_info
(
char
*
buffer
,
char
**
start
,
off_t
offset
,
int
length
);
extern
int
udp_proc_init
(
void
);
extern
void
udp_proc_exit
(
void
);
int
__init
ipv4_proc_init
(
void
)
int
__init
ipv4_proc_init
(
void
)
{
{
int
rc
=
0
;
int
rc
=
0
;
if
(
!
proc_net_create
(
"raw"
,
0
,
raw_get_info
))
if
(
raw_proc_init
(
))
goto
out_raw
;
goto
out_raw
;
if
(
!
proc_net_create
(
"tcp"
,
0
,
tcp_get_info
))
if
(
!
proc_net_create
(
"tcp"
,
0
,
tcp_get_info
))
goto
out_tcp
;
goto
out_tcp
;
...
@@ -1188,7 +1192,7 @@ int __init ipv4_proc_init(void)
...
@@ -1188,7 +1192,7 @@ int __init ipv4_proc_init(void)
out_udp:
out_udp:
proc_net_remove
(
"tcp"
);
proc_net_remove
(
"tcp"
);
out_tcp:
out_tcp:
proc_net_remove
(
"raw"
);
raw_proc_exit
(
);
out_raw:
out_raw:
rc
=
-
ENOMEM
;
rc
=
-
ENOMEM
;
goto
out
;
goto
out
;
...
...
net/ipv4/fib_hash.c
View file @
1c7b149b
...
@@ -1092,16 +1092,4 @@ void __init fib_proc_exit(void)
...
@@ -1092,16 +1092,4 @@ void __init fib_proc_exit(void)
{
{
remove_proc_entry
(
"route"
,
proc_net
);
remove_proc_entry
(
"route"
,
proc_net
);
}
}
#else
/* CONFIG_PROC_FS */
int
__init
fib_proc_init
(
void
)
{
return
0
;
}
void
__init
fib_proc_exit
(
void
)
{
return
0
;
}
#endif
/* CONFIG_PROC_FS */
#endif
/* CONFIG_PROC_FS */
net/ipv4/proc.c
View file @
1c7b149b
This diff is collapsed.
Click to expand it.
net/ipv4/raw.c
View file @
1c7b149b
...
@@ -40,31 +40,42 @@
...
@@ -40,31 +40,42 @@
*/
*/
#include <linux/config.h>
#include <linux/config.h>
#include <asm/system.h>
#include <asm/atomic.h>
#include <asm/byteorder.h>
#include <asm/current.h>
#include <asm/uaccess.h>
#include <asm/uaccess.h>
#include <asm/ioctls.h>
#include <asm/ioctls.h>
#include <linux/types.h>
#include <linux/types.h>
#include <linux/sched.h>
#include <linux/stddef.h>
#include <linux/slab.h>
#include <linux/errno.h>
#include <linux/errno.h>
#include <linux/timer.h>
#include <linux/aio.h>
#include <linux/mm.h>
#include <linux/kernel.h>
#include <linux/kernel.h>
#include <linux/fcntl.h>
#include <linux/spinlock.h>
#include <linux/sockios.h>
#include <linux/socket.h>
#include <linux/socket.h>
#include <linux/in.h>
#include <linux/in.h>
#include <linux/inet.h>
#include <linux/netdevice.h>
#include <linux/netdevice.h>
#include <linux/
m
route.h>
#include <linux/
in_
route.h>
#include <
net/tcp
.h>
#include <
linux/route
.h>
#include <
net/protocol
.h>
#include <
linux/tcp
.h>
#include <linux/skbuff.h>
#include <linux/skbuff.h>
#include <net/dst.h>
#include <net/sock.h>
#include <net/sock.h>
#include <linux/gfp.h>
#include <linux/ip.h>
#include <net/ip.h>
#include <net/icmp.h>
#include <net/icmp.h>
#include <net/udp.h>
#include <net/udp.h>
#include <net/raw.h>
#include <net/raw.h>
#include <net/snmp.h>
#include <net/inet_common.h>
#include <net/inet_common.h>
#include <net/checksum.h>
#include <net/checksum.h>
#include <net/xfrm.h>
#include <net/xfrm.h>
#include <linux/rtnetlink.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <linux/netfilter.h>
#include <linux/netfilter_ipv4.h>
#include <linux/netfilter_ipv4.h>
struct
sock
*
raw_v4_htable
[
RAWV4_HTABLE_SIZE
];
struct
sock
*
raw_v4_htable
[
RAWV4_HTABLE_SIZE
];
...
@@ -656,7 +667,95 @@ static int raw_ioctl(struct sock *sk, int cmd, unsigned long arg)
...
@@ -656,7 +667,95 @@ static int raw_ioctl(struct sock *sk, int cmd, unsigned long arg)
}
}
}
}
static
void
get_raw_sock
(
struct
sock
*
sp
,
char
*
tmpbuf
,
int
i
)
struct
proto
raw_prot
=
{
.
name
=
"RAW"
,
.
close
=
raw_close
,
.
connect
=
udp_connect
,
.
disconnect
=
udp_disconnect
,
.
ioctl
=
raw_ioctl
,
.
init
=
raw_init
,
.
setsockopt
=
raw_setsockopt
,
.
getsockopt
=
raw_getsockopt
,
.
sendmsg
=
raw_sendmsg
,
.
recvmsg
=
raw_recvmsg
,
.
bind
=
raw_bind
,
.
backlog_rcv
=
raw_rcv_skb
,
.
hash
=
raw_v4_hash
,
.
unhash
=
raw_v4_unhash
,
};
#ifdef CONFIG_PROC_FS
struct
raw_iter_state
{
int
bucket
;
};
#define raw_seq_private(seq) ((struct raw_iter_state *)&seq->private)
static
struct
sock
*
raw_get_first
(
struct
seq_file
*
seq
)
{
struct
sock
*
sk
=
NULL
;
struct
raw_iter_state
*
state
=
raw_seq_private
(
seq
);
for
(
state
->
bucket
=
0
;
state
->
bucket
<
RAWV4_HTABLE_SIZE
;
++
state
->
bucket
)
{
sk
=
raw_v4_htable
[
state
->
bucket
];
while
(
sk
&&
sk
->
family
!=
PF_INET
)
sk
=
sk
->
next
;
if
(
sk
)
break
;
}
return
sk
;
}
static
struct
sock
*
raw_get_next
(
struct
seq_file
*
seq
,
struct
sock
*
sk
)
{
struct
raw_iter_state
*
state
=
raw_seq_private
(
seq
);
do
{
sk
=
sk
->
next
;
try_again:
}
while
(
sk
&&
sk
->
family
!=
PF_INET
);
if
(
!
sk
&&
++
state
->
bucket
<
RAWV4_HTABLE_SIZE
)
{
sk
=
raw_v4_htable
[
state
->
bucket
];
goto
try_again
;
}
return
sk
;
}
static
struct
sock
*
raw_get_idx
(
struct
seq_file
*
seq
,
loff_t
pos
)
{
struct
sock
*
sk
=
raw_get_first
(
seq
);
if
(
sk
)
while
(
pos
&&
(
sk
=
raw_get_next
(
seq
,
sk
))
!=
NULL
)
--
pos
;
return
pos
?
NULL
:
sk
;
}
static
void
*
raw_seq_start
(
struct
seq_file
*
seq
,
loff_t
*
pos
)
{
read_lock
(
&
raw_v4_lock
);
return
*
pos
?
raw_get_idx
(
seq
,
*
pos
)
:
(
void
*
)
1
;
}
static
void
*
raw_seq_next
(
struct
seq_file
*
seq
,
void
*
v
,
loff_t
*
pos
)
{
struct
sock
*
sk
;
if
(
v
==
(
void
*
)
1
)
sk
=
raw_get_first
(
seq
);
else
sk
=
raw_get_next
(
seq
,
v
);
++*
pos
;
return
sk
;
}
static
void
raw_seq_stop
(
struct
seq_file
*
seq
,
void
*
v
)
{
read_unlock
(
&
raw_v4_lock
);
}
static
__inline__
char
*
get_raw_sock
(
struct
sock
*
sp
,
char
*
tmpbuf
,
int
i
)
{
{
struct
inet_opt
*
inet
=
inet_sk
(
sp
);
struct
inet_opt
*
inet
=
inet_sk
(
sp
);
unsigned
int
dest
=
inet
->
daddr
,
unsigned
int
dest
=
inet
->
daddr
,
...
@@ -668,65 +767,63 @@ static void get_raw_sock(struct sock *sp, char *tmpbuf, int i)
...
@@ -668,65 +767,63 @@ static void get_raw_sock(struct sock *sp, char *tmpbuf, int i)
" %02X %08X:%08X %02X:%08lX %08X %5d %8d %lu %d %p"
,
" %02X %08X:%08X %02X:%08lX %08X %5d %8d %lu %d %p"
,
i
,
src
,
srcp
,
dest
,
destp
,
sp
->
state
,
i
,
src
,
srcp
,
dest
,
destp
,
sp
->
state
,
atomic_read
(
&
sp
->
wmem_alloc
),
atomic_read
(
&
sp
->
rmem_alloc
),
atomic_read
(
&
sp
->
wmem_alloc
),
atomic_read
(
&
sp
->
rmem_alloc
),
0
,
0L
,
0
,
0
,
0L
,
0
,
sock_i_uid
(
sp
),
0
,
sock_i_ino
(
sp
),
sock_i_uid
(
sp
),
0
,
sock_i_ino
(
sp
),
atomic_read
(
&
sp
->
refcnt
),
sp
);
atomic_read
(
&
sp
->
refcnt
),
sp
);
return
tmpbuf
;
}
}
int
raw_get_info
(
char
*
buffer
,
char
**
start
,
off_t
offset
,
int
length
)
static
int
raw_seq_show
(
struct
seq_file
*
seq
,
void
*
v
)
{
{
int
len
=
0
,
num
=
0
,
i
;
off_t
pos
=
128
;
off_t
begin
;
char
tmpbuf
[
129
];
char
tmpbuf
[
129
];
if
(
offset
<
128
)
if
(
v
==
(
void
*
)
1
)
len
+=
sprintf
(
buffer
,
"%-127s
\n
"
,
seq_printf
(
seq
,
"%-127s
\n
"
,
" sl local_address rem_address st tx_queue "
" sl local_address rem_address st tx_queue "
"rx_queue tr tm->when retrnsmt uid timeout "
"rx_queue tr tm->when retrnsmt uid timeout "
"inode"
);
"inode"
);
read_lock
(
&
raw_v4_lock
);
else
{
for
(
i
=
0
;
i
<
RAWV4_HTABLE_SIZE
;
i
++
)
{
struct
raw_iter_state
*
state
=
raw_seq_private
(
seq
);
struct
sock
*
sk
;
seq_printf
(
seq
,
"%-127s
\n
"
,
for
(
sk
=
raw_v4_htable
[
i
];
sk
;
sk
=
sk
->
next
,
num
++
)
{
get_raw_sock
(
v
,
tmpbuf
,
state
->
bucket
));
if
(
sk
->
family
!=
PF_INET
)
continue
;
pos
+=
128
;
if
(
pos
<=
offset
)
continue
;
get_raw_sock
(
sk
,
tmpbuf
,
i
);
len
+=
sprintf
(
buffer
+
len
,
"%-127s
\n
"
,
tmpbuf
);
if
(
len
>=
length
)
goto
out
;
}
}
}
out:
return
0
;
read_unlock
(
&
raw_v4_lock
);
begin
=
len
-
(
pos
-
offset
);
*
start
=
buffer
+
begin
;
len
-=
begin
;
if
(
len
>
length
)
len
=
length
;
if
(
len
<
0
)
len
=
0
;
return
len
;
}
}
struct
proto
raw_prot
=
{
static
struct
seq_operations
raw_seq_ops
=
{
.
name
=
"RAW"
,
.
start
=
raw_seq_start
,
.
close
=
raw_close
,
.
next
=
raw_seq_next
,
.
connect
=
udp_connect
,
.
stop
=
raw_seq_stop
,
.
disconnect
=
udp_disconnect
,
.
show
=
raw_seq_show
,
.
ioctl
=
raw_ioctl
,
};
.
init
=
raw_init
,
.
setsockopt
=
raw_setsockopt
,
static
int
raw_seq_open
(
struct
inode
*
inode
,
struct
file
*
file
)
.
getsockopt
=
raw_getsockopt
,
{
.
sendmsg
=
raw_sendmsg
,
return
seq_open
(
file
,
&
raw_seq_ops
);
.
recvmsg
=
raw_recvmsg
,
}
.
bind
=
raw_bind
,
.
backlog_rcv
=
raw_rcv_skb
,
static
struct
file_operations
raw_seq_fops
=
{
.
hash
=
raw_v4_hash
,
.
open
=
raw_seq_open
,
.
unhash
=
raw_v4_unhash
,
.
read
=
seq_read
,
.
llseek
=
seq_lseek
,
.
release
=
seq_release
,
};
};
int
__init
raw_proc_init
(
void
)
{
struct
proc_dir_entry
*
p
;
int
rc
=
0
;
p
=
create_proc_entry
(
"raw"
,
S_IRUGO
,
proc_net
);
if
(
p
)
p
->
proc_fops
=
&
raw_seq_fops
;
else
rc
=
-
ENOMEM
;
return
rc
;
}
void
__init
raw_proc_exit
(
void
)
{
remove_proc_entry
(
"raw"
,
proc_net
);
}
#endif
/* CONFIG_PROC_FS */
net/ipv4/udp.c
View file @
1c7b149b
...
@@ -1377,16 +1377,4 @@ void __init udp_proc_exit(void)
...
@@ -1377,16 +1377,4 @@ void __init udp_proc_exit(void)
{
{
remove_proc_entry
(
"udp"
,
proc_net
);
remove_proc_entry
(
"udp"
,
proc_net
);
}
}
#else
/* CONFIG_PROC_FS */
int
__init
udp_proc_init
(
void
)
{
return
0
;
}
void
__init
udp_proc_exit
(
void
)
{
return
0
;
}
#endif
/* CONFIG_PROC_FS */
#endif
/* CONFIG_PROC_FS */
net/socket.c
View file @
1c7b149b
...
@@ -66,6 +66,7 @@
...
@@ -66,6 +66,7 @@
#include <linux/interrupt.h>
#include <linux/interrupt.h>
#include <linux/netdevice.h>
#include <linux/netdevice.h>
#include <linux/proc_fs.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <linux/wanrouter.h>
#include <linux/wanrouter.h>
#include <linux/netlink.h>
#include <linux/netlink.h>
#include <linux/rtnetlink.h>
#include <linux/rtnetlink.h>
...
@@ -1839,29 +1840,19 @@ void __init sock_init(void)
...
@@ -1839,29 +1840,19 @@ void __init sock_init(void)
#endif
#endif
}
}
int
socket_get_info
(
char
*
buffer
,
char
**
start
,
off_t
offset
,
int
length
)
#ifdef CONFIG_PROC_FS
void
socket_seq_show
(
struct
seq_file
*
seq
)
{
{
int
len
,
cpu
;
int
cpu
;
int
counter
=
0
;
int
counter
=
0
;
for
(
cpu
=
0
;
cpu
<
NR_CPUS
;
cpu
++
)
for
(
cpu
=
0
;
cpu
<
NR_CPUS
;
cpu
++
)
counter
+=
sockets_in_use
[
cpu
].
counter
;
counter
+=
sockets_in_use
[
cpu
].
counter
;
/* It can be negative, by the way. 8) */
/* It can be negative, by the way. 8) */
if
(
counter
<
0
)
if
(
counter
<
0
)
counter
=
0
;
counter
=
0
;
len
=
sprintf
(
buffer
,
"sockets: used %d
\n
"
,
counter
);
seq_printf
(
seq
,
"sockets: used %d
\n
"
,
counter
);
if
(
offset
>=
len
)
{
*
start
=
buffer
;
return
0
;
}
*
start
=
buffer
+
offset
;
len
-=
offset
;
if
(
len
>
length
)
len
=
length
;
if
(
len
<
0
)
len
=
0
;
return
len
;
}
}
#endif
/* CONFIG_PROC_FS */
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