From patchwork Wed Jun 2 17:46:42 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 54407 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id C9DEAB7D43 for ; Thu, 3 Jun 2010 03:46:52 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757792Ab0FBRqs (ORCPT ); Wed, 2 Jun 2010 13:46:48 -0400 Received: from mail-ww0-f46.google.com ([74.125.82.46]:38692 "EHLO mail-ww0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753633Ab0FBRqq (ORCPT ); Wed, 2 Jun 2010 13:46:46 -0400 Received: by wwb28 with SMTP id 28so3101509wwb.19 for ; Wed, 02 Jun 2010 10:46:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:subject:from:to:cc :in-reply-to:references:content-type:date:message-id:mime-version :x-mailer:content-transfer-encoding; bh=gEvy7P+IDQdaCqu/kNY9GJQM0KUFkrCyPAWneHVcG5U=; b=gaBcS1q3XDQD6PDcwjceNBY2XBsKT9pU0QO2Z2GjzRxY8i2yCQseRrleb1zofK7NbG GENbfAx/2gXBxxBQwtw8d40TFBXOpYIz/fcDZIyGKf+Y1uErMFaYOwFWtmvm9bEReOwA q6i1ZBMxWofgGngYsXrZmDWW8aBjKDvrpqsJI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=subject:from:to:cc:in-reply-to:references:content-type:date :message-id:mime-version:x-mailer:content-transfer-encoding; b=RWyrlencvlF9U/MiFmCsOUCv5yNWjq+YsnNe6cEb6xJt/f+iiZWDBJGwZCAJKufD6y hHrQEYcOcSo+3t3Bu2VTobsOKFP6hQAC10KfBtZVPs3kelnRDmKHrG8LMSoEbNpoDMCj RSZiDKa4vA0wJApYrQmUjnbI/oLV9vfRgTVbw= Received: by 10.227.156.13 with SMTP id u13mr2821376wbw.184.1275500804426; Wed, 02 Jun 2010 10:46:44 -0700 (PDT) Received: from [127.0.0.1] ([85.17.35.125]) by mx.google.com with ESMTPS id v59sm3546481wec.15.2010.06.02.10.46.43 (version=SSLv3 cipher=RC4-MD5); Wed, 02 Jun 2010 10:46:44 -0700 (PDT) Subject: Re: [PATCH] IP: Increment INADDRERRORS if routing for a packet is not successful From: Eric Dumazet To: David Miller Cc: cl@linux-foundation.org, netdev@vger.kernel.org, shemminger@vyatta.com In-Reply-To: <20100602.103102.121237521.davem@davemloft.net> References: <1275496439.2725.203.camel@edumazet-laptop> <20100602.101258.134121018.davem@davemloft.net> <20100602.103102.121237521.davem@davemloft.net> Date: Wed, 02 Jun 2010 19:46:42 +0200 Message-ID: <1275500802.2519.7.camel@edumazet-laptop> Mime-Version: 1.0 X-Mailer: Evolution 2.28.3 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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. --- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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; }