]> git.puffer.fish Git - mirror/frr.git/commitdiff
zebra: improve identification of loopback interfaces in the router-id code 3356/head
authorRenato Westphal <renato@opensourcerouting.org>
Sat, 17 Nov 2018 23:33:37 +0000 (21:33 -0200)
committerRenato Westphal <renato@opensourcerouting.org>
Sat, 17 Nov 2018 23:33:37 +0000 (21:33 -0200)
The if_is_loopback() function is the right abstraction for identifying
loopback interfaces. There should be no reason for not using it in the
router-id code.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
zebra/router-id.c

index 3b96b3371dde4464d985ef404918c9443c593835..c500f79a6c2c0a275ebbf48ef6798dfad96e8fbd 100644 (file)
@@ -132,8 +132,7 @@ void router_id_add_address(struct connected *ifc)
 
        router_id_get(&before, zvrf_id(zvrf));
 
-       if (!strncmp(ifc->ifp->name, "lo", 2)
-           || !strncmp(ifc->ifp->name, "dummy", 5))
+       if (if_is_loopback(ifc->ifp))
                l = zvrf->rid_lo_sorted_list;
        else
                l = zvrf->rid_all_sorted_list;
@@ -165,8 +164,7 @@ void router_id_del_address(struct connected *ifc)
 
        router_id_get(&before, zvrf_id(zvrf));
 
-       if (!strncmp(ifc->ifp->name, "lo", 2)
-           || !strncmp(ifc->ifp->name, "dummy", 5))
+       if (if_is_loopback(ifc->ifp))
                l = zvrf->rid_lo_sorted_list;
        else
                l = zvrf->rid_all_sorted_list;