diff options
| author | Thibaut Collet <thibaut.collet@6wind.com> | 2018-08-30 16:06:03 +0200 |
|---|---|---|
| committer | Thibaut Collet <thibaut.collet@6wind.com> | 2018-08-30 16:29:06 +0200 |
| commit | 379eb245f649f04e2ceed0c577bed919dfebd5f6 (patch) | |
| tree | 7a09a940229c1096cbb3a1d80a84a05612b2f978 /lib/if.c | |
| parent | ee2f2c23ca2778feafa398e773d24da07d6f174e (diff) | |
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 <thibaut.collet@6wind.com>
Diffstat (limited to 'lib/if.c')
| -rw-r--r-- | lib/if.c | 44 |
1 files changed, 22 insertions, 22 deletions
@@ -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) |
