public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: David Miller <davem@davemloft.net>
Cc: cl@linux-foundation.org, netdev@vger.kernel.org, shemminger@vyatta.com
Subject: Re: [PATCH] IP: Increment INADDRERRORS if routing for a packet is not successful
Date: Wed, 02 Jun 2010 19:46:42 +0200	[thread overview]
Message-ID: <1275500802.2519.7.camel@edumazet-laptop> (raw)
In-Reply-To: <20100602.103102.121237521.davem@davemloft.net>

Le mercredi 02 juin 2010 à 10:31 -0700, David Miller a écrit :
> Just in case people are really so clueless as to be unable to figure
> this out:
> 
> echo 1 >/sys/kernel/debug/tracing/events/skb/kfree_skb/enable
> ...do some stuff...
> cat /sys/kernel/debug/tracing/trace
> 
> You can even trace it using 'perf' by passing "skb:kfree_skb"
> as the event specifier.

Thanks !

Here is the patch I cooked to account for RP_FILTER errors in multicast
path.

I will complete it to also do the unicast part before official
submission.

Christoph, the official counter would be IPSTATS_MIB_INNOROUTES

ipSystemStatsInNoRoutes OBJECT-TYPE
    SYNTAX     Counter32
    MAX-ACCESS read-only
    STATUS     current
    DESCRIPTION
           "The number of input IP datagrams discarded because no route
            could be found to transmit them to their destination.



diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index 4f0ed45..f207289 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -284,7 +284,7 @@ int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif,
 	if (no_addr)
 		goto last_resort;
 	if (rpf == 1)
-		goto e_inval;
+		goto e_rpf;
 	fl.oif = dev->ifindex;
 
 	ret = 0;
@@ -299,7 +299,7 @@ int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif,
 
 last_resort:
 	if (rpf)
-		goto e_inval;
+		goto e_rpf;
 	*spec_dst = inet_select_addr(dev, 0, RT_SCOPE_UNIVERSE);
 	*itag = 0;
 	return 0;
@@ -308,6 +308,8 @@ e_inval_res:
 	fib_res_put(&res);
 e_inval:
 	return -EINVAL;
+e_rpf:
+	return -ENETUNREACH;
 }
 
 static inline __be32 sk_extract_addr(struct sockaddr *addr)
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 8495bce..8e9e2f9 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -1851,6 +1851,7 @@ static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr,
 	__be32 spec_dst;
 	struct in_device *in_dev = in_dev_get(dev);
 	u32 itag = 0;
+	int err;
 
 	/* Primary sanity checks. */
 
@@ -1865,10 +1866,12 @@ static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr,
 		if (!ipv4_is_local_multicast(daddr))
 			goto e_inval;
 		spec_dst = inet_select_addr(dev, 0, RT_SCOPE_LINK);
-	} else if (fib_validate_source(saddr, 0, tos, 0,
-					dev, &spec_dst, &itag, 0) < 0)
-		goto e_inval;
-
+	} else {
+		err = fib_validate_source(saddr, 0, tos, 0, dev, &spec_dst,
+					  &itag, 0);
+		if (err < 0)
+			goto e_err;
+	}
 	rth = dst_alloc(&ipv4_dst_ops);
 	if (!rth)
 		goto e_nobufs;
@@ -1922,6 +1925,9 @@ e_nobufs:
 e_inval:
 	in_dev_put(in_dev);
 	return -EINVAL;
+e_err:
+	in_dev_put(in_dev);
+	return err;
 }
 
 



  reply	other threads:[~2010-06-02 17:46 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-01 21:13 [PATCH] IP: Increment INADDRERRORS if routing for a packet is not successful Christoph Lameter
2010-06-01 22:07 ` Eric Dumazet
2010-06-01 22:23   ` David Miller
2010-06-02 15:27   ` Christoph Lameter
2010-06-02 15:29     ` David Miller
2010-06-02 15:32     ` Eric Dumazet
2010-06-02 16:12       ` Christoph Lameter
2010-06-02 16:19         ` David Miller
2010-06-02 16:27           ` Christoph Lameter
2010-06-02 16:33             ` Eric Dumazet
2010-06-02 16:49               ` Christoph Lameter
2010-06-02 17:12                 ` David Miller
2010-06-02 17:19                   ` Eric Dumazet
2010-06-02 17:41                     ` Neil Horman
2010-06-02 17:31                   ` David Miller
2010-06-02 17:46                     ` Eric Dumazet [this message]
2010-06-02 18:01                       ` Christoph Lameter
2010-06-02 18:41                         ` Eric Dumazet
2010-06-02 18:59                           ` Christoph Lameter
2010-06-02 19:25                             ` Eric Dumazet
2010-06-02 20:11                               ` Christoph Lameter
2010-06-02 22:05                                 ` [PATCH net-next-2.6] ipv4: add LINUX_MIB_IPRPFILTER snmp counter Eric Dumazet
2010-06-03 10:19                                   ` David Miller
2010-06-03  3:50                     ` [PATCH] IP: Increment INADDRERRORS if routing for a packet is not successful Bill Fink
2010-06-03  3:54                       ` Eric Dumazet
2010-06-03  4:56                         ` Bill Fink
2010-06-02 16:28         ` Eric Dumazet
2010-06-02 16:35           ` Christoph Lameter

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=1275500802.2519.7.camel@edumazet-laptop \
    --to=eric.dumazet@gmail.com \
    --cc=cl@linux-foundation.org \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=shemminger@vyatta.com \
    /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