diff options
author | Christophe Gouault <christophe.gouault@6wind.com> | 2020-08-26 16:26:49 +0200 |
---|---|---|
committer | Christophe Gouault <christophe.gouault@6wind.com> | 2020-09-21 10:07:56 +0200 |
commit | 7c1119cb7a1c66028d5487ff66682383244f987d (patch) | |
tree | b41faebe98e5456ba6a1cf4c19594d9aa0c95773 /lib | |
parent | zebra: fix show ip route output (diff) | |
download | frr-7c1119cb7a1c66028d5487ff66682383244f987d.tar.xz frr-7c1119cb7a1c66028d5487ff66682383244f987d.zip |
lib: optimize vrf_id_to_name(VRF_DEFAULT) case
vrf_id_to_name() looks up in a RB_TREE to find the VRF entry, then
reads the name.
Avoid it for VRF_DEFAULT, which always exists and for which the
translation is straightforward.
Signed-off-by: Christophe Gouault <christophe.gouault@6wind.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/vrf.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -331,6 +331,9 @@ const char *vrf_id_to_name(vrf_id_t vrf_id) { struct vrf *vrf; + if (vrf_id == VRF_DEFAULT) + return VRF_DEFAULT_NAME; + vrf = vrf_lookup_by_id(vrf_id); return VRF_LOGNAME(vrf); } |