diff options
| author | Philippe Guibert <philippe.guibert@6wind.com> | 2019-02-11 15:03:19 +0100 |
|---|---|---|
| committer | Philippe Guibert <philippe.guibert@6wind.com> | 2019-06-12 08:37:58 +0200 |
| commit | da85f5e03899ee53e235ef5eb6cdacc1ae85de86 (patch) | |
| tree | af9824ef538cb44e0f00be9425d48d6155a5130e /lib/if.c | |
| parent | 921a85ba8c92eea6e104dea002870e323e5a19b5 (diff) | |
lib, bgpd, ospfd, pimd, zebra, rip, ripng, bfd: change if_update_to_new_vrf() api
vrf_id parameter is replaced with struct vrf * parameter. It is
needed to create vrf structure before entering in the fuction.
an error is generated in case the vrf parameter is missing.
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Diffstat (limited to 'lib/if.c')
| -rw-r--r-- | lib/if.c | 18 |
1 files changed, 12 insertions, 6 deletions
@@ -157,11 +157,18 @@ struct interface *if_create(const char *name, struct vrf *vrf) return ifp; } -/* Create new interface structure. */ -void if_update_to_new_vrf(struct interface *ifp, vrf_id_t vrf_id) +/* Create new interface structure. + * vrf must be created outside of this routing + */ +void if_update_to_new_vrf(struct interface *ifp, struct vrf *vrf) { - struct vrf *old_vrf, *vrf; + struct vrf *old_vrf; + if (!vrf) { + flog_err(EC_LIB_INTERFACE, "interface %s. Unknown VRF", + ifp->name); + return; + } /* remove interface from old master vrf list */ old_vrf = vrf_lookup_by_id(ifp->vrf_id); if (old_vrf) { @@ -170,8 +177,7 @@ void if_update_to_new_vrf(struct interface *ifp, vrf_id_t vrf_id) IFINDEX_RB_REMOVE(old_vrf, ifp); } - ifp->vrf_id = vrf_id; - vrf = vrf_get(ifp->vrf_id, NULL); + ifp->vrf_id = vrf->vrf_id; IFNAME_RB_INSERT(vrf, ifp); if (ifp->ifindex != IFINDEX_INTERNAL) @@ -439,7 +445,7 @@ struct interface *if_get_by_name(const char *name, struct vrf *vrf) /* If it came from the kernel or by way of zclient, * believe it and update the ifp accordingly. */ - if_update_to_new_vrf(ifp, vrf->vrf_id); + if_update_to_new_vrf(ifp, vrf); return ifp; } return if_create(name, vrf); |
