Commit 5506b54b authored by Mitsuru Chinen's avatar Mitsuru Chinen Committed by David S. Miller

[IPV4] SNMP: Support InMcastPkts and InBcastPkts

A received IP multicast datagram should be counted as InMcastPkts.
By the same token, a received IP broadcast datagram should be
counted as InBcastPkts.
Signed-off-by: default avatarMitsuru Chinen <mitch@linux.vnet.ibm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 704aed53
...@@ -329,6 +329,7 @@ static inline int ip_rcv_options(struct sk_buff *skb) ...@@ -329,6 +329,7 @@ static inline int ip_rcv_options(struct sk_buff *skb)
static inline int ip_rcv_finish(struct sk_buff *skb) static inline int ip_rcv_finish(struct sk_buff *skb)
{ {
const struct iphdr *iph = ip_hdr(skb); const struct iphdr *iph = ip_hdr(skb);
struct rtable *rt;
/* /*
* Initialise the virtual path cache for the packet. It describes * Initialise the virtual path cache for the packet. It describes
...@@ -360,6 +361,12 @@ static inline int ip_rcv_finish(struct sk_buff *skb) ...@@ -360,6 +361,12 @@ static inline int ip_rcv_finish(struct sk_buff *skb)
if (iph->ihl > 5 && ip_rcv_options(skb)) if (iph->ihl > 5 && ip_rcv_options(skb))
goto drop; goto drop;
rt = (struct rtable*)skb->dst;
if (rt->rt_type == RTN_MULTICAST)
IP_INC_STATS_BH(IPSTATS_MIB_INMCASTPKTS);
else if (rt->rt_type == RTN_BROADCAST)
IP_INC_STATS_BH(IPSTATS_MIB_INBCASTPKTS);
return dst_input(skb); return dst_input(skb);
drop: drop:
......
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