From: Andi Kleen <andi@firstfloor.org>
To: shemminger@linux-foundation.org, netdev@vger.kernel.org
Subject: [PATCH] iproute: Ignore all output fields of ip route get for route add
Date: Fri, 3 Jun 2011 10:39:18 +0200 [thread overview]
Message-ID: <20110603083918.GA15883@one.firstfloor.org> (raw)
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.
next reply other threads:[~2011-06-03 8:39 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-03 8:39 Andi Kleen [this message]
2011-06-03 9:07 ` [PATCH] iproute: Ignore all output fields of ip route get for route add David Miller
2011-06-03 20:52 ` Andi Kleen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110603083918.GA15883@one.firstfloor.org \
--to=andi@firstfloor.org \
--cc=netdev@vger.kernel.org \
--cc=shemminger@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).