naccyde / rpms / iproute

Forked from rpms/iproute 5 months ago
Clone

Blame SOURCES/0213-route-allow-routes-to-be-configured-with-expire-valu.patch

049c96
From 9c5c3d0a9c58d8385424193fbd3467c29483d3d2 Mon Sep 17 00:00:00 2001
049c96
From: Phil Sutter <psutter@redhat.com>
049c96
Date: Wed, 20 Jul 2016 20:45:56 +0200
049c96
Subject: [PATCH] route: allow routes to be configured with expire values
049c96
049c96
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1357020
049c96
Upstream Status: iproute2.git commit 68eede2505005
049c96
Conflicts: Context changes due to missing commits:
049c96
           * 194e9b855d053 ("ip: support RFC4191 router preference")
049c96
	   * f638e9f7c8718 ("mpls: always set type RTN_UNICAST and scope
049c96
	                    RT_SCOPE_UNIVERSE for")
049c96
049c96
commit 68eede2505005ea919e2fb43afc91bad0601faea
049c96
Author: Hangbin Liu <liuhangbin@gmail.com>
049c96
Date:   Mon Dec 21 16:29:36 2015 +0800
049c96
049c96
    route: allow routes to be configured with expire values
049c96
049c96
    Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
049c96
---
049c96
 ip/iproute.c | 10 ++++++++++
049c96
 1 file changed, 10 insertions(+)
049c96
049c96
diff --git a/ip/iproute.c b/ip/iproute.c
049c96
index 94dacbb..a13e6f3 100644
049c96
--- a/ip/iproute.c
049c96
+++ b/ip/iproute.c
049c96
@@ -82,6 +82,7 @@ static void usage(void)
049c96
 	fprintf(stderr, "           [ ssthresh NUMBER ] [ realms REALM ] [ src ADDRESS ]\n");
049c96
 	fprintf(stderr, "           [ rto_min TIME ] [ hoplimit NUMBER ] [ initrwnd NUMBER ]\n");
049c96
 	fprintf(stderr, "           [ features FEATURES ] [ quickack BOOL ] [ congctl NAME ]\n");
049c96
+	fprintf(stderr, "           [ expires TIME ]\n");
049c96
 	fprintf(stderr, "TYPE := { unicast | local | broadcast | multicast | throw |\n");
049c96
 	fprintf(stderr, "          unreachable | prohibit | blackhole | nat }\n");
049c96
 	fprintf(stderr, "TABLE_ID := [ local | main | default | all | NUMBER ]\n");
049c96
@@ -746,6 +747,7 @@ static int iproute_modify(int cmd, unsigned flags, int argc, char **argv)
049c96
 	int scope_ok = 0;
049c96
 	int table_ok = 0;
049c96
 	int raw = 0;
049c96
+	static int hz;
049c96
 
049c96
 	memset(&req, 0, sizeof(req));
049c96
 
049c96
@@ -797,6 +799,14 @@ static int iproute_modify(int cmd, unsigned flags, int argc, char **argv)
049c96
 			if (rtnl_dsfield_a2n(&tos, *argv))
049c96
 				invarg("\"tos\" value is invalid\n", *argv);
049c96
 			req.r.rtm_tos = tos;
049c96
+		} else if (strcmp(*argv, "expires") == 0 ) {
049c96
+			__u32 expires;
049c96
+			NEXT_ARG();
049c96
+			if (get_u32(&expires, *argv, 0))
049c96
+				invarg("\"expires\" value is invalid\n", *argv);
049c96
+			if (!hz)
049c96
+				hz = get_user_hz();
049c96
+			addattr32(&req.n, sizeof(req), RTA_EXPIRES, expires*hz);
049c96
 		} else if (matches(*argv, "metric") == 0 ||
049c96
 			   matches(*argv, "priority") == 0 ||
049c96
 			   matches(*argv, "preference") == 0) {
049c96
-- 
049c96
1.8.3.1
049c96