summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitsuru Chinen <mitch@linux.vnet.ibm.com>2007-04-30 00:48:20 -0700
committerDavid S. Miller <davem@sunset.davemloft.net>2007-04-30 00:58:32 -0700
commit80787ebc2bbd8e675d8b9ff8cfa40f15134feebe (patch)
treed0bf901985fdaa863a1528196d9a9fd94327b7fd
parent5506b54b36f067b9776935085c9f8e607b026b23 (diff)
downloadlinux-3.10-80787ebc2bbd8e675d8b9ff8cfa40f15134feebe.tar.gz
linux-3.10-80787ebc2bbd8e675d8b9ff8cfa40f15134feebe.tar.bz2
linux-3.10-80787ebc2bbd8e675d8b9ff8cfa40f15134feebe.zip
[IPV4] SNMP: Support OutMcastPkts and OutBcastPkts
A transmitted IP multicast datagram should be counted as OutMcastPkts. By the same token, a transmitted IP broadcast datagram should be counted as OutBcastPkts. Signed-off-by: Mitsuru Chinen <mitch@linux.vnet.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/ipv4/ip_output.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index 534650cad3a..d6427d91851 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -160,9 +160,15 @@ EXPORT_SYMBOL_GPL(ip_build_and_send_pkt);
static inline int ip_finish_output2(struct sk_buff *skb)
{
struct dst_entry *dst = skb->dst;
+ struct rtable *rt = (struct rtable *)dst;
struct net_device *dev = dst->dev;
int hh_len = LL_RESERVED_SPACE(dev);
+ if (rt->rt_type == RTN_MULTICAST)
+ IP_INC_STATS(IPSTATS_MIB_OUTMCASTPKTS);
+ else if (rt->rt_type == RTN_BROADCAST)
+ IP_INC_STATS(IPSTATS_MIB_OUTBCASTPKTS);
+
/* Be paranoid, rather than too clever. */
if (unlikely(skb_headroom(skb) < hh_len && dev->hard_header)) {
struct sk_buff *skb2;