Skip to contentSkip to conversation

iproute: fix filter_nlmsg

PATCH In review Phil Sutter 2 participants 5 messages Oct 29, 2015 – Nov 24, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iproute: fix filter_nlmsg

This patch is based upon an old Fedora bug[1] regarding the routing setup of PPP links. I'm not quite sure if it still applies today or how to trigger it, but looking at the change introducing this, it's obviously a bug.

[1] https://bugzilla.redhat.com/show_bug.cgi?id=622782

Fixes 4479282 ("iproute2: filter routing entries based on clone flag")
---
 ip/iproute.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
ip/iproute.c +1 -1
index eab512d..ea7e9aa 100644
@@ -151,7 +151,7 @@ static int filter_nlmsg(struct nlmsghdr *n, struct rtattr **tb, int host_len)
 	if (r->rtm_family == AF_INET6 && table != RT_TABLE_MAIN)
 		ip6_multiple_tables = 1;
 
-	if (filter.cloned == !(r->rtm_flags&RTM_F_CLONED))
+	if (filter.cloned && !(r->rtm_flags&RTM_F_CLONED))
 		return 0;
 
 	if (r->rtm_family == AF_INET6 && !ip6_multiple_tables) {
Signature · 1 line
2.1.2
#1 lore raw
Quoted 18 lines · On Thu, 29 Oct 2015 12:15:47 +0100 Phil Sutter <[email protected]> wrote:

This patch is based upon an old Fedora bug[1] regarding the routing setup of PPP links. I'm not quite sure if it still applies today or how to trigger it, but looking at the change introducing this, it's obviously a bug.

[1] https://bugzilla.redhat.com/show_bug.cgi?id=622782

Fixes 4479282 ("iproute2: filter routing entries based on clone flag")
---
 ip/iproute.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
ip/iproute.c +0 -0
index eab512d..ea7e9aa 100644

ip/iproute.c static int filter_nlmsg(struct nlmsghdr *n, struct rtattr **tb, int host_len) · line 157

Quoted 8 lines
ip/iproute.c +1 -1
@@ -151,7 +151,7 @@ static int filter_nlmsg(struct nlmsghdr *n, struct rtattr **tb, int host_len)
 	if (r->rtm_family == AF_INET6 && table != RT_TABLE_MAIN)
 		ip6_multiple_tables = 1;
 
-	if (filter.cloned == !(r->rtm_flags&RTM_F_CLONED))
+	if (filter.cloned && !(r->rtm_flags&RTM_F_CLONED))
 		return 0;
 
 	if (r->rtm_family == AF_INET6 && !ip6_multiple_tables) {

Holding off on this, until there is an obvious reproduction.
The patch looks right but this code has been around a long time and don't want any surprised users.

#2 lore raw
Quoted 28 lines · Stephen Hemminger
Quoted 25 lines · On Thu, 29 Oct 2015 12:15:47 +0100 Phil Sutter <[email protected]> wrote:

This patch is based upon an old Fedora bug[1] regarding the routing setup of PPP links. I'm not quite sure if it still applies today or how to trigger it, but looking at the change introducing this, it's obviously a bug.

[1] https://bugzilla.redhat.com/show_bug.cgi?id=622782

Fixes 4479282 ("iproute2: filter routing entries based on clone flag")
---
 ip/iproute.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
ip/iproute.c +1 -1
index eab512d..ea7e9aa 100644
@@ -151,7 +151,7 @@ static int filter_nlmsg(struct nlmsghdr *n, struct rtattr **tb, int host_len)
 	if (r->rtm_family == AF_INET6 && table != RT_TABLE_MAIN)
 		ip6_multiple_tables = 1;
 
-	if (filter.cloned == !(r->rtm_flags&RTM_F_CLONED))
+	if (filter.cloned && !(r->rtm_flags&RTM_F_CLONED))
 		return 0;
 
Quoted 5 lines

ip/iproute.c static int filter_nlmsg(struct nlmsghdr *n, struct rtattr **tb, int host_len) · line 157

Quoted 1 line
ip/iproute.c +0 -0
 	if (r->rtm_family == AF_INET6 && !ip6_multiple_tables) {

Holding off on this, until there is an obvious reproduction.
The patch looks right but this code has been around a long time and don't want any surprised users.

Looking more into this, I found commit c73f3e0 ("iproute2: dont filter cached routes on iproute_get") which bases explicitly on the behaviour as we have now (comparison instead of boolean AND).

The above change at least affects showing routes for IPv6. With it applied, 'ip r s' prints the routing cache along with normal routing table entries, without it one has to explicitly ask for cached entries in order for them to show up ('ip r s cached'). What do you think which is the correct behaviour?

Thanks, Phil

#3 lore raw
Quoted 39 lines · On Wed, 4 Nov 2015 16:54:24 +0100 Phil Sutter <[email protected]> wrote:
Quoted 28 lines · Stephen Hemminger
Quoted 25 lines · On Thu, 29 Oct 2015 12:15:47 +0100 Phil Sutter <[email protected]> wrote:

This patch is based upon an old Fedora bug[1] regarding the routing setup of PPP links. I'm not quite sure if it still applies today or how to trigger it, but looking at the change introducing this, it's obviously a bug.

[1] https://bugzilla.redhat.com/show_bug.cgi?id=622782

Fixes 4479282 ("iproute2: filter routing entries based on clone flag")
---
 ip/iproute.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
ip/iproute.c +1 -1
index eab512d..ea7e9aa 100644
@@ -151,7 +151,7 @@ static int filter_nlmsg(struct nlmsghdr *n, struct rtattr **tb, int host_len)
 	if (r->rtm_family == AF_INET6 && table != RT_TABLE_MAIN)
 		ip6_multiple_tables = 1;
 
-	if (filter.cloned == !(r->rtm_flags&RTM_F_CLONED))
+	if (filter.cloned && !(r->rtm_flags&RTM_F_CLONED))
 		return 0;
 
Quoted 5 lines

ip/iproute.c static int filter_nlmsg(struct nlmsghdr *n, struct rtattr **tb, int host_len) · line 157

Quoted 1 line
ip/iproute.c +0 -0
 	if (r->rtm_family == AF_INET6 && !ip6_multiple_tables) {

Holding off on this, until there is an obvious reproduction.
The patch looks right but this code has been around a long time and don't want any surprised users.

Looking more into this, I found commit c73f3e0 ("iproute2: dont filter cached routes on iproute_get") which bases explicitly on the behaviour as we have now (comparison instead of boolean AND).

Quoted 5 lines

The above change at least affects showing routes for IPv6. With it applied, 'ip r s' prints the routing cache along with normal routing table entries, without it one has to explicitly ask for cached entries in order for them to show up ('ip r s cached'). What do you think which is the correct behaviour?

I think changing the default output would confuse users. Better to keep the status quo. Don't know how Fedora deals with the fact they print different result than other distro's, but not my problem.

#4 lore raw
Quoted 48 lines · Stephen Hemminger
Quoted 39 lines · On Wed, 4 Nov 2015 16:54:24 +0100 Phil Sutter <[email protected]> wrote:
Quoted 28 lines · Stephen Hemminger
Quoted 25 lines · On Thu, 29 Oct 2015 12:15:47 +0100 Phil Sutter <[email protected]> wrote:

This patch is based upon an old Fedora bug[1] regarding the routing setup of PPP links. I'm not quite sure if it still applies today or how to trigger it, but looking at the change introducing this, it's obviously a bug.

[1] https://bugzilla.redhat.com/show_bug.cgi?id=622782

Fixes 4479282 ("iproute2: filter routing entries based on clone flag")
---
 ip/iproute.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
ip/iproute.c +1 -1
index eab512d..ea7e9aa 100644
@@ -151,7 +151,7 @@ static int filter_nlmsg(struct nlmsghdr *n, struct rtattr **tb, int host_len)
 	if (r->rtm_family == AF_INET6 && table != RT_TABLE_MAIN)
 		ip6_multiple_tables = 1;
 
-	if (filter.cloned == !(r->rtm_flags&RTM_F_CLONED))
+	if (filter.cloned && !(r->rtm_flags&RTM_F_CLONED))
 		return 0;
 
Quoted 5 lines

ip/iproute.c static int filter_nlmsg(struct nlmsghdr *n, struct rtattr **tb, int host_len) · line 157

Quoted 1 line
ip/iproute.c +0 -0
 	if (r->rtm_family == AF_INET6 && !ip6_multiple_tables) {

Holding off on this, until there is an obvious reproduction.
The patch looks right but this code has been around a long time and don't want any surprised users.

Looking more into this, I found commit c73f3e0 ("iproute2: dont filter cached routes on iproute_get") which bases explicitly on the behaviour as we have now (comparison instead of boolean AND).

Quoted 5 lines

The above change at least affects showing routes for IPv6. With it applied, 'ip r s' prints the routing cache along with normal routing table entries, without it one has to explicitly ask for cached entries in order for them to show up ('ip r s cached'). What do you think which is the correct behaviour?

Quoted 3 lines

I think changing the default output would confuse users. Better to keep the status quo. Don't know how Fedora deals with the fact they print different result than other distro's, but not my problem.

Actually, that patch was already dropped from Fedora23 and onwards anyway. Also, it seems to affect IPv6 only which nobody really seems to use. ;)

Anyways, my assumption of this being "obviously a bug" was clearly wrong and I even couldn't find a reason how the proposed change could fix the reported problem.

Thanks, Phil