summaryrefslogtreecommitdiffstats
path: root/zebra/connected.c
diff options
context:
space:
mode:
authorPhilippe Guibert <philippe.guibert@6wind.com>2019-02-11 17:42:50 +0100
committerPhilippe Guibert <philippe.guibert@6wind.com>2019-06-12 14:10:28 +0200
commita41c4e1b1f577443ad26222704a69649c280cd9e (patch)
tree2d01484bb959675b20c1596be1c1f4e28ddaf403 /zebra/connected.c
parentlib, bgpd, ospfd, pimd, zebra, rip, ripng, bfd: change if_update_to_new_vrf()... (diff)
downloadfrr-a41c4e1b1f577443ad26222704a69649c280cd9e.tar.xz
frr-a41c4e1b1f577443ad26222704a69649c280cd9e.zip
*: change interface structure, from vrf_id to vrf
Field vrf_id is replaced by the pointer of the struct vrf *. For that all other code referencing to (interface)->vrf_id is replaced. This work should not change the behaviour. It is just a continuation work toward having an interface API handling vrf pointer only. some new generic functions are created in vrf: vrf_to_id, vrf_to_name, a zebra function is also created: zvrf_info_lookup an ospf function is also created: ospf_lookup_by_vrf it is to be noted that now that interface has a vrf pointer, some more optimisations could be thought through all the rest of the code. as example, many structure store the vrf_id. those structures could get the exact vrf structure if inherited from an interface vrf context. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Diffstat (limited to 'zebra/connected.c')
-rw-r--r--zebra/connected.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/zebra/connected.c b/zebra/connected.c
index bba221c2c..bd4f9b66a 100644
--- a/zebra/connected.c
+++ b/zebra/connected.c
@@ -207,16 +207,16 @@ void connected_up(struct interface *ifp, struct connected *ifc)
struct nexthop nh = {
.type = NEXTHOP_TYPE_IFINDEX,
.ifindex = ifp->ifindex,
- .vrf_id = ifp->vrf_id,
+ .vrf_id = vrf_to_id(ifp->vrf),
};
struct zebra_vrf *zvrf;
uint32_t metric;
- zvrf = zebra_vrf_lookup_by_id(ifp->vrf_id);
+ zvrf = zebra_vrf_lookup_by_id(ifp->vrf->vrf_id);
if (!zvrf) {
flog_err(EC_ZEBRA_VRF_NOT_FOUND,
"%s: Received Up for interface but no associated zvrf: %d",
- __PRETTY_FUNCTION__, ifp->vrf_id);
+ __PRETTY_FUNCTION__, ifp->vrf->vrf_id);
return;
}
if (!CHECK_FLAG(ifc->conf, ZEBRA_IFC_REAL))
@@ -265,7 +265,7 @@ void connected_up(struct interface *ifp, struct connected *ifc)
zlog_debug(
"%u: IF %s address %s add/up, scheduling RIB processing",
- ifp->vrf_id, ifp->name,
+ vrf_to_id(ifp->vrf), ifp->name,
prefix2str(&p, buf, sizeof(buf)));
}
rib_update(zvrf->vrf->vrf_id, RIB_UPDATE_IF_CHANGE);
@@ -383,15 +383,15 @@ void connected_down(struct interface *ifp, struct connected *ifc)
struct nexthop nh = {
.type = NEXTHOP_TYPE_IFINDEX,
.ifindex = ifp->ifindex,
- .vrf_id = ifp->vrf_id,
+ .vrf_id = vrf_to_id(ifp->vrf),
};
struct zebra_vrf *zvrf;
- zvrf = zebra_vrf_lookup_by_id(ifp->vrf_id);
+ zvrf = zebra_vrf_lookup_by_id(ifp->vrf->vrf_id);
if (!zvrf) {
flog_err(EC_ZEBRA_VRF_NOT_FOUND,
"%s: Received Up for interface but no associated zvrf: %d",
- __PRETTY_FUNCTION__, ifp->vrf_id);
+ __PRETTY_FUNCTION__, ifp->vrf->vrf_id);
return;
}
@@ -473,22 +473,22 @@ static void connected_delete_helper(struct connected *ifc, struct prefix *p)
zlog_debug(
"%u: IF %s IP %s address del, scheduling RIB processing",
- ifp->vrf_id, ifp->name,
+ vrf_to_id(ifp->vrf), ifp->name,
prefix2str(p, buf, sizeof(buf)));
}
- rib_update(ifp->vrf_id, RIB_UPDATE_IF_CHANGE);
+ rib_update(vrf_to_id(ifp->vrf), RIB_UPDATE_IF_CHANGE);
/* Schedule LSP forwarding entries for processing, if appropriate. */
- if (ifp->vrf_id == VRF_DEFAULT) {
+ if (vrf_to_id(ifp->vrf) == VRF_DEFAULT) {
if (IS_ZEBRA_DEBUG_MPLS) {
char buf[PREFIX_STRLEN];
zlog_debug(
"%u: IF %s IP %s address delete, scheduling MPLS processing",
- ifp->vrf_id, ifp->name,
+ vrf_to_id(ifp->vrf), ifp->name,
prefix2str(p, buf, sizeof(buf)));
}
- mpls_mark_lsps_for_processing(vrf_info_lookup(ifp->vrf_id), p);
+ mpls_mark_lsps_for_processing(zvrf_info_lookup(ifp->vrf), p);
}
}