public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrey Vagin <avagin@openvz.org>
To: netdev@vger.kernel.org
Cc: Andrew Vagin <avagin@virtuozzo.com>,
	Xin Long <lucien.xin@gmail.com>,
	Hangbin Liu <liuhangbin@gmail.com>,
	Stephen Hemminger <shemming@brocade.com>
Subject: [PATCH] ip route: timeout for routes has to be set in seconds
Date: Wed, 29 Jun 2016 02:27:14 +0300	[thread overview]
Message-ID: <1467156434-2157-1-git-send-email-avagin@openvz.org> (raw)

From: Andrew Vagin <avagin@virtuozzo.com>

Currently a timeout is multiplied by HZ in user-space and
then it multiplied by HZ in kernel-space.

$ ./ip/ip r add 2002::0/64 dev veth1 expires 10
$ ./ip/ip -6 r
2002::/64 dev veth1  metric 1024 linkdown  expires 996sec pref medium

Cc: Xin Long <lucien.xin@gmail.com>
Cc: Hangbin Liu <liuhangbin@gmail.com>
Cc: Stephen Hemminger <shemming@brocade.com>
Fixes: 68eede250500 ("route: allow routes to be configured with expire values")
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
---
 ip/iproute.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/ip/iproute.c b/ip/iproute.c
index 8224d7f..7c0f5a4 100644
--- a/ip/iproute.c
+++ b/ip/iproute.c
@@ -839,7 +839,6 @@ static int iproute_modify(int cmd, unsigned int flags, int argc, char **argv)
 	int table_ok = 0;
 	int raw = 0;
 	int type_ok = 0;
-	static int hz;
 
 	memset(&req, 0, sizeof(req));
 
@@ -923,9 +922,7 @@ static int iproute_modify(int cmd, unsigned int flags, int argc, char **argv)
 			NEXT_ARG();
 			if (get_u32(&expires, *argv, 0))
 				invarg("\"expires\" value is invalid\n", *argv);
-			if (!hz)
-				hz = get_user_hz();
-			addattr32(&req.n, sizeof(req), RTA_EXPIRES, expires*hz);
+			addattr32(&req.n, sizeof(req), RTA_EXPIRES, expires);
 		} else if (matches(*argv, "metric") == 0 ||
 			   matches(*argv, "priority") == 0 ||
 			   strcmp(*argv, "preference") == 0) {
-- 
2.7.4

             reply	other threads:[~2016-06-28 23:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-28 23:27 Andrey Vagin [this message]
2016-06-29 10:26 ` [PATCH] ip route: timeout for routes has to be set in seconds Xin Long
     [not found] ` <15a8916ec54d447b95cff28f99118342@HQ1WP-EXMB11.corp.brocade.com>
2016-06-29 16:25   ` Stephen Hemminger
     [not found] <5a205385ce594320936c4e330d52f532@HQ1WP-EXMB11.corp.brocade.com>
2016-07-01  0:29 ` Stephen Hemminger

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=1467156434-2157-1-git-send-email-avagin@openvz.org \
    --to=avagin@openvz.org \
    --cc=avagin@virtuozzo.com \
    --cc=liuhangbin@gmail.com \
    --cc=lucien.xin@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=shemming@brocade.com \
    /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