From: Thibaut Collet Date: Thu, 30 Aug 2018 14:06:03 +0000 (+0200) Subject: lib/if.c: fix CLANG warning X-Git-Tag: frr-7.1-dev~373^2~1 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=379eb245f649f04e2ceed0c577bed919dfebd5f6;p=mirror%2Ffrr.git lib/if.c: fix CLANG warning Fix CLANG warning: Report for if.c | 2 issues =============================================== < WARNING: else is not generally useful after a break or return < #390: FILE: /tmp/f1-28557/if.c:390: Signed-off-by: Thibaut Collet --- diff --git a/lib/if.c b/lib/if.c index c630dd140a..25da7a8188 100644 --- a/lib/if.c +++ b/lib/if.c @@ -387,31 +387,31 @@ struct interface *if_get_by_name(const char *name, vrf_id_t vrf_id, int vty) return NULL; } return if_create(name, vrf_id); - } else { - ifp = if_lookup_by_name_all_vrf(name); - if (ifp) { - if (ifp->vrf_id == vrf_id) - return ifp; - /* Found a match on a different VRF. If the interface - * command was entered in vty without a VRF (passed as - * VRF_DEFAULT), accept the ifp we found. If a vrf was - * entered and there is a mismatch, reject it if from - * vty. If it came from the kernel or by way of zclient, - * believe it and update the ifp accordingly. - */ - if (vty) { - if (vrf_id == VRF_DEFAULT) - return ifp; - return NULL; - } - /* If it came from the kernel or by way of zclient, - * believe it and update the ifp accordingly. - */ - if_update_to_new_vrf(ifp, vrf_id); + } + /* vrf is based on vrf-lite */ + ifp = if_lookup_by_name_all_vrf(name); + if (ifp) { + if (ifp->vrf_id == vrf_id) return ifp; + /* Found a match on a different VRF. If the interface command + * was entered in vty without a VRF (passed as VRF_DEFAULT), + * accept the ifp we found. If a vrf was entered and there is a + * mismatch, reject it if from vty. If it came from the kernel + * or by way of zclient, believe it and update the ifp + * accordingly. + */ + if (vty) { + if (vrf_id == VRF_DEFAULT) + return ifp; + return NULL; } - return if_create(name, vrf_id); + /* If it came from the kernel or by way of zclient, believe it + * and update the ifp accordingly. + */ + if_update_to_new_vrf(ifp, vrf_id); + return ifp; } + return if_create(name, vrf_id); } void if_set_index(struct interface *ifp, ifindex_t ifindex)