* [PATCH] iproute: Ignore all output fields of ip route get for route add
@ 2011-06-03 8:39 Andi Kleen
2011-06-03 9:07 ` David Miller
0 siblings, 1 reply; 3+ messages in thread
From: Andi Kleen @ 2011-06-03 8:39 UTC (permalink / raw)
To: shemminger, netdev
My vpnc-connect script broke in a kernel release because the new
kernel started returning the ipid in ip cache get. The script
would do ip route get, modify the route and then feed it back
to ip route add. But ip route add couldn't parse ipid ..
Make route add skip all status fields output by ip cache get
In theory they could be fed to the kernel too, but that's likely
not very useful (and I'm not fully sure if the kernel would
even use them)
Signed-off-by: Andi Kleen <ak@linux.intel.com>
diff --git a/ip/iproute.c b/ip/iproute.c
index 2fef35b..8b7421e 100644
--- a/ip/iproute.c
+++ b/ip/iproute.c
@@ -936,6 +936,17 @@ int iproute_modify(int cmd, unsigned flags, int argc, char **argv)
strcmp(*argv, "oif") == 0) {
NEXT_ARG();
d = *argv;
+ /* Ignore everything else printed by ip route get. */
+ } else if (strcmp(*argv, "ipid") == 0 ||
+ strcmp(*argv, "ts") == 0 ||
+ strcmp(*argv, "tsage") == 0 ||
+ strcmp(*argv, "age") == 0 ||
+ strcmp(*argv, "used") == 0 ||
+ strcmp(*argv, "users") == 0 ||
+ strcmp(*argv, "error") == 0 ||
+ strcmp(*argv, "cache") == 0 ||
+ strcmp(*argv, "expires") == 0) {
+ NEXT_ARG();
} else {
int type;
inet_prefix dst;
--
ak@linux.intel.com -- Speaking for myself only.
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] iproute: Ignore all output fields of ip route get for route add
2011-06-03 8:39 [PATCH] iproute: Ignore all output fields of ip route get for route add Andi Kleen
@ 2011-06-03 9:07 ` David Miller
2011-06-03 20:52 ` Andi Kleen
0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2011-06-03 9:07 UTC (permalink / raw)
To: andi; +Cc: shemminger, netdev
From: Andi Kleen <andi@firstfloor.org>
Date: Fri, 3 Jun 2011 10:39:18 +0200
> My vpnc-connect script broke in a kernel release because the new
> kernel started returning the ipid in ip cache get. The script
> would do ip route get, modify the route and then feed it back
> to ip route add. But ip route add couldn't parse ipid ..
>
> Make route add skip all status fields output by ip cache get
>
> In theory they could be fed to the kernel too, but that's likely
> not very useful (and I'm not fully sure if the kernel would
> even use them)
>
> Signed-off-by: Andi Kleen <ak@linux.intel.com>
I think we've had this discussion before.
There are no guarentees that what the tool outputs for routes is
suitable for creating routes.
People have already put vpnc script fixes into Fedora and similar
already.
iproute2 is not where the hacks belong.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] iproute: Ignore all output fields of ip route get for route add
2011-06-03 9:07 ` David Miller
@ 2011-06-03 20:52 ` Andi Kleen
0 siblings, 0 replies; 3+ messages in thread
From: Andi Kleen @ 2011-06-03 20:52 UTC (permalink / raw)
To: David Miller; +Cc: andi, shemminger, netdev
> There are no guarentees that what the tool outputs for routes is
> suitable for creating routes.
>
> People have already put vpnc script fixes into Fedora and similar
> already.
>
> iproute2 is not where the hacks belong.
Hmmm, so you expect every user to maintain the sed line from hell?
Does not sound very user friendly to me.
An alternative would be to add a option to ip route get that disables
printing any options that cannot be used for input.
Would that be more acceptable?
-Andi
--
ak@linux.intel.com -- Speaking for myself only.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-06-03 20:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-03 8:39 [PATCH] iproute: Ignore all output fields of ip route get for route add Andi Kleen
2011-06-03 9:07 ` David Miller
2011-06-03 20:52 ` Andi Kleen
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).