name, vrf_id, vrf->vrf_id);
return NULL;
}
- /* look for duplicates. case is followine one:
- * - a vrf is configured per name -> vrfA
- * - netlink discovery creates a vrf with vrf_id ->vrfB
- * - then, netlink discovers vrf, and associated vrf_id and name
- * -> so vrfA and vrfB must be merged
- */
- if (vrf && vrf_id != VRF_UNKNOWN
- && vrf->vrf_id == VRF_UNKNOWN) {
- struct vrf *vrf2 = vrf_lookup_by_id(vrf_id);
- struct interface *ifp;
-
- if (vrf2 && !vrf2->name && vrf2 != vrf) {
- /* move vrf2 context to vrf */
- FOR_ALL_INTERFACES (vrf2, ifp)
- if_update_to_new_vrf(ifp, vrf);
- vrf_delete(vrf2);
- }
- }
/* Try to find VRF both by ID and name */
if (!vrf && vrf_id != VRF_UNKNOWN)
vrf = vrf_lookup_by_id(vrf_id);
{
int ret = 0;
struct interface *ifp;
- struct vrf *vrf = vrf_lookup_by_id(vrf_id);
- if (fd < 0 || name == NULL || !vrf)
+ if (fd < 0 || name == NULL)
return fd;
/* the device should exist
* otherwise we should return
* case ifname = vrf in netns mode => return
*/
- ifp = if_lookup_by_name(name, vrf);
+ ifp = if_lookup_by_name(name, vrf_id);
if (!ifp)
return fd;
#ifdef SO_BINDTODEVICE
return ++vrf_id_local;
}
-
-vrf_id_t vrf_to_id(struct vrf *vrf)
-{
- return vrf ? vrf->vrf_id : VRF_UNKNOWN;
-}
-
-const char *vrf_to_name(struct vrf *vrf)
-{
- return vrf ? vrf->name : "NIL";
-}