mirror of
https://git.proxmox.com/git/mirror_iproute2
synced 2025-10-10 16:43:20 +00:00
ip vrf: use hook to change VRF in the child
On vrf exec, reset the VRF associations in the child process, via the new hook added to cmd_exec(). In this way, the parent doesn't have to reset the VRF associations before spawning other processes. Signed-off-by: Matteo Croce <mcroce@redhat.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
This commit is contained in:
parent
903818fbf9
commit
d81d4ba15d
12
ip/ipvrf.c
12
ip/ipvrf.c
@ -441,6 +441,13 @@ out:
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int do_switch(void *arg)
|
||||||
|
{
|
||||||
|
char *vrf = arg;
|
||||||
|
|
||||||
|
return vrf_switch(vrf);
|
||||||
|
}
|
||||||
|
|
||||||
static int ipvrf_exec(int argc, char **argv)
|
static int ipvrf_exec(int argc, char **argv)
|
||||||
{
|
{
|
||||||
if (argc < 1) {
|
if (argc < 1) {
|
||||||
@ -452,10 +459,7 @@ static int ipvrf_exec(int argc, char **argv)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vrf_switch(argv[0]))
|
return -cmd_exec(argv[1], argv + 1, !!batch_mode, do_switch, argv[0]);
|
||||||
return -1;
|
|
||||||
|
|
||||||
return -cmd_exec(argv[1], argv + 1, !!batch_mode, NULL, NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* reset VRF association of current process to default VRF;
|
/* reset VRF association of current process to default VRF;
|
||||||
|
Loading…
Reference in New Issue
Block a user