diff options
author | Mobashshera Rasool <mrasool@vmware.com> | 2022-08-01 08:37:56 +0200 |
---|---|---|
committer | Mobashshera Rasool <mrasool@vmware.com> | 2022-08-01 08:43:28 +0200 |
commit | 0c7f978ec94053246ba30dc0d57066d0df9ad2c4 (patch) | |
tree | 0370bcce10c32648376f01a50ed535712ec49e75 /pimd/pim_iface.c | |
parent | Merge pull request #11707 from kuldeepkash/pim_v6 (diff) | |
download | frr-0c7f978ec94053246ba30dc0d57066d0df9ad2c4.tar.xz frr-0c7f978ec94053246ba30dc0d57066d0df9ad2c4.zip |
pimd: Simply the code a bit, reduce code complexity
Combine all the if conditions in api pim_if_addr_add_all to
reduce nested loops.
Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
Diffstat (limited to 'pimd/pim_iface.c')
-rw-r--r-- | pimd/pim_iface.c | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/pimd/pim_iface.c b/pimd/pim_iface.c index 20a5a2f52..0fb5e8c6d 100644 --- a/pimd/pim_iface.c +++ b/pimd/pim_iface.c @@ -801,22 +801,13 @@ void pim_if_addr_add_all(struct interface *ifp) pim_if_addr_add(ifc); } - if (!v4_addrs && v6_addrs && !if_is_loopback(ifp)) { - if (pim_ifp->pim_enable) { - - /* Interface has a valid primary address ? */ - if (!pim_addr_is_any(pim_ifp->primary_address)) { - - /* Interface has a valid socket ? */ - if (pim_ifp->pim_sock_fd < 0) { - if (pim_sock_add(ifp)) { - zlog_warn( - "Failure creating PIM socket for interface %s", - ifp->name); - } - } - } - } /* pim */ + if (!v4_addrs && v6_addrs && !if_is_loopback(ifp) && + pim_ifp->pim_enable && !pim_addr_is_any(pim_ifp->primary_address) && + pim_ifp->pim_sock_fd < 0 && pim_sock_add(ifp)) { + /* Interface has a valid primary address ? */ + /* Interface has a valid socket ? */ + zlog_warn("Failure creating PIM socket for interface %s", + ifp->name); } /* * PIM or IGMP is enabled on interface, and there is at least one |