netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][net-next] ipv4: unnecessary to set err on no_route path
@ 2014-09-29  9:16 roy.qing.li
  2014-09-29 11:57 ` Sergei Shtylyov
  2014-09-29 19:30 ` Julian Anastasov
  0 siblings, 2 replies; 3+ messages in thread
From: roy.qing.li @ 2014-09-29  9:16 UTC (permalink / raw)
  To: netdev

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH][net-next] ipv4: unnecessary to set err on no_route path
  2014-09-29  9:16 [PATCH][net-next] ipv4: unnecessary to set err on no_route path roy.qing.li
@ 2014-09-29 11:57 ` Sergei Shtylyov
  2014-09-29 19:30 ` Julian Anastasov
  1 sibling, 0 replies; 3+ messages in thread
From: Sergei Shtylyov @ 2014-09-29 11:57 UTC (permalink / raw)
  To: roy.qing.li, netdev

Hello.

On 9/29/2014 1:16 PM, roy.qing.li@gmail.com wrote:

> 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;
> -	}
> +

    This extra empty line is not needed.

>
>   	if (res.type == RTN_BROADCAST)
>   		goto brd_input;

WBR, Sergei

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH][net-next] ipv4: unnecessary to set err on no_route path
  2014-09-29  9:16 [PATCH][net-next] ipv4: unnecessary to set err on no_route path roy.qing.li
  2014-09-29 11:57 ` Sergei Shtylyov
@ 2014-09-29 19:30 ` Julian Anastasov
  1 sibling, 0 replies; 3+ messages in thread
From: Julian Anastasov @ 2014-09-29 19:30 UTC (permalink / raw)
  To: roy.qing.li; +Cc: netdev


	Hello,

On Mon, 29 Sep 2014, roy.qing.li@gmail.com wrote:

> 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.

	But local_input saves -err into rth->dst.error,
the places you change provided more-specific error code.

> 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

Regards

--
Julian Anastasov <ja@ssi.bg>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-09-29 19:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-29  9:16 [PATCH][net-next] ipv4: unnecessary to set err on no_route path roy.qing.li
2014-09-29 11:57 ` Sergei Shtylyov
2014-09-29 19:30 ` Julian Anastasov

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).