]> git.puffer.fish Git - matthieu/frr.git/commitdiff
isisd: remove unnecessary null checks
authorRenato Westphal <renato@opensourcerouting.org>
Tue, 6 Aug 2019 20:18:41 +0000 (17:18 -0300)
committerRenato Westphal <renato@opensourcerouting.org>
Wed, 21 Aug 2019 03:57:17 +0000 (00:57 -0300)
These null checks don't make sense because a) these two functions
are never called with a NULL IP address and b) the same pointers are
dereferenced later without any protection. Remove these NULL checks
to make the code less confusing.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
isisd/isis_route.c

index 238555d15488b4100ddc263d3d3b0e26668df32a..7059fdb63b2659c1b9af5c0e960c7f520ced6027 100644 (file)
@@ -57,7 +57,7 @@ static struct isis_nexthop *isis_nexthop_create(struct in_addr *ip,
        for (ALL_LIST_ELEMENTS_RO(isis->nexthops, node, nexthop)) {
                if (nexthop->ifindex != ifindex)
                        continue;
-               if (ip && memcmp(&nexthop->ip, ip, sizeof(struct in_addr)) != 0)
+               if (memcmp(&nexthop->ip, ip, sizeof(struct in_addr)) != 0)
                        continue;
 
                nexthop->lock++;
@@ -123,9 +123,7 @@ static struct isis_nexthop6 *isis_nexthop6_create(struct in6_addr *ip6,
        for (ALL_LIST_ELEMENTS_RO(isis->nexthops6, node, nexthop6)) {
                if (nexthop6->ifindex != ifindex)
                        continue;
-               if (ip6
-                   && memcmp(&nexthop6->ip6, ip6, sizeof(struct in6_addr))
-                              != 0)
+               if (memcmp(&nexthop6->ip6, ip6, sizeof(struct in6_addr)) != 0)
                        continue;
 
                nexthop6->lock++;