Index: boot/common/dev_net.c =================================================================== RCS file: /home/ncvs/src/sys/boot/common/dev_net.c,v retrieving revision 1.15 diff -u -r1.15 dev_net.c --- boot/common/dev_net.c 8 Jul 2004 22:35:33 -0000 1.15 +++ boot/common/dev_net.c 24 Oct 2006 02:57:29 -0000 @@ -211,10 +211,13 @@ { char buf[MAXHOSTNAMELEN]; char temp[FNAME_SIZE]; + char ipbuf[4 * sizeof "123"]; struct iodesc *d; int i; n_long smask; + ipbuf[0] = '\0'; + #ifdef SUPPORT_BOOTP /* * Try to get boot info using BOOTP. If we succeed, then @@ -238,7 +241,7 @@ printf("net_open: RARP failed\n"); return (EIO); } - printf("net_open: client addr: %s\n", inet_ntoa(myip)); + printf("net_open: client addr: %s\n", inet_ntoa_r(myip, ipbuf)); /* Get our hostname, server IP address, gateway. */ if (bp_whoami(sock)) { @@ -262,7 +265,7 @@ printf("net_open: subnet mask: %s\n", intoa(netmask)); } if (gateip.s_addr) - printf("net_open: net gateway: %s\n", inet_ntoa(gateip)); + printf("net_open: net gateway: %s\n", inet_ntoa_r(gateip, ipbuf)); /* Get the root server and pathname. */ if (bp_getfile(sock, "root", &rootip, rootpath)) { @@ -285,16 +288,16 @@ bcopy(&rootpath[i], &temp[0], strlen(&rootpath[i])+1); bcopy(&temp[0], &rootpath[0], strlen(&rootpath[i])+1); } - printf("net_open: server addr: %s\n", inet_ntoa(rootip)); + printf("net_open: server addr: %s\n", inet_ntoa_r(rootip, ipbuf)); printf("net_open: server path: %s\n", rootpath); d = socktodesc(sock); sprintf(temp, "%6D", d->myea, ":"); - setenv("boot.netif.ip", inet_ntoa(myip), 1); + setenv("boot.netif.ip", inet_ntoa_r(myip, ipbuf), 1); setenv("boot.netif.netmask", intoa(netmask), 1); - setenv("boot.netif.gateway", inet_ntoa(gateip), 1); + setenv("boot.netif.gateway", inet_ntoa_r(gateip, ipbuf), 1); setenv("boot.netif.hwaddr", temp, 1); - setenv("boot.nfsroot.server", inet_ntoa(rootip), 1); + setenv("boot.nfsroot.server", inet_ntoa_r(rootip, ipbuf), 1); setenv("boot.nfsroot.path", rootpath, 1); return (0); Index: boot/i386/libi386/pxe.c =================================================================== RCS file: /home/ncvs/src/sys/boot/i386/libi386/pxe.c,v retrieving revision 1.22 diff -u -r1.22 pxe.c --- boot/i386/libi386/pxe.c 17 Apr 2005 21:38:22 -0000 1.22 +++ boot/i386/libi386/pxe.c 24 Oct 2006 02:57:29 -0000 @@ -253,9 +253,12 @@ va_list args; char *devname; /* Device part of file name (or NULL). */ char temp[FNAME_SIZE]; + char ipbuf[4 * sizeof "123"]; int error = 0; int i; + ipbuf[0] = '\0'; + va_start(args, f); devname = va_arg(args, char*); va_end(args); @@ -295,18 +298,18 @@ bcopy(&rootpath[i], &temp[0], strlen(&rootpath[i])+1); bcopy(&temp[0], &rootpath[0], strlen(&rootpath[i])+1); } - printf("pxe_open: server addr: %s\n", inet_ntoa(rootip)); + printf("pxe_open: server addr: %s\n", inet_ntoa_r(rootip, ipbuf)); printf("pxe_open: server path: %s\n", rootpath); - printf("pxe_open: gateway ip: %s\n", inet_ntoa(gateip)); + printf("pxe_open: gateway ip: %s\n", inet_ntoa_r(gateip, ipbuf)); - setenv("boot.netif.ip", inet_ntoa(myip), 1); + setenv("boot.netif.ip", inet_ntoa_r(myip, ipbuf), 1); setenv("boot.netif.netmask", intoa(netmask), 1); - setenv("boot.netif.gateway", inet_ntoa(gateip), 1); + setenv("boot.netif.gateway", inet_ntoa_r(gateip, ipbuf), 1); if (bootplayer.Hardware == ETHER_TYPE) { sprintf(temp, "%6D", bootplayer.CAddr, ":"); setenv("boot.netif.hwaddr", temp, 1); } - setenv("boot.nfsroot.server", inet_ntoa(rootip), 1); + setenv("boot.nfsroot.server", inet_ntoa_r(rootip, ipbuf), 1); setenv("boot.nfsroot.path", rootpath, 1); setenv("dhcp.host-name", hostname, 1); } Index: contrib/pf/net/pf_osfp.c =================================================================== RCS file: /home/ncvs/src/sys/contrib/pf/net/pf_osfp.c,v retrieving revision 1.5 diff -u -r1.5 pf_osfp.c --- contrib/pf/net/pf_osfp.c 3 May 2005 16:43:32 -0000 1.5 +++ contrib/pf/net/pf_osfp.c 24 Oct 2006 02:57:29 -0000 @@ -113,10 +113,13 @@ struct pf_osfp_enlist * pf_osfp_fingerprint_hdr(const struct ip *ip, const struct tcphdr *tcp) { + char ipbuf[4 * sizeof "123"]; struct pf_os_fingerprint fp, *fpresult; int cnt, optlen = 0; const u_int8_t *optp; + ipbuf[0] = '\0'; + if ((tcp->th_flags & (TH_SYN|TH_ACK)) != TH_SYN || (ip->ip_off & htons(IP_OFFMASK))) return (NULL); @@ -189,7 +192,7 @@ DPFPRINTF("fingerprinted %s:%d %d:%d:%d:%d:%llx (%d) " "(TS=%s,M=%s%d,W=%s%d)\n", - inet_ntoa(ip->ip_src), ntohs(tcp->th_sport), + inet_ntoa_r(ip->ip_src, ipbuf), ntohs(tcp->th_sport), fp.fp_wsize, fp.fp_ttl, (fp.fp_flags & PF_OSFP_DF) != 0, fp.fp_psize, (long long int)fp.fp_tcpopts, fp.fp_optcnt, (fp.fp_flags & PF_OSFP_TS0) ? "0" : "", Index: libkern/inet_ntoa.c =================================================================== RCS file: /home/ncvs/src/sys/libkern/inet_ntoa.c,v retrieving revision 1.6 diff -u -r1.6 inet_ntoa.c --- libkern/inet_ntoa.c 7 Jan 2005 00:24:32 -0000 1.6 +++ libkern/inet_ntoa.c 24 Oct 2006 02:57:29 -0000 @@ -46,7 +46,7 @@ ucp[1] & 0xff, ucp[2] & 0xff, ucp[3] & 0xff); - return buf; + return (buf); } char * @@ -59,7 +59,7 @@ ucp[1] & 0xff, ucp[2] & 0xff, ucp[3] & 0xff); - return buf; + return (buf); } Index: net/if_gre.c =================================================================== RCS file: /home/ncvs/src/sys/net/if_gre.c,v retrieving revision 1.44 diff -u -r1.44 if_gre.c --- net/if_gre.c 4 Aug 2006 21:27:37 -0000 1.44 +++ net/if_gre.c 24 Oct 2006 02:57:29 -0000 @@ -689,6 +689,11 @@ { struct route *ro; u_int32_t a, b, c; +#ifdef DIAGNOSTIC + char ipbuf[4 * sizeof "123"]; + + ipbuf[0] = '\0'; +#endif /* DIAGNOSTIC */ ro = &sc->route; @@ -715,7 +720,7 @@ #ifdef DIAGNOSTIC printf("%s: searching for a route to %s", if_name(GRE2IFP(sc)), - inet_ntoa(((struct sockaddr_in *)&ro->ro_dst)->sin_addr)); + inet_ntoa_r(((struct sockaddr_in *)&ro->ro_dst)->sin_addr, ipbuf)); #endif rtalloc(ro); @@ -743,7 +748,7 @@ #ifdef DIAGNOSTIC printf(", choosing %s with gateway %s", if_name(ro->ro_rt->rt_ifp), - inet_ntoa(((struct sockaddr_in *)(ro->ro_rt->rt_gateway))->sin_addr)); + inet_ntoa_r(((struct sockaddr_in *)(ro->ro_rt->rt_gateway))->sin_addr, ipbuf)); printf("\n"); #endif Index: netatm/uni/uniarp_cache.c =================================================================== RCS file: /home/ncvs/src/sys/netatm/uni/uniarp_cache.c,v retrieving revision 1.15 diff -u -r1.15 uniarp_cache.c --- netatm/uni/uniarp_cache.c 10 Jun 2005 16:49:20 -0000 1.15 +++ netatm/uni/uniarp_cache.c 24 Oct 2006 02:57:29 -0000 @@ -91,12 +91,15 @@ struct ipvcc *ivp, *inext, *itail; struct uniarp *nouap, *ipuap; char abuf[64]; + char ipbuf[4 * sizeof "123"]; + + ipbuf[0] = '\0'; #ifdef DIAGNOSTIC strncpy(abuf, unisig_addr_print(atmsub), sizeof(abuf)); abuf[sizeof(abuf) - 1] = 0; ATM_DEBUG4("cache_svc: ip=%s, atm=(%s,%s), origin=%d\n", - inet_ntoa(*ip), unisig_addr_print(atm), abuf, origin); + inet_ntoa_r(*ip, ipbuf), unisig_addr_print(atm), abuf, origin); #endif /* @@ -176,7 +179,7 @@ abuf[sizeof(abuf) - 1] = 0; log(LOG_WARNING, "uniarp: duplicate IP address %s from %s,%s\n", - inet_ntoa(*ip), unisig_addr_print(atm), + inet_ntoa_r(*ip, ipbuf), unisig_addr_print(atm), abuf); return (EACCES); } @@ -206,7 +209,7 @@ abuf[sizeof(abuf) - 1] = 0; log(LOG_WARNING, "uniarp: ATM address for %s changed to %s,%s\n", - inet_ntoa(*ip), unisig_addr_print(atm), abuf); + inet_ntoa_r(*ip, ipbuf), unisig_addr_print(atm), abuf); } /* @@ -339,9 +342,12 @@ struct uniarp *uap; #ifdef DIAGNOSTIC + char ipbuf[4 * sizeof "123"]; char buf[64]; int vpi = 0, vci = 0; + ipbuf[0] = '\0'; + if ((ivp->iv_conn) && (ivp->iv_conn->co_connvc)) { vpi = ivp->iv_conn->co_connvc->cvc_vcc->vc_vpi; vci = ivp->iv_conn->co_connvc->cvc_vcc->vc_vci; @@ -349,7 +355,7 @@ strncpy(buf, unisig_addr_print(atmsub), sizeof(buf)); buf[sizeof(buf) - 1] = 0; ATM_DEBUG5("cache_pvc: vcc=(%d,%d), ip=%s, atm=(%s,%s)\n", - vpi, vci, inet_ntoa(*ip), unisig_addr_print(atm), buf); + vpi, vci, inet_ntoa_r(*ip, ipbuf), unisig_addr_print(atm), buf); #endif /* Index: netinet/if_ether.c =================================================================== RCS file: /home/ncvs/src/sys/netinet/if_ether.c,v retrieving revision 1.157 diff -u -r1.157 if_ether.c --- netinet/if_ether.c 22 Oct 2006 11:52:16 -0000 1.157 +++ netinet/if_ether.c 24 Oct 2006 03:01:22 -0000 @@ -179,6 +179,9 @@ static struct sockaddr_dl null_sdl = {sizeof(null_sdl), AF_LINK}; struct in_ifaddr *ia; struct ifaddr *ifa; + char ipbuf[4 * sizeof "123"]; + + ipbuf[0] = '\0'; RT_LOCK_ASSERT(rt); @@ -221,7 +224,7 @@ if (gate->sa_family != AF_LINK || gate->sa_len < sizeof(null_sdl)) { log(LOG_DEBUG, "%s: bad gateway %s%s\n", __func__, - inet_ntoa(SIN(rt_key(rt))->sin_addr), + inet_ntoa_r(SIN(rt_key(rt))->sin_addr, ipbuf), (gate->sa_family != AF_LINK) ? " (!AF_LINK)": ""); break; @@ -391,6 +394,9 @@ struct rtentry *rt = NULL; struct sockaddr_dl *sdl; int error; + char ipbuf[4 * sizeof "123"]; + + ipbuf[0] = '\0'; if (m->m_flags & M_BCAST) { /* broadcast */ (void)memcpy(desten, ifp->if_broadcastaddr, ifp->if_addrlen); @@ -420,7 +426,7 @@ if (rt == NULL) { log(LOG_DEBUG, "arpresolve: can't allocate route for %s\n", - inet_ntoa(SIN(dst)->sin_addr)); + inet_ntoa_r(SIN(dst)->sin_addr, ipbuf)); m_freem(m); return (EINVAL); /* XXX */ } @@ -429,7 +435,7 @@ RT_UNLOCK(rt); log(LOG_DEBUG, "arpresolve: can't allocate llinfo for %s\n", - inet_ntoa(SIN(dst)->sin_addr)); + inet_ntoa_r(SIN(dst)->sin_addr, ipbuf)); m_freem(m); return (EINVAL); /* XXX */ } @@ -607,6 +613,9 @@ #ifdef DEV_CARP int carp_match = 0; #endif + char ipbuf[4 * sizeof "123"]; + + ipbuf[0] = '\0'; if (ifp->if_bridge) bridged = 1; @@ -673,7 +682,7 @@ if (!bcmp(ar_sha(ah), ifp->if_broadcastaddr, ifp->if_addrlen)) { log(LOG_ERR, "arp: link address is broadcast for IP address %s!\n", - inet_ntoa(isaddr)); + inet_ntoa_r(isaddr, ipbuf)); goto drop; } /* @@ -686,7 +695,7 @@ log(LOG_ERR, "arp: %*D is using my IP address %s!\n", ifp->if_addrlen, (u_char *)ar_sha(ah), ":", - inet_ntoa(isaddr)); + inet_ntoa_r(isaddr, ipbuf)); itaddr = myaddr; goto reply; } @@ -710,7 +719,7 @@ ) { if (log_arp_wrong_iface) log(LOG_ERR, "arp: %s is on %s but got reply from %*D on %s\n", - inet_ntoa(isaddr), + inet_ntoa_r(isaddr, ipbuf), rt->rt_ifp->if_xname, ifp->if_addrlen, (u_char *)ar_sha(ah), ":", ifp->if_xname); @@ -723,7 +732,7 @@ if (rt->rt_expire) { if (log_arp_movements) log(LOG_INFO, "arp: %s moved from %*D to %*D on %s\n", - inet_ntoa(isaddr), + inet_ntoa_r(isaddr, ipbuf), ifp->if_addrlen, (u_char *)LLADDR(sdl), ":", ifp->if_addrlen, (u_char *)ar_sha(ah), ":", ifp->if_xname); @@ -733,7 +742,7 @@ log(LOG_ERR, "arp: %*D attempts to modify " "permanent entry for %s on %s\n", ifp->if_addrlen, (u_char *)ar_sha(ah), ":", - inet_ntoa(isaddr), ifp->if_xname); + inet_ntoa_r(isaddr, ipbuf), ifp->if_xname); goto reply; } } @@ -853,7 +862,7 @@ if (rt->rt_ifp != ifp) { log(LOG_INFO, "arp_proxy: ignoring request" " from %s via %s, expecting %s\n", - inet_ntoa(isaddr), ifp->if_xname, + inet_ntoa_r(isaddr, ipbuf), ifp->if_xname, rt->rt_ifp->if_xname); rtfree(rt); goto drop; @@ -862,7 +871,7 @@ #ifdef DEBUG_PROXY printf("arp: proxying for %s\n", - inet_ntoa(itaddr)); + inet_ntoa_r(itaddr, ipbuf)); #endif } else { /* @@ -912,6 +921,9 @@ struct rtentry *rt; struct sockaddr_inarp sin; const char *why = 0; + char ipbuf[4 * sizeof "123"]; + + ipbuf[0] = '\0'; bzero(&sin, sizeof(sin)); sin.sin_len = sizeof(sin); @@ -935,7 +947,7 @@ (((_rt)->rt_flags & (RTF_STATIC | RTF_WASCLONED)) == RTF_WASCLONED) if (create) log(LOG_DEBUG, "arplookup %s failed: %s\n", - inet_ntoa(sin.sin_addr), why); + inet_ntoa_r(sin.sin_addr, ipbuf), why); /* * If there are no references to this Layer 2 route, * and it is a cloned route, and not static, and Index: netinet/ip_fw2.c =================================================================== RCS file: /home/ncvs/src/sys/netinet/ip_fw2.c,v retrieving revision 1.152 diff -u -r1.152 ip_fw2.c --- netinet/ip_fw2.c 22 Oct 2006 11:52:16 -0000 1.152 +++ netinet/ip_fw2.c 24 Oct 2006 03:02:45 -0000 @@ -837,13 +837,17 @@ ipfw_insn_sa *sa = (ipfw_insn_sa *)cmd; int len; struct in_addr dummyaddr; + char ipbuf[4 * sizeof "123"]; + + ipbuf[0] = '\0'; + if (sa->sa.sin_addr.s_addr == INADDR_ANY) dummyaddr.s_addr = htonl(tablearg); else dummyaddr.s_addr = sa->sa.sin_addr.s_addr; len = snprintf(SNPARGS(action2, 0), "Forward to %s", - inet_ntoa(dummyaddr)); + inet_ntoa_r(dummyaddr, ipbuf)); if (sa->sa.sin_port) snprintf(SNPARGS(action2, len), ":%d", Index: netinet/ip_icmp.c =================================================================== RCS file: /home/ncvs/src/sys/netinet/ip_icmp.c,v retrieving revision 1.113 diff -u -r1.113 ip_icmp.c --- netinet/ip_icmp.c 22 Oct 2006 11:52:16 -0000 1.113 +++ netinet/ip_icmp.c 24 Oct 2006 03:03:14 -0000 @@ -312,10 +312,16 @@ */ #ifdef ICMPPRINTFS if (icmpprintfs) { - char buf[4 * sizeof "123"]; - strcpy(buf, inet_ntoa(ip->ip_src)); + char sbuf[4 * sizeof "123"]; + char dbuf[4 * sizeof "123"]; + + sbuf[0] = '\0'; + dbuf[0] = '\0'; + + inet_ntoa_r(ip->ip_src, sbuf); + inet_ntoa_r(ip->ip_dst, dbuf); printf("icmp_input from %s to %s, len %d\n", - buf, inet_ntoa(ip->ip_dst), icmplen); + sbuf, dbuf, icmplen); } #endif if (icmplen < ICMP_MINLEN) { @@ -578,11 +584,16 @@ icmpdst.sin_addr = icp->icmp_gwaddr; #ifdef ICMPPRINTFS if (icmpprintfs) { - char buf[4 * sizeof "123"]; - strcpy(buf, inet_ntoa(icp->icmp_ip.ip_dst)); + char icmpbuf[4 * sizeof "123"]; + char gwbuf[4 * sizeof "123"]; + + icmpbuf[0] = '\0'; + gwbuf[0] = '\0'; + inet_ntoa_r(icp->icmp_ip.ip_dst, icmpbuf); + inet_ntoa_r(icp->icmp_gwaddr, gwbuf); printf("redirect dst %s to %s\n", - buf, inet_ntoa(icp->icmp_gwaddr)); + icmpbuf, gwbuf); } #endif icmpsrc.sin_addr = icp->icmp_ip.ip_dst; @@ -821,10 +832,15 @@ m->m_pkthdr.rcvif = (struct ifnet *)0; #ifdef ICMPPRINTFS if (icmpprintfs) { - char buf[4 * sizeof "123"]; - strcpy(buf, inet_ntoa(ip->ip_dst)); + char sbuf[4 * sizeof "123"]; + char dbuf[4 * sizeof "123"]; + + sbuf[0] = '\0'; + dbuf[0] = '\0'; + inet_ntoa_r(ip->ip_dst, dbuf); + inet_ntoa_r(ip->ip_src, sbuf); printf("icmp_send dst %s src %s\n", - buf, inet_ntoa(ip->ip_src)); + dbuf, sbuf); } #endif (void) ip_output(m, opts, NULL, 0, NULL, NULL); Index: netinet/ip_options.c =================================================================== RCS file: /home/ncvs/src/sys/netinet/ip_options.c,v retrieving revision 1.3 diff -u -r1.3 ip_options.c --- netinet/ip_options.c 22 Oct 2006 11:52:16 -0000 1.3 +++ netinet/ip_options.c 24 Oct 2006 03:03:38 -0000 @@ -195,15 +195,20 @@ #endif if (!ip_dosourceroute) { if (ipforwarding) { - char buf[16]; /* aaa.bbb.ccc.ddd\0 */ + char sbuf[4 * sizeof "123"]; /* aaa.bbb.ccc.ddd\0 */ + char dbuf[4 * sizeof "123"]; + + sbuf[0] = '\0'; + dbuf[0] = '\0'; /* * Acting as a router, so generate ICMP */ nosourcerouting: - strcpy(buf, inet_ntoa(ip->ip_dst)); + inet_ntoa_r(ip->ip_dst, dbuf); + inet_ntoa_r(ip->ip_src, sbuf); log(LOG_WARNING, "attempted source route from %s to %s\n", - inet_ntoa(ip->ip_src), buf); + sbuf, dbuf); type = ICMP_UNREACH; code = ICMP_UNREACH_SRCFAIL; goto bad; Index: netinet/tcp_hostcache.c =================================================================== RCS file: /home/ncvs/src/sys/netinet/tcp_hostcache.c,v retrieving revision 1.10 diff -u -r1.10 tcp_hostcache.c --- netinet/tcp_hostcache.c 7 Jan 2005 01:45:45 -0000 1.10 +++ netinet/tcp_hostcache.c 24 Oct 2006 02:57:29 -0000 @@ -587,6 +587,9 @@ char *p, *buf; int len, i, error; struct hc_metrics *hc_entry; + char ipbuf[4 * sizeof "123"]; + + ipbuf[0] = '\0'; bufsize = linesize * (tcp_hostcache.cache_count + 1); @@ -605,7 +608,7 @@ len = snprintf(p, linesize, "%-15s %5lu %8lu %6lums %6lums %9lu %8lu %8lu %8lu " "%4lu %4lu %4i\n", - hc_entry->ip4.s_addr ? inet_ntoa(hc_entry->ip4) : + hc_entry->ip4.s_addr ? inet_ntoa_r(hc_entry->ip4, ipbuf) : #ifdef INET6 ip6_sprintf(&hc_entry->ip6), #else Index: netinet/tcp_input.c =================================================================== RCS file: /home/ncvs/src/sys/netinet/tcp_input.c,v retrieving revision 1.310 diff -u -r1.310 tcp_input.c --- netinet/tcp_input.c 22 Oct 2006 11:52:16 -0000 1.310 +++ netinet/tcp_input.c 24 Oct 2006 03:04:00 -0000 @@ -708,6 +708,9 @@ char dbuf[4*sizeof "123"], sbuf[4*sizeof "123"]; #endif + dbuf[0] = '\0'; + sbuf[0] = '\0'; + if (isipv6) { #ifdef INET6 strcpy(dbuf, "["); @@ -718,8 +721,8 @@ strcat(sbuf, "]"); #endif } else { - strcpy(dbuf, inet_ntoa(ip->ip_dst)); - strcpy(sbuf, inet_ntoa(ip->ip_src)); + inet_ntoa_r(ip->ip_dst, dbuf); + inet_ntoa_r(ip->ip_src, sbuf); } switch (log_in_vain) { case 1: @@ -1064,6 +1067,10 @@ tp->rcv_byps += tlen + off; if (tp->rcv_pps > tcp_minmssoverload) { if ((tp->rcv_byps / tp->rcv_pps) < tcp_minmss) { + char ipbuf[4 * sizeof "123"]; + + ipbuf[0] = '\0'; + printf("too many small tcp packets from " "%s:%u, av. %lubyte/packet, " "dropping connection\n", @@ -1071,7 +1078,7 @@ isipv6 ? ip6_sprintf(&inp->inp_inc.inc6_faddr) : #endif - inet_ntoa(inp->inp_inc.inc_faddr), + inet_ntoa_r(inp->inp_inc.inc_faddr, ipbuf), inp->inp_inc.inc_fport, tp->rcv_byps / tp->rcv_pps); KASSERT(headlocked, ("tcp_input: " Index: netinet/tcp_subr.c =================================================================== RCS file: /home/ncvs/src/sys/netinet/tcp_subr.c,v retrieving revision 1.265 diff -u -r1.265 tcp_subr.c --- netinet/tcp_subr.c 22 Oct 2006 11:52:16 -0000 1.265 +++ netinet/tcp_subr.c 24 Oct 2006 03:04:37 -0000 @@ -2261,8 +2261,11 @@ /* Look up an SADB entry which matches the address of the peer. */ sav = KEY_ALLOCSA(&dst, IPPROTO_TCP, htonl(TCP_SIG_SPI)); if (sav == NULL) { + char ipbuf[4 * sizeof "123"]; + + ipbuf[0] = '\0'; printf("%s: SADB lookup failed for %s\n", __func__, - inet_ntoa(dst.sin.sin_addr)); + inet_ntoa_r(dst.sin.sin_addr, ipbuf)); return (EINVAL); } Index: netinet/udp_usrreq.c =================================================================== RCS file: /home/ncvs/src/sys/netinet/udp_usrreq.c,v retrieving revision 1.195 diff -u -r1.195 udp_usrreq.c --- netinet/udp_usrreq.c 22 Oct 2006 11:52:17 -0000 1.195 +++ netinet/udp_usrreq.c 24 Oct 2006 03:05:09 -0000 @@ -399,12 +399,16 @@ ip->ip_dst, uh->uh_dport, 1, m->m_pkthdr.rcvif); if (inp == NULL) { if (log_in_vain) { - char buf[4*sizeof "123"]; + char sbuf[4*sizeof "123"]; + char dbuf[4*sizeof "123"]; - strcpy(buf, inet_ntoa(ip->ip_dst)); + sbuf[0] = '\0'; + dbuf[0] = '\0'; + inet_ntoa_r(ip->ip_dst, dbuf); + inet_ntoa_r(ip->ip_src, sbuf); log(LOG_INFO, "Connection attempt to UDP %s:%d from %s:%d\n", - buf, ntohs(uh->uh_dport), inet_ntoa(ip->ip_src), + dbuf, ntohs(uh->uh_dport), sbuf, ntohs(uh->uh_sport)); } udpstat.udps_noport++; Index: netinet/libalias/alias_nbt.c =================================================================== RCS file: /home/ncvs/src/sys/netinet/libalias/alias_nbt.c,v retrieving revision 1.20 diff -u -r1.20 alias_nbt.c --- netinet/libalias/alias_nbt.c 26 Sep 2006 23:26:53 -0000 1.20 +++ netinet/libalias/alias_nbt.c 24 Oct 2006 02:57:29 -0000 @@ -345,6 +345,11 @@ NbtDataHeader *ndh; u_char *p = NULL; char *pmax; +#ifdef LIBALIAS_DEBUG + char ipbuf[4 * sizeof "123"]; + + ipbuf[0] = '\0'; +#endif /* LIBALIAS_DEBUG */ (void)la; (void)lnk; @@ -380,7 +385,7 @@ if (p == NULL || (char *)p > pmax) p = NULL; #ifdef LIBALIAS_DEBUG - printf("%s:%d-->", inet_ntoa(ndh->source_ip), ntohs(ndh->source_port)); + printf("%s:%d-->", inet_ntoa_r(ndh->source_ip, ipbuf), ntohs(ndh->source_port)); #endif /* Doing an IP address and Port number Translation */ if (uh->uh_sum != 0) { @@ -400,7 +405,7 @@ ndh->source_ip = *alias_address; ndh->source_port = alias_port; #ifdef LIBALIAS_DEBUG - printf("%s:%d\n", inet_ntoa(ndh->source_ip), ntohs(ndh->source_port)); + printf("%s:%d\n", inet_ntoa_r(ndh->source_ip, ipbuf), ntohs(ndh->source_port)); fflush(stdout); #endif return ((p == NULL) ? -1 : 0); @@ -482,6 +487,12 @@ NBTNsRNB *nb; u_short bcount; +#ifdef LIBALIAS_DEBUG + char ipbuf[4 * sizeof "123"]; + + ipbuf[0] = '\0'; +#endif /* LIBALIAS_DEBUG */ + if (q == NULL || (char *)(q + 1) > pmax) return (NULL); /* Check out a length */ @@ -492,8 +503,8 @@ /* Processing all in_addr array */ #ifdef LIBALIAS_DEBUG - printf("NB rec[%s", inet_ntoa(nbtarg->oldaddr)); - printf("->%s, %dbytes] ", inet_ntoa(nbtarg->newaddr), bcount); + printf("NB rec[%s", inet_ntoa_r(nbtarg->oldaddr, ipbuf)); + printf("->%s, %dbytes] ", inet_ntoa_r(nbtarg->newaddr, ipbuf), bcount); #endif while (nb != NULL && bcount != 0) { if ((char *)(nb + 1) > pmax) { @@ -501,7 +512,7 @@ break; } #ifdef LIBALIAS_DEBUG - printf("<%s>", inet_ntoa(nb->addr)); + printf("<%s>", inet_ntoa_r(nb->addr, ipbuf)); #endif if (!bcmp(&nbtarg->oldaddr, &nb->addr, sizeof(struct in_addr))) { if (*nbtarg->uh_sum != 0) { @@ -549,6 +560,12 @@ NBTNsResourceA *a; u_short bcount; +#ifdef LIBALIAS_DEBUG + char ipbuf[4 * sizeof "123"]; + + ipbuf[0] = '\0'; +#endif /* LIBALIAS_DEBUG */ + if (q == NULL || (char *)(q + 1) > pmax) return (NULL); @@ -560,14 +577,14 @@ /* Processing all in_addr array */ #ifdef LIBALIAS_DEBUG - printf("Arec [%s", inet_ntoa(nbtarg->oldaddr)); - printf("->%s]", inet_ntoa(nbtarg->newaddr)); + printf("Arec [%s", inet_ntoa_r(nbtarg->oldaddr, ipbuf)); + printf("->%s]", inet_ntoa_r(nbtarg->newaddr, ipbuf)); #endif while (bcount != 0) { if (a == NULL || (char *)(a + 1) > pmax) return (NULL); #ifdef LIBALIAS_DEBUG - printf("..%s", inet_ntoa(a->addr)); + printf("..%s", inet_ntoa_r(a->addr, ipbuf)); #endif if (!bcmp(&nbtarg->oldaddr, &a->addr, sizeof(struct in_addr))) { if (*nbtarg->uh_sum != 0) { Index: netinet/libalias/alias_proxy.c =================================================================== RCS file: /home/ncvs/src/sys/netinet/libalias/alias_proxy.c,v retrieving revision 1.27 diff -u -r1.27 alias_proxy.c --- netinet/libalias/alias_proxy.c 26 Sep 2006 23:26:53 -0000 1.27 +++ netinet/libalias/alias_proxy.c 24 Oct 2006 02:57:29 -0000 @@ -393,8 +393,11 @@ { int slen; char buffer[40]; + char ipbuf[4 * sizeof "123"]; struct tcphdr *tc; + ipbuf[0] = '\0'; + /* Compute pointer to tcp header */ tc = (struct tcphdr *)ip_next(pip); @@ -405,7 +408,7 @@ /* Translate destination address and port to string form */ snprintf(buffer, sizeof(buffer) - 2, "[DEST %s %d]", - inet_ntoa(GetProxyAddress(lnk)), (u_int) ntohs(GetProxyPort(lnk))); + inet_ntoa_r(GetProxyAddress(lnk), ipbuf), (u_int) ntohs(GetProxyPort(lnk))); /* Pad string out to a multiple of two in length */ slen = strlen(buffer); Index: nfs4client/nfs4_vfsops.c =================================================================== RCS file: /home/ncvs/src/sys/nfs4client/nfs4_vfsops.c,v retrieving revision 1.26 diff -u -r1.26 nfs4_vfsops.c --- nfs4client/nfs4_vfsops.c 13 Sep 2006 18:39:08 -0000 1.26 +++ nfs4client/nfs4_vfsops.c 24 Oct 2006 02:57:29 -0000 @@ -786,11 +786,14 @@ struct mbuf *mreq, *mrep = NULL, *md, *mb; caddr_t bpos, dpos; struct route ro; - char *ipsrc = NULL, uaddr[24], name[24]; + char uaddr[24], name[24]; + char ipbuf[4 * sizeof "123"]; int try = 0; static unsigned long seq; int error; + ipbuf[0] = '\0'; + #ifndef NFS4_USE_RPCCLNT return (0); #endif @@ -822,14 +825,14 @@ error = EHOSTUNREACH; goto nfsmout; } - ipsrc = inet_ntoa(IA_SIN(ifatoia(ro.ro_rt->rt_ifa))->sin_addr); - sprintf(uaddr, "%s.12.48", ipsrc); + inet_ntoa_r(IA_SIN(ifatoia(ro.ro_rt->rt_ifa))->sin_addr, ipbuf); + sprintf(uaddr, "%s.12.48", ipbuf); scid.cb_univaddr = uaddr; scid.cb_univaddrlen = strlen(uaddr); RTFREE(ro.ro_rt); try_again: - sprintf(name, "%s-%d", ipsrc, (int) ((seq + try) % 1000000L)); + sprintf(name, "%s-%d", ipbuf, (int) ((seq + try) % 1000000L)); scid.namelen = strlen(name); scid.name = name; nfs_v4initcompound(&cp); Index: nfsserver/nfs_syscalls.c =================================================================== RCS file: /home/ncvs/src/sys/nfsserver/nfs_syscalls.c,v retrieving revision 1.107 diff -u -r1.107 nfs_syscalls.c --- nfsserver/nfs_syscalls.c 22 Oct 2006 11:52:17 -0000 1.107 +++ nfsserver/nfs_syscalls.c 24 Oct 2006 03:05:36 -0000 @@ -420,6 +420,9 @@ u_short port; struct sockaddr *nam = nd->nd_nam; struct sockaddr_in *sin; + char ipbuf[4 * sizeof "123"]; + + ipbuf[0] = '\0'; sin = (struct sockaddr_in *)nam; /* @@ -449,7 +452,7 @@ ip6_sprintf(&satosin6(sin)->sin6_addr) : #undef ip6_sprintf #endif - inet_ntoa(sin->sin_addr), port); + inet_ntoa_r(sin->sin_addr, ipbuf), port); } }