Latest iproute2 breaks "ip route get" command
Subsystems (2)
Quoted 3 lines
The following logs should explain the problem. In short, the "ip route get" command with iproute2 v. 2.6.35 does not output anything (and exits with a 0). This breaks (for example) vpnc.
Seems to be caused by:
Have no idea if this is the correct fix, but it seemed like a likely typo based on the changes in the above commit and that this brings the output back:
ip/iproute.c +1 -1
@@ -160,7 +160,7 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)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) {
(PS. Sorry for not properly replying in thread, but todays mailing list archives seems to be extremely afraid of exposing any real mail headers making it hard to reply properly without having received the original mail.)
Signature · 1 line
Andreas Henriksson
Yup, that seems to fix it.
You can add my Tested-By in case you need it.
Regards,
Fabio
Quoted 35 lines · Andreas Henriksson
Quoted 3 lines
The following logs should explain the problem. In short, the "ip route get" command with iproute2 v. 2.6.35 does not output anything (and exits with a 0). This breaks (for example) vpnc.
Seems to be caused by:
Have no idea if this is the correct fix, but it seemed like a likely typo based on the changes in the above commit and that this brings the output back:
ip/iproute.c +1
-1@@ -160,7 +160,7 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) 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) {(PS. Sorry for not properly replying in thread, but todays mailing list archives seems to be extremely afraid of exposing any real mail headers making it hard to reply properly without having received the original mail.)
--
Andreas Henriksson
Quoted 2 lines · Fabio Comolli
Yup, that seems to fix it.
You can add my Tested-By in case you need it.
I'll let Ulrich Weber confirm it's the right fix and forward to Stephen Hemminger. Just received an "out of office" notice saying he'll be back 11 august (wednesday), so I guess we'll have to wait a couple of days for that.
//Andreas
Hi Andreas,
your fix will work for IPv4 but will display the IPv6 cached routes again with "ip -6 route show" what I was trying to fix with 447928279c88b6581ae4cdc1b5ac0a9e755aff64
Will send another patch which makes the filter.cloned check not matching for iproute_get routes.
Best regards
Ulrich
Quoted 11 lines · Andreas Henriksson
Quoted 2 lines · Fabio Comolli
Yup, that seems to fix it.
You can add my Tested-By in case you need it.I'll let Ulrich Weber confirm it's the right fix and forward to Stephen Hemminger. Just received an "out of office" notice saying he'll be back 11 august (wednesday), so I guess we'll have to wait a couple of days for that.
//Andreas
Signature · 3 lines
Ulrich Weber | [email protected] | Software Engineer Astaro GmbH & Co. KG | www.astaro.com | Phone +49-721-25516-0 | Fax –200 An der RaumFabrik 33a | 76227 Karlsruhe | Germany
PATCH 1/1 iproute2: dont filter cached routes on iproute_get
In reply to Andreas Henrikssoniproute_get will return cloned routes for IPv4 and cloned as well non-cloned routes for IPv6.
Therefore RTM_F_CLONED flag should not be checked for iproute_get routes. Check in print_route will always fail because valid values are 0 and 1.
--- ip/iproute.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
ip/iproute.c +1 -0
@@ -1286,6 +1286,7 @@ int iproute_get(int argc, char **argv)memset (&req,0 ,sizeof (req));iproute_reset_filter (); + filter.cloned =2 ; req.n.nlmsg_len =NLMSG_LENGTH (sizeof (struct rtmsg )); req.n.nlmsg_flags =NLM_F_REQUEST ;
Signature · 1 line
1.7.0.4
Re: [PATCH] iproute2: dont filter cached routes on iproute_get
Hi.
Is this patch supposed to be applied on top of plain iproute2 v2.6.35 or on top of the previous Andreas' patch?
Quoted 28 lines · Ulrich Weber
iproute_getwill return cloned routes for IPv4 and cloned as well non-cloned routes for IPv6.Therefore
RTM_F_CLONEDflag should not be checked foriproute_getroutes. Check inprint_routewill always fail because valid values are 0 and 1.Signed-off-by Ulrich Weber <[email protected]>---
ip/iproute.c | 1 +1 files changed, 1 insertions(+), 0 deletions(-)ip/iproute.c +1
-1@@ -1286,6 +1286,7 @@ int iproute_get(int argc, char **argv) memset(&req, 0, sizeof(req)); iproute_reset_filter(); + filter.cloned = 2; req.n.nlmsg_len = NLMSG_LENGTH(sizeof(struct rtmsg)); req.n.nlmsg_flags = NLM_F_REQUEST; --1.7.0.4
Re: [PATCH] iproute2: dont filter cached routes on iproute_get
The patch should be applied on top of iproute2 v2.6.35.
Cheers
Ulrich
Quoted 35 lines · Fabio Comolli
Hi.
Is this patch supposed to be applied on top of plain iproute2 v2.6.35 or on top of the previous Andreas' patch?Quoted 28 lines · Ulrich Weber
iproute_getwill return cloned routes for IPv4 and cloned as well non-cloned routes for IPv6.Therefore
RTM_F_CLONEDflag should not be checked foriproute_getroutes. Check inprint_routewill always fail because valid values are 0 and 1.Signed-off-by Ulrich Weber <[email protected]>--- ip/iproute.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)ip/iproute.c +1
-1@@ -1286,6 +1286,7 @@ int iproute_get(int argc, char **argv)memset (&req,0 ,sizeof (req));iproute_reset_filter (); + filter.cloned =2 ; req.n.nlmsg_len =NLMSG_LENGTH (sizeof (struct rtmsg )); req.n.nlmsg_flags =NLM_F_REQUEST ; --1.7.0.4
Signature · 3 lines
Ulrich Weber | [email protected] | Software Engineer Astaro GmbH & Co. KG | www.astaro.com | Phone +49-721-25516-0 | Fax –200 An der RaumFabrik 33a | 76227 Karlsruhe | Germany
Re: [PATCH] iproute2: dont filter cached routes on iproute_get
Works for me (for ipv4, I cannot test ipv6).
You can add my Tested-By in case you need it.
Regards,
Fabio
Quoted 48 lines · Ulrich Weber
The patch should be applied on top of iproute2 v2.6.35.
Cheers
UlrichQuoted 29 lines · Fabio Comolli
Hi.
Is this patch supposed to be applied on top of plain iproute2 v2.6.35 or on top of the previous Andreas' patch?Quoted 22 lines · Ulrich Weber
iproute_getwill return cloned routes for IPv4 and cloned as well non-cloned routes for IPv6.Therefore
RTM_F_CLONEDflag should not be checked foriproute_getroutes. Check inprint_routewill always fail because valid values are 0 and 1.Signed-off-by Ulrich Weber <[email protected]>---
ip/iproute.c | 1 +1 files changed, 1 insertions(+), 0 deletions(-)ip/iproute.c +1
-0@@ -1286,6 +1286,7 @@ int iproute_get(int argc, char **argv) memset(&req, 0, sizeof(req)); iproute_reset_filter(); + filter.cloned = 2;Quoted 6 lines
Quoted 6 lines
ip/iproute.c +0
-1req.n.nlmsg_len = NLMSG_LENGTH(sizeof(struct rtmsg)); req.n.nlmsg_flags = NLM_F_REQUEST; --1.7.0.4
--
Ulrich Weber | [email protected] | Software Engineer
Astaro GmbH & Co. KG | www.astaro.com | Phone +49-721-25516-0 | Fax –200 An der RaumFabrik 33a | 76227 Karlsruhe | Germany
Stephen Hemminger
AppliedRe: [PATCH] iproute2: dont filter cached routes on iproute_get
In reply to Ulrich WeberQuoted 17 lines · On Thu, 12 Aug 2010 11:05:19 +0200 Ulrich Weber <[email protected]> wrote:
iproute_getwill return cloned routes for IPv4 and cloned as well non-cloned routes for IPv6.Therefore
RTM_F_CLONEDflag should not be checked foriproute_getroutes. Check inprint_routewill always fail because valid values are 0 and 1.Signed-off-by Ulrich Weber <[email protected]>--- ip/iproute.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)ip/iproute.c +0
-0
ip/iproute.c int iproute_get(int argc, char **argv) · line 1292
Quoted 7 lines
ip/iproute.c +1
-0@@ -1286,6 +1286,7 @@ int iproute_get(int argc, char **argv)memset (&req,0 ,sizeof (req));iproute_reset_filter (); + filter.cloned =2 ; req.n.nlmsg_len =NLMSG_LENGTH (sizeof (struct rtmsg )); req.n.nlmsg_flags =NLM_F_REQUEST ;
Applied