]> git.puffer.fish Git - mirror/frr.git/commitdiff
lib/if.c: fix CLANG warning
authorThibaut Collet <thibaut.collet@6wind.com>
Thu, 30 Aug 2018 14:06:03 +0000 (16:06 +0200)
committerThibaut Collet <thibaut.collet@6wind.com>
Thu, 30 Aug 2018 14:29:06 +0000 (16:29 +0200)
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>
lib/if.c

index c630dd140ac6cdd622c41927dbd86d61d27d26af..25da7a8188dd93fa70a54221276a2a681b1e2415 100644 (file)
--- 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)