netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: roy.qing.li@gmail.com
To: netdev@vger.kernel.org
Subject: [PATCH][net-next] ipv4: unnecessary to set err on no_route path
Date: Mon, 29 Sep 2014 17:16:38 +0800	[thread overview]
Message-ID: <1411982198-17416-1-git-send-email-roy.qing.li@gmail.com> (raw)

From: Li RongQing <roy.qing.li@gmail.com>

When the code skips to no_route label, it will skip to local_input at last,
then err will be reset on the local_input path before exit function.

Signed-off-by: Li RongQing <roy.qing.li@gmail.com>
---
 net/ipv4/route.c |   11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index d4bd68d..403914b 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -1704,11 +1704,9 @@ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr,
 	fl4.daddr = daddr;
 	fl4.saddr = saddr;
 	err = fib_lookup(net, &fl4, &res);
-	if (err != 0) {
-		if (!IN_DEV_FORWARD(in_dev))
-			err = -EHOSTUNREACH;
+	if (err != 0)
 		goto no_route;
-	}
+
 
 	if (res.type == RTN_BROADCAST)
 		goto brd_input;
@@ -1721,10 +1719,9 @@ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr,
 		goto local_input;
 	}
 
-	if (!IN_DEV_FORWARD(in_dev)) {
-		err = -EHOSTUNREACH;
+	if (!IN_DEV_FORWARD(in_dev))
 		goto no_route;
-	}
+
 	if (res.type != RTN_UNICAST)
 		goto martian_destination;
 
-- 
1.7.10.4

             reply	other threads:[~2014-09-29  9:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-29  9:16 roy.qing.li [this message]
2014-09-29 11:57 ` [PATCH][net-next] ipv4: unnecessary to set err on no_route path Sergei Shtylyov
2014-09-29 19:30 ` Julian Anastasov

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=1411982198-17416-1-git-send-email-roy.qing.li@gmail.com \
    --to=roy.qing.li@gmail.com \
    --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;
as well as URLs for NNTP newsgroup(s).