From e5dfe687844ac39d0a2b113918b997866a810ca9 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Fri, 3 Feb 2017 12:37:39 -0500 Subject: [PATCH] pimd: Refactor pim_sock_open to just need the ifp pointer In all cases pim_sock_open was called, we just passed in the pim_ifp->primary_address, which is accessible from the interface pointer. So just pass that in. Signed-off-by: Donald Sharp --- pimd/pim_pim.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/pimd/pim_pim.c b/pimd/pim_pim.c index 963b5c233d..f727d3e627 100644 --- a/pimd/pim_pim.c +++ b/pimd/pim_pim.c @@ -389,15 +389,16 @@ static void pim_sock_read_on(struct interface *ifp) pim_ifp->pim_sock_fd); } -static int pim_sock_open(struct in_addr ifaddr, struct interface *ifp) +static int pim_sock_open(struct interface *ifp) { int fd; + struct pim_interface *pim_ifp = ifp->info; - fd = pim_socket_mcast(IPPROTO_PIM, ifaddr, ifp, 0 /* loop=false */); + fd = pim_socket_mcast(IPPROTO_PIM, pim_ifp->primary_address, ifp, 0 /* loop=false */); if (fd < 0) return -1; - if (pim_socket_join(fd, qpim_all_pim_routers_addr, ifaddr, ifp->ifindex)) { + if (pim_socket_join(fd, qpim_all_pim_routers_addr, pim_ifp->primary_address, ifp->ifindex)) { close(fd); return -2; } @@ -793,7 +794,6 @@ void pim_hello_restart_triggered(struct interface *ifp) int pim_sock_add(struct interface *ifp) { struct pim_interface *pim_ifp; - struct in_addr ifaddr; uint32_t old_genid; pim_ifp = ifp->info; @@ -806,9 +806,7 @@ int pim_sock_add(struct interface *ifp) return -1; } - ifaddr = pim_ifp->primary_address; - - pim_ifp->pim_sock_fd = pim_sock_open(ifaddr, ifp); + pim_ifp->pim_sock_fd = pim_sock_open(ifp); if (pim_ifp->pim_sock_fd < 0) { if (PIM_DEBUG_PIM_PACKETS) zlog_debug("Could not open PIM socket on interface %s", -- 2.39.5