linma / rpms / iproute

Forked from rpms/iproute 4 years ago
Clone

Blame SOURCES/0075-ip-vrf-use-hook-to-change-VRF-in-the-child.patch

8def76
From 1a9c12f737e86a7905cd123f364af053dc0c7491 Mon Sep 17 00:00:00 2001
8def76
From: Andrea Claudi <aclaudi@redhat.com>
8def76
Date: Fri, 28 Jun 2019 14:12:36 +0200
8def76
Subject: [PATCH] ip vrf: use hook to change VRF in the child
8def76
8def76
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1719759
8def76
Upstream Status: iproute2.git commit d81d4ba15d74a
8def76
8def76
commit d81d4ba15d74a51f23f61a2ddb792689e5db95f0
8def76
Author: Matteo Croce <mcroce@redhat.com>
8def76
Date:   Tue Jun 18 16:49:34 2019 +0200
8def76
8def76
    ip vrf: use hook to change VRF in the child
8def76
8def76
    On vrf exec, reset the VRF associations in the child process, via the
8def76
    new hook added to cmd_exec(). In this way, the parent doesn't have to
8def76
    reset the VRF associations before spawning other processes.
8def76
8def76
    Signed-off-by: Matteo Croce <mcroce@redhat.com>
8def76
    Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
8def76
---
8def76
 ip/ipvrf.c | 12 ++++++++----
8def76
 1 file changed, 8 insertions(+), 4 deletions(-)
8def76
8def76
diff --git a/ip/ipvrf.c b/ip/ipvrf.c
8def76
index c93ff71b39070..aba8639501139 100644
8def76
--- a/ip/ipvrf.c
8def76
+++ b/ip/ipvrf.c
8def76
@@ -441,6 +441,13 @@ out:
8def76
 	return rc;
8def76
 }
8def76
 
8def76
+static int do_switch(void *arg)
8def76
+{
8def76
+	char *vrf = arg;
8def76
+
8def76
+	return vrf_switch(vrf);
8def76
+}
8def76
+
8def76
 static int ipvrf_exec(int argc, char **argv)
8def76
 {
8def76
 	if (argc < 1) {
8def76
@@ -452,10 +459,7 @@ static int ipvrf_exec(int argc, char **argv)
8def76
 		return -1;
8def76
 	}
8def76
 
8def76
-	if (vrf_switch(argv[0]))
8def76
-		return -1;
8def76
-
8def76
-	return -cmd_exec(argv[1], argv + 1, !!batch_mode, NULL, NULL);
8def76
+	return -cmd_exec(argv[1], argv + 1, !!batch_mode, do_switch, argv[0]);
8def76
 }
8def76
 
8def76
 /* reset VRF association of current process to default VRF;
8def76
-- 
8def76
2.20.1
8def76