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 /zebra/ioctl.c | |
| parent | da85f5e03899ee53e235ef5eb6cdacc1ae85de86 (diff) | |
*: 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/ioctl.c')
| -rw-r--r-- | zebra/ioctl.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/zebra/ioctl.c b/zebra/ioctl.c index 8202e076af..628be6563a 100644 --- a/zebra/ioctl.c +++ b/zebra/ioctl.c @@ -142,7 +142,8 @@ void if_get_metric(struct interface *ifp) ifreq_set_name(&ifreq, ifp); - if (vrf_if_ioctl(SIOCGIFMETRIC, (caddr_t)&ifreq, ifp->vrf_id) < 0) + if (vrf_if_ioctl(SIOCGIFMETRIC, (caddr_t)&ifreq, + vrf_to_id(ifp->vrf)) < 0) return; ifp->metric = ifreq.ifr_metric; if (ifp->metric == 0) @@ -160,7 +161,8 @@ void if_get_mtu(struct interface *ifp) ifreq_set_name(&ifreq, ifp); #if defined(SIOCGIFMTU) - if (vrf_if_ioctl(SIOCGIFMTU, (caddr_t)&ifreq, ifp->vrf_id) < 0) { + if (vrf_if_ioctl(SIOCGIFMTU, (caddr_t)&ifreq, + vrf_to_id(ifp->vrf)) < 0) { zlog_info("Can't lookup mtu by ioctl(SIOCGIFMTU)"); ifp->mtu6 = ifp->mtu = -1; return; @@ -427,7 +429,7 @@ void if_get_flags(struct interface *ifp) ifreq_set_name(&ifreq, ifp); - ret = vrf_if_ioctl(SIOCGIFFLAGS, (caddr_t)&ifreq, ifp->vrf_id); + ret = vrf_if_ioctl(SIOCGIFFLAGS, (caddr_t)&ifreq, vrf_to_id(ifp->vrf)); if (ret < 0) { flog_err_sys(EC_LIB_SYSTEM_CALL, "vrf_if_ioctl(SIOCGIFFLAGS) failed: %s", @@ -477,7 +479,7 @@ int if_set_flags(struct interface *ifp, uint64_t flags) ifreq.ifr_flags = ifp->flags; ifreq.ifr_flags |= flags; - ret = vrf_if_ioctl(SIOCSIFFLAGS, (caddr_t)&ifreq, ifp->vrf_id); + ret = vrf_if_ioctl(SIOCSIFFLAGS, (caddr_t)&ifreq, vrf_to_id(ifp->vrf)); if (ret < 0) { zlog_info("can't set interface flags"); @@ -498,7 +500,7 @@ int if_unset_flags(struct interface *ifp, uint64_t flags) ifreq.ifr_flags = ifp->flags; ifreq.ifr_flags &= ~flags; - ret = vrf_if_ioctl(SIOCSIFFLAGS, (caddr_t)&ifreq, ifp->vrf_id); + ret = vrf_if_ioctl(SIOCSIFFLAGS, (caddr_t)&ifreq, vrf_to_id(ifp->vrf)); if (ret < 0) { zlog_info("can't unset interface flags"); |
