Skip to contentSkip to conversation

ipv6: remove the unnecessary statement in find_match()

PATCH Applied Duan Jiong 3 participants 10 messages Oct 30, 2013 – Nov 1, 2013

Subsystems (3)
lore
Share & tools
lore

Duan Jiong

author
#0 lore raw

PATCH 1/1 ipv6: remove the unnecessary statement in find_match()

After reading the function rt6_check_neigh(), we can know that the RT6_NUD_FAIL_SOFT can be returned only when the IS_ENABLE(CONFIG_IPV6_ROUTER_PREF) is false. so in function find_match(), there is no need to execute the statement !IS_ENABLED(CONFIG_IPV6_ROUTER_PREF).

---
 net/ipv6/route.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv6/route.c +1 -1
index f54e3a1..708685f 100644
@@ -619,7 +619,7 @@ static struct rt6_info *find_match(struct rt6_info *rt, int oif, int strict,
 		goto out;
 
 	m = rt6_score_route(rt, oif, strict);
-	if (m == RT6_NUD_FAIL_SOFT && !IS_ENABLED(CONFIG_IPV6_ROUTER_PREF)) {
+	if (m == RT6_NUD_FAIL_SOFT) {
 		match_do_rr = true;
 		m = 0; /* lowest valid score */
 	} else if (m < 0) {
Signature · 1 line
1.8.3.1
Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Duan Jiong

After reading the function rt6_check_neigh(), we can know that the RT6_NUD_FAIL_SOFT can be returned only when the IS_ENABLE(CONFIG_IPV6_ROUTER_PREF) is false. so in function find_match(), there is no need to execute the statement !IS_ENABLED(CONFIG_IPV6_ROUTER_PREF).

It should be constant folded away. But I agree, we can remove this:

Thanks,

Hannes

maintainer Applied
#2 lore raw
In reply to Duan Jiong

From: Duan Jiong <[email protected]>
Date: Wed, 30 Oct 2013 15:39:26 +0800

Quoted 8 lines

After reading the function rt6_check_neigh(), we can know that the RT6_NUD_FAIL_SOFT can be returned only when the IS_ENABLE(CONFIG_IPV6_ROUTER_PREF) is false. so in function find_match(), there is no need to execute the statement !IS_ENABLED(CONFIG_IPV6_ROUTER_PREF).

Applied to net-next, thanks.

CONFIG_IPV6_ROUTER_PREF is another good candidate for Kconfig removal. I know we've had several bugs that only apply when this option is on vs. off. We're maintaining two different code paths, for really no good reason.

#3 lore raw
Quoted 10 lines · David Miller

From: Duan Jiong <[email protected]>
Date: Wed, 30 Oct 2013 15:39:26 +0800

Quoted 7 lines

After reading the function rt6_check_neigh(), we can know that the RT6_NUD_FAIL_SOFT can be returned only when the IS_ENABLE(CONFIG_IPV6_ROUTER_PREF) is false. so in function find_match(), there is no need to execute the statement !IS_ENABLED(CONFIG_IPV6_ROUTER_PREF).

Quoted 8 lines
Quoted 1 line

Applied to net-next, thanks.

CONFIG_IPV6_ROUTER_PREF is another good candidate for Kconfig removal. I know we've had several bugs that only apply when this option is on vs. off. We're maintaining two different code paths, for really no good reason.

I agree and actually thought about that yesterday. Do you think a sysctl is a good option?

maintainer
#4 lore raw

From: Hannes Frederic Sowa <[email protected]>
Date: Wed, 30 Oct 2013 22:11:57 +0100

Quoted 15 lines · David Miller
Quoted 14 lines

From: Duan Jiong <[email protected]>
Date: Wed, 30 Oct 2013 15:39:26 +0800

Quoted 8 lines

After reading the function rt6_check_neigh(), we can know that the RT6_NUD_FAIL_SOFT can be returned only when the IS_ENABLE(CONFIG_IPV6_ROUTER_PREF) is false. so in function find_match(), there is no need to execute the statement !IS_ENABLED(CONFIG_IPV6_ROUTER_PREF).

Applied to net-next, thanks.

Quoted 7 lines
Quoted 4 lines

CONFIG_IPV6_ROUTER_PREF is another good candidate for Kconfig removal. I know we've had several bugs that only apply when this option is on vs. off. We're maintaining two different code paths, for really no good reason.

I agree and actually thought about that yesterday. Do you think a sysctl is a good option?

Every distribution ships with the Kconfig option on, and no sysctl exists currently to control it.

So I'd say it's not necessary at all, or at the very least let's have someone come forward with a real rather than theoretical use case for such a feature before adding it.

Actually, if RFC 4191 has the usual language like "there SHOULD be an administrative mechanism to disable blah blah blah" I could be convinced to add it now. Can someone take a look?

Either way it'd probably be a per-inet6_dev option, right?

author
#5 lore raw
Quoted 29 lines · David Miller

From: Hannes Frederic Sowa <[email protected]>
Date: Wed, 30 Oct 2013 22:11:57 +0100

Quoted 15 lines · David Miller
Quoted 14 lines

From: Duan Jiong <[email protected]>
Date: Wed, 30 Oct 2013 15:39:26 +0800

Quoted 8 lines

After reading the function rt6_check_neigh(), we can know that the RT6_NUD_FAIL_SOFT can be returned only when the IS_ENABLE(CONFIG_IPV6_ROUTER_PREF) is false. so in function find_match(), there is no need to execute the statement !IS_ENABLED(CONFIG_IPV6_ROUTER_PREF).

Applied to net-next, thanks.

Quoted 7 lines
Quoted 4 lines

CONFIG_IPV6_ROUTER_PREF is another good candidate for Kconfig removal. I know we've had several bugs that only apply when this option is on vs. off. We're maintaining two different code paths, for really no good reason.

I agree and actually thought about that yesterday. Do you think a sysctl is a good option?

Every distribution ships with the Kconfig option on, and no sysctl exists currently to control it.

Quoted 7 lines

So I'd say it's not necessary at all, or at the very least let's have someone come forward with a real rather than theoretical use case for such a feature before adding it.

Actually, if RFC 4191 has the usual language like "there SHOULD be an administrative mechanism to disable blah blah blah" I could be convinced to add it now. Can someone take a look?

It seems that there is no such an administrative mechanism in RFC 4191.

By the way, if the sysctl is used, we are still maintaining two different code paths, isn't it? so i think David's idea is good.

Thanks,
Duan

Quoted 7 lines

Either way it'd probably be a per-inet6_dev option, right? --
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#6 lore raw
Quoted 34 lines · Duan Jiong
Quoted 33 lines · David Miller

From: Hannes Frederic Sowa <[email protected]>
Date: Wed, 30 Oct 2013 22:11:57 +0100

Quoted 15 lines · David Miller
Quoted 14 lines

From: Duan Jiong <[email protected]>
Date: Wed, 30 Oct 2013 15:39:26 +0800

Quoted 8 lines

After reading the function rt6_check_neigh(), we can know that the RT6_NUD_FAIL_SOFT can be returned only when the IS_ENABLE(CONFIG_IPV6_ROUTER_PREF) is false. so in function find_match(), there is no need to execute the statement !IS_ENABLED(CONFIG_IPV6_ROUTER_PREF).

Applied to net-next, thanks.

Quoted 7 lines
Quoted 4 lines

CONFIG_IPV6_ROUTER_PREF is another good candidate for Kconfig removal. I know we've had several bugs that only apply when this option is on vs. off. We're maintaining two different code paths, for really no good reason.

I agree and actually thought about that yesterday. Do you think a sysctl is a good option?

Every distribution ships with the Kconfig option on, and no sysctl exists currently to control it.

So I'd say it's not necessary at all, or at the very least let's have someone come forward with a real rather than theoretical use case for such a feature before adding it.

Quoted 8 lines
Quoted 3 lines

Actually, if RFC 4191 has the usual language like "there SHOULD be an administrative mechanism to disable blah blah blah" I could be convinced to add it now. Can someone take a look?

It seems that there is no such an administrative mechanism in RFC 4191.

By the way, if the sysctl is used, we are still maintaining two different code paths, isn't it? so i think David's idea is good.

Makes life easier, no objections from me.

Greetings,

Hannes

author
#7 lore raw
Quoted 39 lines · Hannes Frederic Sowa
Quoted 38 lines · Duan Jiong
Quoted 36 lines · David Miller

From: Hannes Frederic Sowa <[email protected]>
Date: Wed, 30 Oct 2013 22:11:57 +0100

Quoted 15 lines · David Miller
Quoted 14 lines

From: Duan Jiong <[email protected]>
Date: Wed, 30 Oct 2013 15:39:26 +0800

Quoted 8 lines

After reading the function rt6_check_neigh(), we can know that the RT6_NUD_FAIL_SOFT can be returned only when the IS_ENABLE(CONFIG_IPV6_ROUTER_PREF) is false. so in function find_match(), there is no need to execute the statement !IS_ENABLED(CONFIG_IPV6_ROUTER_PREF).

Applied to net-next, thanks.

Quoted 7 lines
Quoted 4 lines

CONFIG_IPV6_ROUTER_PREF is another good candidate for Kconfig removal. I know we've had several bugs that only apply when this option is on vs. off. We're maintaining two different code paths, for really no good reason.

I agree and actually thought about that yesterday. Do you think a sysctl is a good option?

Every distribution ships with the Kconfig option on, and no sysctl exists currently to control it.

So I'd say it's not necessary at all, or at the very least let's have someone come forward with a real rather than theoretical use case for such a feature before adding it.

Actually, if RFC 4191 has the usual language like "there SHOULD be an administrative mechanism to disable blah blah blah" I could be convinced to add it now. Can someone take a look?

Quoted 7 lines
Quoted 4 lines

It seems that there is no such an administrative mechanism in RFC 4191.

By the way, if the sysctl is used, we are still maintaining two different code paths, isn't it? so i think David's idea is good.

Makes life easier, no objections from me.

Removing CONFIG_IPV6_ROUTER_PREF means that the Router Preference is always on, is this understanding right?

If that's is correct, i think compatibility issues will arise. For example, when the CONFIG_IPV6_ROUTER_PREF option is on, the kernel should not do round-robin during default router selection, but when the CONFIG_IPV6_ROUTER_PREF option is off, the kernel should do it.

Thanks,
Duan

Quoted 9 lines

Greetings,

Hannes

--
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#8 lore raw
Quoted 42 lines · Duan Jiong
Quoted 41 lines · Hannes Frederic Sowa
Quoted 40 lines · Duan Jiong
Quoted 29 lines · David Miller

From: Hannes Frederic Sowa <[email protected]>
Date: Wed, 30 Oct 2013 22:11:57 +0100

Quoted 15 lines · David Miller
Quoted 14 lines

From: Duan Jiong <[email protected]>
Date: Wed, 30 Oct 2013 15:39:26 +0800

Quoted 8 lines

After reading the function rt6_check_neigh(), we can know that the RT6_NUD_FAIL_SOFT can be returned only when the IS_ENABLE(CONFIG_IPV6_ROUTER_PREF) is false. so in function find_match(), there is no need to execute the statement !IS_ENABLED(CONFIG_IPV6_ROUTER_PREF).

Applied to net-next, thanks.

Quoted 7 lines
Quoted 4 lines

CONFIG_IPV6_ROUTER_PREF is another good candidate for Kconfig removal. I know we've had several bugs that only apply when this option is on vs. off. We're maintaining two different code paths, for really no good reason.

I agree and actually thought about that yesterday. Do you think a sysctl is a good option?

Every distribution ships with the Kconfig option on, and no sysctl exists currently to control it.

Quoted 7 lines

So I'd say it's not necessary at all, or at the very least let's have someone come forward with a real rather than theoretical use case for such a feature before adding it.

Actually, if RFC 4191 has the usual language like "there SHOULD be an administrative mechanism to disable blah blah blah" I could be convinced to add it now. Can someone take a look?

It seems that there is no such an administrative mechanism in RFC 4191.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

By the way, if the sysctl is used, we are still maintaining two different code paths, isn't it? so i think David's idea is good.

Makes life easier, no objections from me.

Removing CONFIG_IPV6_ROUTER_PREF means that the Router Preference is always on, is this understanding right?

If we drop support for one of the routing scoring algorithms it will be the other one. So yes, it will always be on.

Quoted 4 lines

If that's is correct, i think compatibility issues will arise. For example, when the CONFIG_IPV6_ROUTER_PREF option is on, the kernel should not do round-robin during default router selection, but when the CONFIG_IPV6_ROUTER_PREF option is off, the kernel should do it.

Exactly, but all people use ROUTER_PREF activated given it is enabled by default by most distributions. I also know about no best practices or IX-policies where they want a router to deliberately turned router preference support off.

We can talk about doing RR in the same preference level, I'll have to do more research on this.

But given that someone wants RR, it is better done by using ECMP routes.

maintainer
#9 lore raw
In reply to Duan Jiong

From: Duan Jiong <[email protected]>
Date: Thu, 31 Oct 2013 19:09:56 +0800

Quoted 7 lines

Removing CONFIG_IPV6_ROUTER_PREF means that the Router Preference is always on, is this understanding right?

If that's is correct, i think compatibility issues will arise. For example, when the CONFIG_IPV6_ROUTER_PREF option is on, the kernel should not do round-robin during default router selection, but when the CONFIG_IPV6_ROUTER_PREF option is off, the kernel should do it.

Everyone is essentially getting it enabled right now anyways, since %99.999999 of users run distribution kernels. Nobody has asked for a run-time knob for this, which therefore means that %99.999999 of users simply do not care.

Yes there are people who build their own kernels, but to tell you the truth I doubt anyone really turns this off explicitly to turn off router preference handling.

But I'm willing to cater to them _iff_ the RFC tells us we should provide should a capability.