Blob Blame History Raw
From fcb76a6f2bd281e956dc736fb63dc1fa238ce220 Mon Sep 17 00:00:00 2001
From: Phil Sutter <psutter@redhat.com>
Date: Wed, 20 Jul 2016 20:48:14 +0200
Subject: [PATCH] ip route: timeout for routes has to be set in seconds

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1357020
Upstream Status: iproute2.git commit eecc006952d6f
Conflicts: Changed context due to missing commit f638e9f7c8718
	   ("mpls: always set type RTN_UNICAST and scope
	    RT_SCOPE_UNIVERSE for")

commit eecc006952d6f3992b632974d0f04f995d2a176e
Author: Andrew Vagin <avagin@virtuozzo.com>
Date:   Wed Jun 29 02:27:14 2016 +0300

    ip route: timeout for routes has to be set in seconds

    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 a13e6f3..094566a 100644
--- a/ip/iproute.c
+++ b/ip/iproute.c
@@ -747,7 +747,6 @@ static int iproute_modify(int cmd, unsigned flags, int argc, char **argv)
 	int scope_ok = 0;
 	int table_ok = 0;
 	int raw = 0;
-	static int hz;
 
 	memset(&req, 0, sizeof(req));
 
@@ -804,9 +803,7 @@ static int iproute_modify(int cmd, unsigned 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 ||
 			   matches(*argv, "preference") == 0) {
-- 
1.8.3.1