Skip to content

Commit

Permalink
[IPV4] SNMP: Support InMcastPkts and InBcastPkts
Browse files Browse the repository at this point in the history
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: Mitsuru Chinen <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Mitsuru Chinen authored and David S. Miller committed Apr 30, 2007
1 parent 704aed5 commit 5506b54
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions net/ipv4/ip_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ static inline int ip_rcv_options(struct sk_buff *skb)
static inline int ip_rcv_finish(struct sk_buff *skb)
{
const struct iphdr *iph = ip_hdr(skb);
struct rtable *rt;

/*
* Initialise the virtual path cache for the packet. It describes
Expand Down Expand Up @@ -360,6 +361,12 @@ static inline int ip_rcv_finish(struct sk_buff *skb)
if (iph->ihl > 5 && ip_rcv_options(skb))
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);

drop:
Expand Down

0 comments on commit 5506b54

Please sign in to comment.