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
1db8a26a
Commit
1db8a26a
authored
Jun 02, 2004
by
Hideaki Yoshifuji
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[IPV4] use ip-independent ipstats_mib to store IPv4 statistics.
parent
84a4a805
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
76 additions
and
72 deletions
+76
-72
include/net/ip.h
include/net/ip.h
+1
-1
include/net/snmp.h
include/net/snmp.h
+0
-24
net/ipv4/af_inet.c
net/ipv4/af_inet.c
+2
-2
net/ipv4/ip_forward.c
net/ipv4/ip_forward.c
+1
-1
net/ipv4/ip_fragment.c
net/ipv4/ip_fragment.c
+7
-7
net/ipv4/ip_input.c
net/ipv4/ip_input.c
+9
-9
net/ipv4/ip_output.c
net/ipv4/ip_output.c
+11
-11
net/ipv4/ipmr.c
net/ipv4/ipmr.c
+2
-2
net/ipv4/proc.c
net/ipv4/proc.c
+39
-11
net/ipv4/raw.c
net/ipv4/raw.c
+1
-1
net/ipv4/tcp_ipv4.c
net/ipv4/tcp_ipv4.c
+2
-2
net/sctp/output.c
net/sctp/output.c
+1
-1
No files found.
include/net/ip.h
View file @
1db8a26a
...
...
@@ -150,7 +150,7 @@ struct ipv4_config
};
extern
struct
ipv4_config
ipv4_config
;
DECLARE_SNMP_STAT
(
struct
ip_mib
,
ip_statistics
);
DECLARE_SNMP_STAT
(
struct
ip
stats
_mib
,
ip_statistics
);
#define IP_INC_STATS(field) SNMP_INC_STATS(ip_statistics, field)
#define IP_INC_STATS_BH(field) SNMP_INC_STATS_BH(ip_statistics, field)
#define IP_INC_STATS_USER(field) SNMP_INC_STATS_USER(ip_statistics, field)
...
...
include/net/snmp.h
View file @
1db8a26a
...
...
@@ -60,30 +60,6 @@ struct snmp_item {
* RFC 1213: MIB-II
* RFC 2011 (updates 1213): SNMPv2-MIB-IP
* RFC 2863: Interfaces Group MIB
*/
struct
ip_mib
{
unsigned
long
IpInReceives
;
unsigned
long
IpInHdrErrors
;
unsigned
long
IpInAddrErrors
;
unsigned
long
IpForwDatagrams
;
unsigned
long
IpInUnknownProtos
;
unsigned
long
IpInDiscards
;
unsigned
long
IpInDelivers
;
unsigned
long
IpOutRequests
;
unsigned
long
IpOutDiscards
;
unsigned
long
IpOutNoRoutes
;
unsigned
long
IpReasmTimeout
;
unsigned
long
IpReasmReqds
;
unsigned
long
IpReasmOKs
;
unsigned
long
IpReasmFails
;
unsigned
long
IpFragOKs
;
unsigned
long
IpFragFails
;
unsigned
long
IpFragCreates
;
unsigned
long
__pad
[
0
];
};
/*
* RFC 2465: IPv6 MIB: General Group
* draft-ietf-ipv6-rfc2011-update-10.txt: MIB for IP: IP Statistics Tables
*/
...
...
net/ipv4/af_inet.c
View file @
1db8a26a
...
...
@@ -1066,8 +1066,8 @@ static int __init init_ipv4_mibs(void)
{
net_statistics
[
0
]
=
alloc_percpu
(
struct
linux_mib
);
net_statistics
[
1
]
=
alloc_percpu
(
struct
linux_mib
);
ip_statistics
[
0
]
=
alloc_percpu
(
struct
ip_mib
);
ip_statistics
[
1
]
=
alloc_percpu
(
struct
ip_mib
);
ip_statistics
[
0
]
=
alloc_percpu
(
struct
ip
stats
_mib
);
ip_statistics
[
1
]
=
alloc_percpu
(
struct
ip
stats
_mib
);
icmp_statistics
[
0
]
=
alloc_percpu
(
struct
icmp_mib
);
icmp_statistics
[
1
]
=
alloc_percpu
(
struct
icmp_mib
);
tcp_statistics
[
0
]
=
alloc_percpu
(
struct
tcp_mib
);
...
...
net/ipv4/ip_forward.c
View file @
1db8a26a
...
...
@@ -46,7 +46,7 @@ static inline int ip_forward_finish(struct sk_buff *skb)
{
struct
ip_options
*
opt
=
&
(
IPCB
(
skb
)
->
opt
);
IP_INC_STATS_BH
(
Ip
ForwDatagrams
);
IP_INC_STATS_BH
(
Out
ForwDatagrams
);
if
(
unlikely
(
opt
->
optlen
))
ip_forward_options
(
skb
);
...
...
net/ipv4/ip_fragment.c
View file @
1db8a26a
...
...
@@ -263,7 +263,7 @@ static void ip_evictor(void)
spin_unlock
(
&
qp
->
lock
);
ipq_put
(
qp
);
IP_INC_STATS_BH
(
Ip
ReasmFails
);
IP_INC_STATS_BH
(
ReasmFails
);
}
}
...
...
@@ -281,8 +281,8 @@ static void ip_expire(unsigned long arg)
ipq_kill
(
qp
);
IP_INC_STATS_BH
(
Ip
ReasmTimeout
);
IP_INC_STATS_BH
(
Ip
ReasmFails
);
IP_INC_STATS_BH
(
ReasmTimeout
);
IP_INC_STATS_BH
(
ReasmFails
);
if
((
qp
->
last_in
&
FIRST_IN
)
&&
qp
->
fragments
!=
NULL
)
{
struct
sk_buff
*
head
=
qp
->
fragments
;
...
...
@@ -609,7 +609,7 @@ static struct sk_buff *ip_frag_reasm(struct ipq *qp, struct net_device *dev)
iph
=
head
->
nh
.
iph
;
iph
->
frag_off
=
0
;
iph
->
tot_len
=
htons
(
len
);
IP_INC_STATS_BH
(
Ip
ReasmOKs
);
IP_INC_STATS_BH
(
ReasmOKs
);
qp
->
fragments
=
NULL
;
return
head
;
...
...
@@ -625,7 +625,7 @@ static struct sk_buff *ip_frag_reasm(struct ipq *qp, struct net_device *dev)
"Oversized IP packet from %d.%d.%d.%d.
\n
"
,
NIPQUAD
(
qp
->
saddr
));
out_fail:
IP_INC_STATS_BH
(
Ip
ReasmFails
);
IP_INC_STATS_BH
(
ReasmFails
);
return
NULL
;
}
...
...
@@ -636,7 +636,7 @@ struct sk_buff *ip_defrag(struct sk_buff *skb)
struct
ipq
*
qp
;
struct
net_device
*
dev
;
IP_INC_STATS_BH
(
Ip
ReasmReqds
);
IP_INC_STATS_BH
(
ReasmReqds
);
/* Start by cleaning up the memory. */
if
(
atomic_read
(
&
ip_frag_mem
)
>
sysctl_ipfrag_high_thresh
)
...
...
@@ -661,7 +661,7 @@ struct sk_buff *ip_defrag(struct sk_buff *skb)
return
ret
;
}
IP_INC_STATS_BH
(
Ip
ReasmFails
);
IP_INC_STATS_BH
(
ReasmFails
);
kfree_skb
(
skb
);
return
NULL
;
}
...
...
net/ipv4/ip_input.c
View file @
1db8a26a
...
...
@@ -150,7 +150,7 @@
* SNMP management statistics
*/
DEFINE_SNMP_STAT
(
struct
ip_mib
,
ip_statistics
);
DEFINE_SNMP_STAT
(
struct
ip
stats
_mib
,
ip_statistics
);
/*
* Process Router Attention IP option
...
...
@@ -249,16 +249,16 @@ static inline int ip_local_deliver_finish(struct sk_buff *skb)
protocol
=
-
ret
;
goto
resubmit
;
}
IP_INC_STATS_BH
(
I
pI
nDelivers
);
IP_INC_STATS_BH
(
InDelivers
);
}
else
{
if
(
!
raw_sk
)
{
if
(
xfrm4_policy_check
(
NULL
,
XFRM_POLICY_IN
,
skb
))
{
IP_INC_STATS_BH
(
I
pI
nUnknownProtos
);
IP_INC_STATS_BH
(
InUnknownProtos
);
icmp_send
(
skb
,
ICMP_DEST_UNREACH
,
ICMP_PROT_UNREACH
,
0
);
}
}
else
IP_INC_STATS_BH
(
I
pI
nDelivers
);
IP_INC_STATS_BH
(
InDelivers
);
kfree_skb
(
skb
);
}
}
...
...
@@ -324,7 +324,7 @@ static inline int ip_rcv_finish(struct sk_buff *skb)
*/
if
(
skb_cow
(
skb
,
skb_headroom
(
skb
)))
{
IP_INC_STATS_BH
(
I
pI
nDiscards
);
IP_INC_STATS_BH
(
InDiscards
);
goto
drop
;
}
iph
=
skb
->
nh
.
iph
;
...
...
@@ -353,7 +353,7 @@ static inline int ip_rcv_finish(struct sk_buff *skb)
return
dst_input
(
skb
);
inhdr_error:
IP_INC_STATS_BH
(
I
pI
nHdrErrors
);
IP_INC_STATS_BH
(
InHdrErrors
);
drop:
kfree_skb
(
skb
);
return
NET_RX_DROP
;
...
...
@@ -372,10 +372,10 @@ int ip_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt)
if
(
skb
->
pkt_type
==
PACKET_OTHERHOST
)
goto
drop
;
IP_INC_STATS_BH
(
I
pI
nReceives
);
IP_INC_STATS_BH
(
InReceives
);
if
((
skb
=
skb_share_check
(
skb
,
GFP_ATOMIC
))
==
NULL
)
{
IP_INC_STATS_BH
(
I
pI
nDiscards
);
IP_INC_STATS_BH
(
InDiscards
);
goto
out
;
}
...
...
@@ -426,7 +426,7 @@ int ip_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt)
ip_rcv_finish
);
inhdr_error:
IP_INC_STATS_BH
(
I
pI
nHdrErrors
);
IP_INC_STATS_BH
(
InHdrErrors
);
drop:
kfree_skb
(
skb
);
out:
...
...
net/ipv4/ip_output.c
View file @
1db8a26a
...
...
@@ -232,7 +232,7 @@ int ip_mc_output(struct sk_buff *skb)
/*
* If the indicated interface is up and running, send the packet.
*/
IP_INC_STATS
(
Ip
OutRequests
);
IP_INC_STATS
(
OutRequests
);
skb
->
dev
=
dev
;
skb
->
protocol
=
htons
(
ETH_P_IP
);
...
...
@@ -285,7 +285,7 @@ int ip_mc_output(struct sk_buff *skb)
int
ip_output
(
struct
sk_buff
*
skb
)
{
IP_INC_STATS
(
Ip
OutRequests
);
IP_INC_STATS
(
OutRequests
);
if
((
skb
->
len
>
dst_pmtu
(
skb
->
dst
)
||
skb_shinfo
(
skb
)
->
frag_list
)
&&
!
skb_shinfo
(
skb
)
->
tso_size
)
...
...
@@ -390,7 +390,7 @@ int ip_queue_xmit(struct sk_buff *skb, int ipfragok)
dst_output
);
no_route:
IP_INC_STATS
(
Ip
OutNoRoutes
);
IP_INC_STATS
(
OutNoRoutes
);
kfree_skb
(
skb
);
return
-
EHOSTUNREACH
;
}
...
...
@@ -547,7 +547,7 @@ int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff*))
}
if
(
err
==
0
)
{
IP_INC_STATS
(
Ip
FragOKs
);
IP_INC_STATS
(
FragOKs
);
return
0
;
}
...
...
@@ -556,7 +556,7 @@ int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff*))
kfree_skb
(
frag
);
frag
=
skb
;
}
IP_INC_STATS
(
Ip
FragFails
);
IP_INC_STATS
(
FragFails
);
return
err
;
}
...
...
@@ -662,7 +662,7 @@ int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff*))
* Put this fragment into the sending queue.
*/
IP_INC_STATS
(
Ip
FragCreates
);
IP_INC_STATS
(
FragCreates
);
iph
->
tot_len
=
htons
(
len
+
hlen
);
...
...
@@ -673,12 +673,12 @@ int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff*))
goto
fail
;
}
kfree_skb
(
skb
);
IP_INC_STATS
(
Ip
FragOKs
);
IP_INC_STATS
(
FragOKs
);
return
err
;
fail:
kfree_skb
(
skb
);
IP_INC_STATS
(
Ip
FragFails
);
IP_INC_STATS
(
FragFails
);
return
err
;
}
...
...
@@ -975,7 +975,7 @@ int ip_append_data(struct sock *sk,
error:
inet
->
cork
.
length
-=
length
;
IP_INC_STATS
(
Ip
OutDiscards
);
IP_INC_STATS
(
OutDiscards
);
return
err
;
}
...
...
@@ -1088,7 +1088,7 @@ ssize_t ip_append_page(struct sock *sk, struct page *page,
error:
inet
->
cork
.
length
-=
size
;
IP_INC_STATS
(
Ip
OutDiscards
);
IP_INC_STATS
(
OutDiscards
);
return
err
;
}
...
...
@@ -1198,7 +1198,7 @@ int ip_push_pending_frames(struct sock *sk)
return
err
;
error:
IP_INC_STATS
(
Ip
OutDiscards
);
IP_INC_STATS
(
OutDiscards
);
goto
out
;
}
...
...
net/ipv4/ipmr.c
View file @
1db8a26a
...
...
@@ -1115,7 +1115,7 @@ static inline int ipmr_forward_finish(struct sk_buff *skb)
{
struct
ip_options
*
opt
=
&
(
IPCB
(
skb
)
->
opt
);
IP_INC_STATS_BH
(
Ip
ForwDatagrams
);
IP_INC_STATS_BH
(
Out
ForwDatagrams
);
if
(
unlikely
(
opt
->
optlen
))
ip_forward_options
(
skb
);
...
...
@@ -1178,7 +1178,7 @@ static void ipmr_queue_xmit(struct sk_buff *skb, struct mfc_cache *c, int vifi)
to blackhole.
*/
IP_INC_STATS_BH
(
Ip
FragFails
);
IP_INC_STATS_BH
(
FragFails
);
ip_rt_put
(
rt
);
goto
out_free
;
}
...
...
net/ipv4/proc.c
View file @
1db8a26a
...
...
@@ -88,7 +88,7 @@ static struct file_operations sockstat_seq_fops = {
};
static
unsigned
long
fold_field
(
void
*
mib
[],
int
nr
)
__fold_field
(
void
*
mib
[],
int
offt
)
{
unsigned
long
res
=
0
;
int
i
;
...
...
@@ -98,14 +98,41 @@ fold_field(void *mib[], int nr)
continue
;
res
+=
*
((
unsigned
long
*
)
(((
void
*
)
per_cpu_ptr
(
mib
[
0
],
i
))
+
sizeof
(
unsigned
long
)
*
nr
));
offt
));
res
+=
*
((
unsigned
long
*
)
(((
void
*
)
per_cpu_ptr
(
mib
[
1
],
i
))
+
sizeof
(
unsigned
long
)
*
nr
));
offt
));
}
return
res
;
}
#define fold_field(_mib, _nr) __fold_field(_mib, (sizeof(unsigned long) * (_nr)))
/* snmp items */
static
struct
snmp_item
snmp4_ipstats_list
[]
=
{
#define __SNMP_GEN(x,y) SNMP_ITEM(struct ipstats_mib, x, y)
#define SNMP_GEN(x) __SNMP_GEN(x, #x)
SNMP_GEN
(
InReceives
),
SNMP_GEN
(
InHdrErrors
),
SNMP_GEN
(
InAddrErrors
),
__SNMP_GEN
(
OutForwDatagrams
,
"ForwDatagrams"
),
/* for backward compatibility */
SNMP_GEN
(
InUnknownProtos
),
SNMP_GEN
(
InDiscards
),
SNMP_GEN
(
InDelivers
),
SNMP_GEN
(
OutRequests
),
SNMP_GEN
(
OutDiscards
),
SNMP_GEN
(
OutNoRoutes
),
SNMP_GEN
(
ReasmTimeout
),
SNMP_GEN
(
ReasmReqds
),
SNMP_GEN
(
ReasmOKs
),
SNMP_GEN
(
ReasmFails
),
SNMP_GEN
(
FragOKs
),
SNMP_GEN
(
FragFails
),
SNMP_GEN
(
FragCreates
),
SNMP_ITEM_SENTINEL
#undef SNMP_GEN
};
/*
* Called from the PROCfs module. This outputs /proc/net/snmp.
*/
...
...
@@ -113,17 +140,18 @@ static int snmp_seq_show(struct seq_file *seq, void *v)
{
int
i
;
seq_printf
(
seq
,
"Ip: Forwarding DefaultTTL InReceives InHdrErrors "
"InAddrErrors ForwDatagrams InUnknownProtos "
"InDiscards InDelivers OutRequests OutDiscards "
"OutNoRoutes ReasmTimeout ReasmReqds ReasmOKs "
"ReasmFails FragOKs FragFails FragCreates
\n
Ip: %d %d"
,
seq_printf
(
seq
,
"Ip: Forwarding DefaultTTL"
);
for
(
i
=
0
;
snmp4_ipstats_list
[
i
].
name
!=
NULL
;
i
++
)
seq_printf
(
seq
,
" %s"
,
snmp4_ipstats_list
[
i
].
name
);
seq_printf
(
seq
,
"
\n
Ip: %d %d"
,
ipv4_devconf
.
forwarding
?
1
:
2
,
sysctl_ip_default_ttl
);
for
(
i
=
0
;
i
<
offsetof
(
struct
ip_mib
,
__pad
)
/
sizeof
(
unsigned
long
);
i
++
)
for
(
i
=
0
;
snmp4_ipstats_list
[
i
].
name
!=
NULL
;
i
++
)
seq_printf
(
seq
,
" %lu"
,
fold_field
((
void
**
)
ip_statistics
,
i
));
__fold_field
((
void
**
)
ip_statistics
,
snmp4_ipstats_list
[
i
].
offset
));
seq_printf
(
seq
,
"
\n
Icmp: InMsgs InErrors InDestUnreachs InTimeExcds "
"InParmProbs InSrcQuenchs InRedirects InEchos "
...
...
net/ipv4/raw.c
View file @
1db8a26a
...
...
@@ -319,7 +319,7 @@ static int raw_send_hdrinc(struct sock *sk, void *from, int length,
err
=
-
EFAULT
;
kfree_skb
(
skb
);
error:
IP_INC_STATS
(
Ip
OutDiscards
);
IP_INC_STATS
(
OutDiscards
);
return
err
;
}
...
...
net/ipv4/tcp_ipv4.c
View file @
1db8a26a
...
...
@@ -1290,12 +1290,12 @@ static struct dst_entry* tcp_v4_route_req(struct sock *sk,
.
dport
=
req
->
rmt_port
}
}
};
if
(
ip_route_output_flow
(
&
rt
,
&
fl
,
sk
,
0
))
{
IP_INC_STATS_BH
(
Ip
OutNoRoutes
);
IP_INC_STATS_BH
(
OutNoRoutes
);
return
NULL
;
}
if
(
opt
&&
opt
->
is_strictroute
&&
rt
->
rt_dst
!=
rt
->
rt_gateway
)
{
ip_rt_put
(
rt
);
IP_INC_STATS_BH
(
Ip
OutNoRoutes
);
IP_INC_STATS_BH
(
OutNoRoutes
);
return
NULL
;
}
return
&
rt
->
u
.
dst
;
...
...
net/sctp/output.c
View file @
1db8a26a
...
...
@@ -496,7 +496,7 @@ int sctp_packet_transmit(struct sctp_packet *packet)
return
err
;
no_route:
kfree_skb
(
nskb
);
IP_INC_STATS_BH
(
Ip
OutNoRoutes
);
IP_INC_STATS_BH
(
OutNoRoutes
);
/* FIXME: Returning the 'err' will effect all the associations
* associated with a socket, although only one of the paths of the
...
...
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