ipv4: unnecessary to set err on no_route path
Subsystems (3)
PATCH 1/1 ipv4: unnecessary to set err on no_route path
From: Li RongQing <[email protected]>
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.
--- net/ipv4/route.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
net/ipv4/route.c +4 -7
@@ -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;
Signature · 1 line
1.7.10.4
Hello.
Quoted 15 lines · On 9/29/2014 1:16 PM, [email protected] wrote:
From: Li RongQing <[email protected]>
When the code skips to
no_routelabel, it will skip tolocal_inputat last, then err will be reset on thelocal_inputpath before exit function.Signed-off-by Li RongQing <[email protected]>--- net/ipv4/route.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)net/ipv4/route.c +0
-0
net/ipv4/route.c static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr, · line 1709
Quoted 10 lines
net/ipv4/route.c +2
-4@@ -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.
net/ipv4/route.c static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr, · line 1712
Quoted 3 lines
net/ipv4/route.c +0
-0if (res.type ==RTN_BROADCAST ) goto brd_input;
WBR, Sergei
Hello,
Quoted 4 lines · On Mon, 29 Sep 2014, [email protected] wrote:
From: Li RongQing <[email protected]>
When the code skips to
no_routelabel, it will skip tolocal_inputat last, then err will be reset on thelocal_inputpath before exit function.
But local_input saves -err into rth->dst.error,
the places you change provided more-specific error code.
Quoted 38 lines
Signed-off-by Li RongQing <[email protected]>--- net/ipv4/route.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)net/ipv4/route.c +4
-7@@ -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;Signature · 1 line
1.7.10.4
Regards
--
Julian Anastasov <[email protected]>