diff options
Diffstat (limited to 'usr.sbin/rtadvd/rtadvd.c')
-rw-r--r-- | usr.sbin/rtadvd/rtadvd.c | 41 |
1 files changed, 14 insertions, 27 deletions
diff --git a/usr.sbin/rtadvd/rtadvd.c b/usr.sbin/rtadvd/rtadvd.c index 5d7a3eb..cecda2b 100644 --- a/usr.sbin/rtadvd/rtadvd.c +++ b/usr.sbin/rtadvd/rtadvd.c @@ -73,7 +73,7 @@ static int do_die; struct msghdr sndmhdr; struct iovec rcviov[2]; struct iovec sndiov[2]; -struct sockaddr_in6 from; +struct sockaddr_in6 rcvfrom; struct sockaddr_in6 sin6_allnodes = {sizeof(sin6_allnodes), AF_INET6}; struct in6_addr in6a_site_allrouters; static char *dumpfilename = "/var/run/rtadvd.dump"; /* XXX: should be configurable */ @@ -647,7 +647,7 @@ rtadvd_input() "<%s> RS with invalid hop limit(%d) " "received from %s on %s", __func__, *hlimp, - inet_ntop(AF_INET6, &from.sin6_addr, ntopbuf, + inet_ntop(AF_INET6, &rcvfrom.sin6_addr, ntopbuf, INET6_ADDRSTRLEN), if_indextoname(pi->ipi6_ifindex, ifnamebuf)); return; @@ -657,7 +657,7 @@ rtadvd_input() "<%s> RS with invalid ICMP6 code(%d) " "received from %s on %s", __func__, icp->icmp6_code, - inet_ntop(AF_INET6, &from.sin6_addr, ntopbuf, + inet_ntop(AF_INET6, &rcvfrom.sin6_addr, ntopbuf, INET6_ADDRSTRLEN), if_indextoname(pi->ipi6_ifindex, ifnamebuf)); return; @@ -667,12 +667,12 @@ rtadvd_input() "<%s> RS from %s on %s does not have enough " "length (len = %d)", __func__, - inet_ntop(AF_INET6, &from.sin6_addr, ntopbuf, + inet_ntop(AF_INET6, &rcvfrom.sin6_addr, ntopbuf, INET6_ADDRSTRLEN), if_indextoname(pi->ipi6_ifindex, ifnamebuf), i); return; } - rs_input(i, (struct nd_router_solicit *)icp, pi, &from); + rs_input(i, (struct nd_router_solicit *)icp, pi, &rcvfrom); break; case ND_ROUTER_ADVERT: /* @@ -684,7 +684,7 @@ rtadvd_input() "<%s> RA with invalid hop limit(%d) " "received from %s on %s", __func__, *hlimp, - inet_ntop(AF_INET6, &from.sin6_addr, ntopbuf, + inet_ntop(AF_INET6, &rcvfrom.sin6_addr, ntopbuf, INET6_ADDRSTRLEN), if_indextoname(pi->ipi6_ifindex, ifnamebuf)); return; @@ -694,7 +694,7 @@ rtadvd_input() "<%s> RA with invalid ICMP6 code(%d) " "received from %s on %s", __func__, icp->icmp6_code, - inet_ntop(AF_INET6, &from.sin6_addr, ntopbuf, + inet_ntop(AF_INET6, &rcvfrom.sin6_addr, ntopbuf, INET6_ADDRSTRLEN), if_indextoname(pi->ipi6_ifindex, ifnamebuf)); return; @@ -704,12 +704,12 @@ rtadvd_input() "<%s> RA from %s on %s does not have enough " "length (len = %d)", __func__, - inet_ntop(AF_INET6, &from.sin6_addr, ntopbuf, + inet_ntop(AF_INET6, &rcvfrom.sin6_addr, ntopbuf, INET6_ADDRSTRLEN), if_indextoname(pi->ipi6_ifindex, ifnamebuf), i); return; } - ra_input(i, (struct nd_router_advert *)icp, pi, &from); + ra_input(i, (struct nd_router_advert *)icp, pi, &rcvfrom); break; case ICMP6_ROUTER_RENUMBERING: if (accept_rr == 0) { @@ -718,7 +718,7 @@ rtadvd_input() __func__); break; } - rr_input(i, (struct icmp6_router_renum *)icp, pi, &from, + rr_input(i, (struct icmp6_router_renum *)icp, pi, &rcvfrom, &dst); break; default: @@ -1441,8 +1441,8 @@ sock_open() /* initialize msghdr for receiving packets */ rcviov[0].iov_base = (caddr_t)answer; rcviov[0].iov_len = sizeof(answer); - rcvmhdr.msg_name = (caddr_t)&from; - rcvmhdr.msg_namelen = sizeof(from); + rcvmhdr.msg_name = (caddr_t)&rcvfrom; + rcvmhdr.msg_namelen = sizeof(rcvfrom); rcvmhdr.msg_iov = rcviov; rcvmhdr.msg_iovlen = 1; rcvmhdr.msg_control = (caddr_t) rcvcmsgbuf; @@ -1470,12 +1470,12 @@ rtsock_open() } struct rainfo * -if_indextorainfo(int index) +if_indextorainfo(int idx) { struct rainfo *rai = ralist; for (rai = ralist; rai; rai = rai->next) { - if (rai->ifindex == index) + if (rai->ifindex == idx) return(rai); } @@ -1545,19 +1545,6 @@ struct rainfo *rainfo; for (sol = rainfo->soliciter; sol; sol = nextsol) { nextsol = sol->next; -#if 0 - sndmhdr.msg_name = (caddr_t)&sol->addr; - i = sendmsg(sock, &sndmhdr, 0); - if (i < 0 || i != rainfo->ra_datalen) { - if (i < 0) { - syslog(LOG_ERR, - "<%s> unicast sendmsg on %s: %s", - __func__, rainfo->ifname, - strerror(errno)); - } - } -#endif - sol->next = NULL; free(sol); } |