]> git.proxmox.com Git - mirror_frr.git/commitdiff
pimd: Refactor pim_sock_open to just need the ifp pointer
authorDonald Sharp <sharpd@cumulusnetworks.com>
Fri, 3 Feb 2017 17:37:39 +0000 (12:37 -0500)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Fri, 3 Feb 2017 17:37:39 +0000 (12:37 -0500)
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 <sharpd@cumulusnetworks.com>
pimd/pim_pim.c

index 963b5c233d7b0a3eeba4e221d6237cb7e1b428ea..f727d3e6275f5931c702a714c23e3391f5783b0c 100644 (file)
@@ -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",