diff options
| -rw-r--r-- | pimd/pim_igmp.c | 12 | ||||
| -rw-r--r-- | pimd/pim_pim.c | 8 | ||||
| -rw-r--r-- | pimd/pim_sock.c | 7 | ||||
| -rw-r--r-- | pimd/pim_sock.h | 2 | 
4 files changed, 13 insertions, 16 deletions
diff --git a/pimd/pim_igmp.c b/pimd/pim_igmp.c index 4a23e4f668..24b9e54ea5 100644 --- a/pimd/pim_igmp.c +++ b/pimd/pim_igmp.c @@ -41,20 +41,20 @@ static void group_timer_off(struct igmp_group *group);  /* This socket is used for TXing IGMP packets only, IGMP RX happens   * in pim_mroute_msg()   */ -static int igmp_sock_open(struct in_addr ifaddr, ifindex_t ifindex, uint32_t pim_options) +static int igmp_sock_open(struct in_addr ifaddr, struct interface *ifp, uint32_t pim_options)  {    int fd;    int join = 0;    struct in_addr group; -  fd = pim_socket_mcast(IPPROTO_IGMP, ifaddr, ifindex, 1); +  fd = pim_socket_mcast(IPPROTO_IGMP, ifaddr, ifp, 1);    if (fd < 0)      return -1;    if (PIM_IF_TEST_IGMP_LISTEN_ALLROUTERS(pim_options)) {      if (inet_aton(PIM_ALL_ROUTERS, &group)) { -      if (!pim_socket_join(fd, group, ifaddr, ifindex)) +      if (!pim_socket_join(fd, group, ifaddr, ifp->ifindex))         ++join;      }      else { @@ -69,7 +69,7 @@ static int igmp_sock_open(struct in_addr ifaddr, ifindex_t ifindex, uint32_t pim      IGMP routers must receive general queries for querier election.    */    if (inet_aton(PIM_ALL_SYSTEMS, &group)) { -    if (!pim_socket_join(fd, group, ifaddr, ifindex)) +    if (!pim_socket_join(fd, group, ifaddr, ifp->ifindex))        ++join;    }    else { @@ -79,7 +79,7 @@ static int igmp_sock_open(struct in_addr ifaddr, ifindex_t ifindex, uint32_t pim    }    if (inet_aton(PIM_ALL_IGMP_ROUTERS, &group)) { -    if (!pim_socket_join(fd, group, ifaddr, ifindex)) { +    if (!pim_socket_join(fd, group, ifaddr, ifp->ifindex)) {        ++join;      }    } @@ -901,7 +901,7 @@ struct igmp_sock *pim_igmp_sock_add(struct list *igmp_sock_list,    pim_ifp = ifp->info; -  fd = igmp_sock_open(ifaddr, ifp->ifindex, pim_ifp->options); +  fd = igmp_sock_open(ifaddr, ifp, pim_ifp->options);    if (fd < 0) {      zlog_warn("Could not open IGMP socket for %s on %s",  	      inet_ntoa(ifaddr), ifp->name); diff --git a/pimd/pim_pim.c b/pimd/pim_pim.c index 1dbbd7c655..963b5c233d 100644 --- a/pimd/pim_pim.c +++ b/pimd/pim_pim.c @@ -389,15 +389,15 @@ static void pim_sock_read_on(struct interface *ifp)  		 pim_ifp->pim_sock_fd);  } -static int pim_sock_open(struct in_addr ifaddr, ifindex_t ifindex) +static int pim_sock_open(struct in_addr ifaddr, struct interface *ifp)  {    int fd; -  fd = pim_socket_mcast(IPPROTO_PIM, ifaddr, ifindex, 0 /* loop=false */); +  fd = pim_socket_mcast(IPPROTO_PIM, ifaddr, ifp, 0 /* loop=false */);    if (fd < 0)      return -1; -  if (pim_socket_join(fd, qpim_all_pim_routers_addr, ifaddr, ifindex)) { +  if (pim_socket_join(fd, qpim_all_pim_routers_addr, ifaddr, ifp->ifindex)) {      close(fd);      return -2;    } @@ -808,7 +808,7 @@ int pim_sock_add(struct interface *ifp)    ifaddr = pim_ifp->primary_address; -  pim_ifp->pim_sock_fd = pim_sock_open(ifaddr, ifp->ifindex); +  pim_ifp->pim_sock_fd = pim_sock_open(ifaddr, ifp);    if (pim_ifp->pim_sock_fd < 0) {      if (PIM_DEBUG_PIM_PACKETS)        zlog_debug("Could not open PIM socket on interface %s", diff --git a/pimd/pim_sock.c b/pimd/pim_sock.c index 11cd61b592..6e7837af44 100644 --- a/pimd/pim_sock.c +++ b/pimd/pim_sock.c @@ -111,7 +111,7 @@ pim_socket_bind (int fd, struct interface *ifp)    return ret;  } -int pim_socket_mcast(int protocol, struct in_addr ifaddr, int ifindex, u_char loop) +int pim_socket_mcast(int protocol, struct in_addr ifaddr, struct interface *ifp, u_char loop)  {    int rcvbuf = 1024 * 1024 * 8;  #ifdef HAVE_STRUCT_IP_MREQN_IMR_IFINDEX @@ -132,9 +132,6 @@ int pim_socket_mcast(int protocol, struct in_addr ifaddr, int ifindex, u_char lo    if (protocol == IPPROTO_PIM)      {        int ret; -      struct interface *ifp = NULL; - -      ifp = if_lookup_by_index_vrf (ifindex, VRF_DEFAULT);        ret = pim_socket_bind (fd, ifp);        if (ret) @@ -222,7 +219,7 @@ int pim_socket_mcast(int protocol, struct in_addr ifaddr, int ifindex, u_char lo    memset (&mreq, 0, sizeof (mreq));  #ifdef HAVE_STRUCT_IP_MREQN_IMR_IFINDEX -  mreq.imr_ifindex = ifindex; +  mreq.imr_ifindex = ifp->ifindex;  #else    /*     * I am not sure what to do here yet for *BSD diff --git a/pimd/pim_sock.h b/pimd/pim_sock.h index aaf82e862a..b4ce901d10 100644 --- a/pimd/pim_sock.h +++ b/pimd/pim_sock.h @@ -39,7 +39,7 @@  int pim_socket_bind (int fd, struct interface *ifp);  int pim_socket_ip_hdr (int fd);  int pim_socket_raw(int protocol); -int pim_socket_mcast(int protocol, struct in_addr ifaddr, int ifindex, u_char loop); +int pim_socket_mcast(int protocol, struct in_addr ifaddr, struct interface *ifp, u_char loop);  int pim_socket_join(int fd, struct in_addr group,  		    struct in_addr ifaddr, ifindex_t ifindex);  int pim_socket_join_source(int fd, ifindex_t ifindex,  | 
