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 /bfdd | |
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 'bfdd')
-rw-r--r-- | bfdd/bfd.c | 4 | ||||
-rw-r--r-- | bfdd/ptm_adapter.c | 8 |
2 files changed, 6 insertions, 6 deletions
diff --git a/bfdd/bfd.c b/bfdd/bfd.c index 435443182..3d8f38181 100644 --- a/bfdd/bfd.c +++ b/bfdd/bfd.c @@ -139,7 +139,7 @@ int bfd_session_enable(struct bfd_session *bs) if (bs->key.ifname[0]) { if (vrf) - ifp = if_lookup_by_name(bs->key.ifname, vrf->vrf_id); + ifp = if_lookup_by_name(bs->key.ifname, vrf); else ifp = if_lookup_by_name_all_vrf(bs->key.ifname); if (ifp == NULL) { @@ -148,7 +148,7 @@ int bfd_session_enable(struct bfd_session *bs) return 0; } if (bs->key.ifname[0] && !vrf) { - vrf = vrf_lookup_by_id(ifp->vrf_id); + vrf = ifp->vrf; if (vrf == NULL) { log_error( "session-enable: specified VRF doesn't exists."); diff --git a/bfdd/ptm_adapter.c b/bfdd/ptm_adapter.c index 1d5e8310f..a634d923d 100644 --- a/bfdd/ptm_adapter.c +++ b/bfdd/ptm_adapter.c @@ -572,7 +572,10 @@ static void bfdd_sessions_enable_interface(struct interface *ifp) { struct bfd_session_observer *bso; struct bfd_session *bs; - struct vrf *vrf; + struct vrf *vrf = ifp->vrf; + + if (!vrf) + return; TAILQ_FOREACH(bso, &bglobal.bg_obslist, bso_entry) { bs = bso->bso_bs; @@ -581,9 +584,6 @@ static void bfdd_sessions_enable_interface(struct interface *ifp) /* Interface name mismatch. */ if (strcmp(ifp->name, bs->key.ifname)) continue; - vrf = vrf_lookup_by_id(ifp->vrf_id); - if (!vrf) - continue; if (bs->key.vrfname[0] && strcmp(vrf->name, bs->key.vrfname)) continue; |