diff options
Diffstat (limited to 'pimd/pim_pim.c')
| -rw-r--r-- | pimd/pim_pim.c | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/pimd/pim_pim.c b/pimd/pim_pim.c index 93ccfd78df..616cad16c6 100644 --- a/pimd/pim_pim.c +++ b/pimd/pim_pim.c @@ -42,7 +42,7 @@ #include "pim_errors.h" #include "pim_bsm.h" -static int on_pim_hello_send(struct thread *t); +static void on_pim_hello_send(struct thread *t); static const char *pim_pim_msgtype2str(enum pim_msg_type type) { @@ -326,13 +326,13 @@ int pim_pim_packet(struct interface *ifp, uint8_t *buf, size_t len) static void pim_sock_read_on(struct interface *ifp); -static int pim_sock_read(struct thread *t) +static void pim_sock_read(struct thread *t) { struct interface *ifp, *orig_ifp; struct pim_interface *pim_ifp; int fd; - struct sockaddr_in from; - struct sockaddr_in to; + struct sockaddr_storage from; + struct sockaddr_storage to; socklen_t fromlen = sizeof(from); socklen_t tolen = sizeof(to); uint8_t buf[PIM_PIM_BUFSIZE_READ]; @@ -398,8 +398,6 @@ done: if (result) { ++pim_ifp->pim_ifstat_hello_recvfail; } - - return result; } static void pim_sock_read_on(struct interface *ifp) @@ -430,7 +428,7 @@ static int pim_sock_open(struct interface *ifp) return -1; if (pim_socket_join(fd, qpim_all_pim_routers_addr, - pim_ifp->primary_address, ifp->ifindex)) { + pim_ifp->primary_address, ifp->ifindex, pim_ifp)) { close(fd); return -2; } @@ -469,6 +467,8 @@ void pim_ifstat_reset(struct interface *ifp) pim_ifp->pim_ifstat_bsm_cfg_miss = 0; pim_ifp->pim_ifstat_ucast_bsm_cfg_miss = 0; pim_ifp->pim_ifstat_bsm_invalid_sz = 0; + pim_ifp->igmp_ifstat_joins_sent = 0; + pim_ifp->igmp_ifstat_joins_failed = 0; } void pim_sock_reset(struct interface *ifp) @@ -523,7 +523,8 @@ static uint16_t ip_id = 0; static int pim_msg_send_frame(int fd, char *buf, size_t len, - struct sockaddr *dst, size_t salen) + struct sockaddr *dst, size_t salen, + const char *ifname) { struct ip *ip = (struct ip *)buf; @@ -539,8 +540,8 @@ static int pim_msg_send_frame(int fd, char *buf, size_t len, ip->ip_len = htons(sendlen); ip->ip_off = htons(offset | IP_MF); - if (pim_msg_send_frame(fd, buf, sendlen, dst, salen) - == 0) { + if (pim_msg_send_frame(fd, buf, sendlen, dst, salen, + ifname) == 0) { struct ip *ip2 = (struct ip *)(buf + newlen1); size_t newlen2 = len - sendlen; sendlen = newlen2 + hdrsize; @@ -549,7 +550,8 @@ static int pim_msg_send_frame(int fd, char *buf, size_t len, ip2->ip_len = htons(sendlen); ip2->ip_off = htons(offset + (newlen1 >> 3)); return pim_msg_send_frame(fd, (char *)ip2, - sendlen, dst, salen); + sendlen, dst, salen, + ifname); } } @@ -559,9 +561,9 @@ static int pim_msg_send_frame(int fd, char *buf, size_t len, pim_inet4_dump("<dst?>", ip->ip_dst, dst_str, sizeof(dst_str)); zlog_warn( - "%s: sendto() failure to %s: fd=%d msg_size=%zd: errno=%d: %s", - __func__, dst_str, fd, len, errno, - safe_strerror(errno)); + "%s: sendto() failure to %s: iface=%s fd=%d msg_size=%zd: errno=%d: %s", + __func__, dst_str, ifname, fd, len, + errno, safe_strerror(errno)); } return -1; } @@ -643,7 +645,7 @@ int pim_msg_send(int fd, pim_addr src, pim_addr dst, uint8_t *pim_msg, } pim_msg_send_frame(fd, (char *)buffer, sendlen, (struct sockaddr *)&to, - tolen); + tolen, ifname); return 0; } @@ -745,7 +747,7 @@ static void hello_resched(struct interface *ifp) /* Periodic hello timer */ -static int on_pim_hello_send(struct thread *t) +static void on_pim_hello_send(struct thread *t) { struct pim_interface *pim_ifp; struct interface *ifp; @@ -761,7 +763,7 @@ static int on_pim_hello_send(struct thread *t) /* * Send hello */ - return pim_hello_send(ifp, PIM_IF_DEFAULT_HOLDTIME(pim_ifp)); + pim_hello_send(ifp, PIM_IF_DEFAULT_HOLDTIME(pim_ifp)); } /* |
