diff options
author | Philippe Guibert <philippe.guibert@6wind.com> | 2019-02-11 17:42:50 +0100 |
---|---|---|
committer | Philippe Guibert <philippe.guibert@6wind.com> | 2019-06-12 14:10:28 +0200 |
commit | a41c4e1b1f577443ad26222704a69649c280cd9e (patch) | |
tree | 2d01484bb959675b20c1596be1c1f4e28ddaf403 /ripngd | |
parent | lib, bgpd, ospfd, pimd, zebra, rip, ripng, bfd: change if_update_to_new_vrf()... (diff) | |
download | frr-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 'ripngd')
-rw-r--r-- | ripngd/ripng_interface.c | 11 | ||||
-rw-r--r-- | ripngd/ripngd.c | 2 |
2 files changed, 8 insertions, 5 deletions
diff --git a/ripngd/ripng_interface.c b/ripngd/ripng_interface.c index ebecb6484..71f5552b2 100644 --- a/ripngd/ripng_interface.c +++ b/ripngd/ripng_interface.c @@ -210,7 +210,7 @@ int ripng_interface_up(ZAPI_CALLBACK_ARGS) if (IS_RIPNG_DEBUG_ZEBRA) zlog_debug( "interface up %s vrf %u index %d flags %llx metric %d mtu %d", - ifp->name, ifp->vrf_id, ifp->ifindex, + ifp->name, ifp->vrf->vrf_id, ifp->ifindex, (unsigned long long)ifp->flags, ifp->metric, ifp->mtu6); ripng_interface_sync(ifp); @@ -247,7 +247,7 @@ int ripng_interface_down(ZAPI_CALLBACK_ARGS) if (IS_RIPNG_DEBUG_ZEBRA) zlog_debug( "interface down %s vrf %u index %d flags %#llx metric %d mtu %d", - ifp->name, ifp->vrf_id, ifp->ifindex, + ifp->name, ifp->vrf->vrf_id, ifp->ifindex, (unsigned long long)ifp->flags, ifp->metric, ifp->mtu6); return 0; @@ -264,7 +264,7 @@ int ripng_interface_add(ZAPI_CALLBACK_ARGS) if (IS_RIPNG_DEBUG_ZEBRA) zlog_debug( "RIPng interface add %s vrf %u index %d flags %#llx metric %d mtu %d", - ifp->name, ifp->vrf_id, ifp->ifindex, + ifp->name, ifp->vrf->vrf_id, ifp->ifindex, (unsigned long long)ifp->flags, ifp->metric, ifp->mtu6); /* Check is this interface is RIP enabled or not.*/ @@ -299,7 +299,7 @@ int ripng_interface_delete(ZAPI_CALLBACK_ARGS) zlog_info( "interface delete %s vrf %u index %d flags %#llx metric %d mtu %d", - ifp->name, ifp->vrf_id, ifp->ifindex, + ifp->name, ifp->vrf->vrf_id, ifp->ifindex, (unsigned long long)ifp->flags, ifp->metric, ifp->mtu6); /* To support pseudo interface do not free interface structure. */ @@ -328,6 +328,7 @@ int ripng_interface_vrf_update(ZAPI_CALLBACK_ARGS) ifp->name, vrf_id, new_vrf_id); if_update_to_new_vrf(ifp, new_vrf); + ripng_interface_sync(ifp); return 0; @@ -932,7 +933,7 @@ void ripng_interface_sync(struct interface *ifp) { struct vrf *vrf; - vrf = vrf_lookup_by_id(ifp->vrf_id); + vrf = ifp->vrf; if (vrf) { struct ripng_interface *ri; diff --git a/ripngd/ripngd.c b/ripngd/ripngd.c index 67a52e9f0..b083a07f8 100644 --- a/ripngd/ripngd.c +++ b/ripngd/ripngd.c @@ -2603,6 +2603,8 @@ void ripng_if_rmap_update_interface(struct interface *ifp) struct if_rmap *if_rmap; struct if_rmap_ctx *ctx; + if (ifp->vrf && ifp->vrf->vrf_id == VRF_UNKNOWN) + return; if (!ripng) return; ctx = ripng->if_rmap_ctx; |