public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: David Stevens <dlstevens@us.ibm.com>
Cc: chris2553@googlemail.com, Dave Jones <davej@redhat.com>,
	David Miller <davem@davemloft.net>,
	gpiez@web.de, Julian Anastasov <ja@ssi.bg>,
	netdev@vger.kernel.org, netdev-owner@vger.kernel.org
Subject: Re: [PATCH] udp: increment UDP_MIB_NOPORTS in mcast receive
Date: Wed, 03 Oct 2012 17:29:13 +0200	[thread overview]
Message-ID: <1349278153.12401.2811.camel@edumazet-glaptop> (raw)
In-Reply-To: <OF8CC7A8E7.DA3B059E-ON85257A8C.004C258C-85257A8C.004DCE49@us.ibm.com>

On Wed, 2012-10-03 at 10:09 -0400, David Stevens wrote:
> Eric Dumazet <eric.dumazet@gmail.com> wrote on 10/03/2012 09:15:51 AM:
>  
> > So when a host receives an UDP datagram but there was no application
> > at the destination port we should increment udpNoPorts, and its not
> > an error but just a fact.
> 
>         Of course. I think our difference is on the definition of 
> "receives".

A receive is a packet delivered to this host.
Interface being promiscuous or not doesnt really matter.

> I don't think a packet delivered locally due to promiscuous mode, 
> broadcast
> or an imperfect multicast address filter match is a host UDP datagram 
> receive.
> These packets really shouldn't be delivered to UDP at all; they are not
> addressed to this host (at least the non-broadcast, no-membership ones).

Thats the bug we currently are tracking. If some error is happening and
packet is delivered instead of being forwarded or dropped, we need a
counter being incremented to catch the bug.

>         A unicast UDP packet that doesn't match a local IP address does 
> not
> increment this counter. 

It _does_ increment this counter right now, not sure what you mean.

We currently correctly increment udpNoPorts if we receive an unicast UDP
packet that doesnt find a matching socket (because socket(s) are bound
to specific addresses instead of ANY_ADDR)

This is an extension of the "there was no application at the destination
port" to "there was no application at the destination port and
destination address"

> A promiscuous mode multicast delivery is no 
> different,
> except that the destination alone doesn't tell us if it is for us.
> 
>         I think counting these will primarily lead to administrators 
> seeing
> non-zero drops and wasting their time trying to track them down.

Well, as I said, seeing increments of this counter is perfectly fine and
matches RFC. It permits better diagnostics. Hiding bugs is not very
helpful.

Most of the time I am trying to track a bug in linux network stack, the
very first thing I ask to reporters is to post "netstat -s" before/after
their tests exactly because I want to see _some_ counters be incremented
and catch obvious problems.

And alas, many drops in our stack are not correctly reported because we
forgot to increment a counter at the right place.

I am fine adding a new SNMP McastDrops counter if you feel its better.

# grep Udp: /proc/net/snmp
Udp: InDatagrams NoPorts InErrors OutDatagrams RcvbufErrors SndbufErrors McastDrops
Udp: 11449164 15473 514616 290821178 0 184352 134

"netstat -s -u" would display :

Udp:
    11449164 packets received
    15473 packets to unknown port received.
    514616 packet receive errors
    290821178 packets sent
    SndbufErrors: 184352
    McastDrops: 134


Non official patch since net-next is not open :

 include/linux/snmp.h |    1 +
 net/ipv4/proc.c      |    1 +
 net/ipv4/udp.c       |    2 ++
 net/ipv6/proc.c      |    2 ++
 net/ipv6/udp.c       |    2 ++
 5 files changed, 8 insertions(+)

diff --git a/include/linux/snmp.h b/include/linux/snmp.h
index 00bc189..321d643 100644
--- a/include/linux/snmp.h
+++ b/include/linux/snmp.h
@@ -145,6 +145,7 @@ enum
 	UDP_MIB_OUTDATAGRAMS,			/* OutDatagrams */
 	UDP_MIB_RCVBUFERRORS,			/* RcvbufErrors */
 	UDP_MIB_SNDBUFERRORS,			/* SndbufErrors */
+	UDP_MIB_MCASTDROPS,			/* McastDrops (linux extension) */
 	__UDP_MIB_MAX
 };
 
diff --git a/net/ipv4/proc.c b/net/ipv4/proc.c
index 957acd1..1e932ee 100644
--- a/net/ipv4/proc.c
+++ b/net/ipv4/proc.c
@@ -172,6 +172,7 @@ static const struct snmp_mib snmp4_udp_list[] = {
 	SNMP_MIB_ITEM("OutDatagrams", UDP_MIB_OUTDATAGRAMS),
 	SNMP_MIB_ITEM("RcvbufErrors", UDP_MIB_RCVBUFERRORS),
 	SNMP_MIB_ITEM("SndbufErrors", UDP_MIB_SNDBUFERRORS),
+	SNMP_MIB_ITEM("McastDrops", UDP_MIB_MCASTDROPS),
 	SNMP_MIB_SENTINEL
 };
 
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 2814f66..4e2a4f7 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -1591,6 +1591,8 @@ static int __udp4_lib_mcast_deliver(struct net *net, struct sk_buff *skb,
 			sock_put(stack[i]);
 	} else {
 		kfree_skb(skb);
+		UDP_INC_STATS_BH(net, UDP_MIB_MCASTDROPS,
+				 udptable != &udp_table);
 	}
 	return 0;
 }
diff --git a/net/ipv6/proc.c b/net/ipv6/proc.c
index 745a320..f2c12ea 100644
--- a/net/ipv6/proc.c
+++ b/net/ipv6/proc.c
@@ -129,6 +129,7 @@ static const struct snmp_mib snmp6_udp6_list[] = {
 	SNMP_MIB_ITEM("Udp6OutDatagrams", UDP_MIB_OUTDATAGRAMS),
 	SNMP_MIB_ITEM("Udp6RcvbufErrors", UDP_MIB_RCVBUFERRORS),
 	SNMP_MIB_ITEM("Udp6SndbufErrors", UDP_MIB_SNDBUFERRORS),
+	SNMP_MIB_ITEM("Udp6McastDrops", UDP_MIB_MCASTDROPS),
 	SNMP_MIB_SENTINEL
 };
 
@@ -139,6 +140,7 @@ static const struct snmp_mib snmp6_udplite6_list[] = {
 	SNMP_MIB_ITEM("UdpLite6OutDatagrams", UDP_MIB_OUTDATAGRAMS),
 	SNMP_MIB_ITEM("UdpLite6RcvbufErrors", UDP_MIB_RCVBUFERRORS),
 	SNMP_MIB_ITEM("UdpLite6SndbufErrors", UDP_MIB_SNDBUFERRORS),
+	SNMP_MIB_ITEM("UdpLite6McastDrops", UDP_MIB_MCASTDROPS);
 	SNMP_MIB_SENTINEL
 };
 
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index 07e2bfe..c8caf1b 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -748,6 +748,8 @@ static int __udp6_lib_mcast_deliver(struct net *net, struct sk_buff *skb,
 			sock_put(stack[i]);
 	} else {
 		kfree_skb(skb);
+		UDP6_INC_STATS_BH(net, UDP_MIB_MCASTDROPS,
+				  udptable != &udp_table);
 	}
 	return 0;
 }

  reply	other threads:[~2012-10-03 15:29 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-17 15:44 Possible networking regression in 3.6.0 Chris Clayton
2012-09-18 14:21 ` Chris Clayton
2012-09-18 14:31   ` Chris Clayton
2012-09-18 14:40     ` Eric Dumazet
2012-09-18 15:51       ` Chris Clayton
2012-09-19 15:26       ` Chris Clayton
2012-09-22  6:26         ` Chris Clayton
2012-09-27 11:50           ` Chris Clayton
2012-09-27 12:14             ` Eric Dumazet
2012-09-27 18:05               ` Chris Clayton
2012-09-27 21:03                 ` Eric Dumazet
2012-09-27 21:17                   ` Eric Dumazet
2012-09-28  6:53                     ` David Miller
2012-09-28  9:14                       ` Chris Clayton
2012-09-28  9:22                     ` Chris Clayton
2012-09-28 11:26                       ` Eric Dumazet
2012-09-28 14:28                         ` Chris Clayton
2012-09-30 15:26                         ` Chris Clayton
2012-09-30 19:45                           ` Eric Dumazet
2012-10-01  8:36                             ` Chris Clayton
2012-10-01  9:15                               ` Eric Dumazet
2012-10-01 15:13                                 ` Chris Clayton
2012-10-01 15:31                                   ` Eric Dumazet
2012-10-01 16:19                                     ` Chris Clayton
2012-10-01 16:37                                       ` Eric Dumazet
2012-10-01 18:28                                         ` Chris Clayton
2012-10-01 18:34                                     ` Captain Obvious
2012-10-01 19:21                                       ` Eric Dumazet
2012-10-01 19:55                                         ` Chris Clayton
2012-10-01 19:22                                       ` Chris Clayton
2012-10-01 19:34                                 ` Dave Jones
2012-10-01 20:01                                   ` David Miller
2012-10-01 20:04                                     ` Eric Dumazet
2012-10-02 15:27                                       ` Edivaldo de Araújo Pereira
2012-10-02 15:35                                       ` Eric Dumazet
2012-10-02 15:48                                         ` Eric Dumazet
2012-10-02 15:57                                           ` Dave Jones
2012-10-02 16:06                                             ` Eric Dumazet
2012-10-02 18:25                                           ` David Miller
2012-10-02 21:14                                             ` Alexander Duyck
2012-10-02 21:35                                               ` Eric Dumazet
2012-10-02 23:24                                           ` Julian Anastasov
2012-10-03  3:10                                             ` David Miller
2012-10-03 15:01                                               ` Chris Clayton
2012-10-03 20:57                                               ` Julian Anastasov
2012-10-03  7:28                                             ` [PATCH] udp: increment UDP_MIB_NOPORTS in mcast receive Eric Dumazet
2012-10-03 12:45                                               ` David Stevens
2012-10-03 13:15                                                 ` Eric Dumazet
2012-10-03 14:09                                                   ` David Stevens
2012-10-03 15:29                                                     ` Eric Dumazet [this message]
2012-10-03 17:31                                                       ` David Stevens
2012-10-03 19:30                                                         ` David Miller
2012-10-03 17:39                                                     ` Rick Jones
2012-10-03  2:55                                           ` Possible networking regression in 3.6.0 David Miller
2012-10-04 11:25                                           ` [PATCH] ipv4: add a fib_type to fib_info Eric Dumazet
2012-10-04 13:08                                             ` Chris Clayton
2012-10-04 13:32                                               ` Eric Dumazet
2012-10-04 18:14                                                 ` David Miller
2012-09-18 14:44     ` Possible networking regression in 3.6.0 Chris Clayton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1349278153.12401.2811.camel@edumazet-glaptop \
    --to=eric.dumazet@gmail.com \
    --cc=chris2553@googlemail.com \
    --cc=davej@redhat.com \
    --cc=davem@davemloft.net \
    --cc=dlstevens@us.ibm.com \
    --cc=gpiez@web.de \
    --cc=ja@ssi.bg \
    --cc=netdev-owner@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox