lib: move the interface list into "struct vrf"
An interface belongs to a specific VRF. So move the interface list
into the "struct vrf".
* vrf.c/vrf.h:
- add a new member "struct list *iflist" to the the "struct vrf";
- call if_init() in vrf_new();
- call if_terminate() in vrf_delete();
- add utilities to access the interface list and VRF ID in the
specified VRF.
* if.c/if.h:
- the global "iflist" now only exists for the default VRF;
- the global "if_master" is initialized on the definition;
- in if_create(), the interface is added into the list in the
specified VRF; if the VRF does not exist, create one;
- add parameters to if_init()/if_terminate() so that the
interface list in the VRF can be initialized/destroyed;
- in if_dump_all() scan the interfaces in all the VRFs;
- add a command "show address vrf N" to show addresses in a
specified VRF;
- add a command "show address vrf all" to show addresses in all
VRFs;
- new APIs ifxxx_vrf() are added to access an interface in a
specified VRF.
The old interface APIs (the global variable "iflist" and the API
functions) are not changed to keep the backward compatibility.
The new APIs are used in the daemons which support multiple VRFs
(till now only zebra).
Signed-off-by: Feng Lu <lu.feng@6wind.com>
Reviewed-by: Alain Ritoux <alain.ritoux@6wind.com>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Acked-by: Vincent JARDIN <vincent.jardin@6wind.com>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
4 files changed