--- previous/src/slirp/ip_icmp.c 2018/04/24 19:30:44 1.1 +++ previous/src/slirp/ip_icmp.c 2018/04/24 19:32:38 1.1.1.2 @@ -77,7 +77,7 @@ icmp_input(m, hlen) DEBUG_CALL("icmp_input"); DEBUG_ARG("m = %lx", (long )m); - DEBUG_ARG("m_len = %d", m->m_len); + DEBUG_ARG("m_len = %zu", m->m_len); icmpstat.icps_received++; @@ -201,12 +201,12 @@ end_error: #define ICMP_MAXDATALEN (IP_MSS-28) void -icmp_error(msrc, type, code, minsize, message) - struct mbuf *msrc; - u_char type; - u_char code; - int minsize; - char *message; +icmp_error( + struct mbuf *msrc, + u_char type, + u_char code, + int minsize, + char *message) { unsigned hlen, shlen, s_ip_len; register struct ip *ip; @@ -215,7 +215,7 @@ icmp_error(msrc, type, code, minsize, me DEBUG_CALL("icmp_error"); DEBUG_ARG("msrc = %lx", (long )msrc); - DEBUG_ARG("msrc_len = %d", msrc->m_len); + DEBUG_ARG("msrc_len = %zu", msrc->m_len); if(type!=ICMP_UNREACH && type!=ICMP_TIMXCEED) goto end_error; @@ -223,9 +223,9 @@ icmp_error(msrc, type, code, minsize, me if(!msrc) goto end_error; ip = mtod(msrc, struct ip *); #if DEBUG - { char bufa[20], bufb[20]; - strcpy(bufa, inet_ntoa(ip->ip_src)); - strcpy(bufb, inet_ntoa(ip->ip_dst)); + { char bufa[INET_ADDRSTRLEN], bufb[INET_ADDRSTRLEN]; + inet_ntop(AF_INET, &ip->ip_src, bufa, sizeof(bufa)); + inet_ntop(AF_INET, &ip->ip_dst, bufb, sizeof(bufb)); DEBUG_MISC((dfd, " %.16s to %.16s\n", bufa, bufb)); } #endif @@ -244,7 +244,7 @@ icmp_error(msrc, type, code, minsize, me /* make a copy */ if(!(m=m_get())) goto end_error; /* get mbuf */ - { int new_m_size; + { u_int new_m_size; new_m_size=sizeof(struct ip )+ICMP_MINLEN+msrc->m_len+ICMP_MAXDATALEN; if(new_m_size>m->m_size) m_inc(m, new_m_size); } @@ -299,7 +299,7 @@ icmp_error(msrc, type, code, minsize, me /* fill in ip */ ip->ip_hl = hlen >> 2; - ip->ip_len = m->m_len; + ip->ip_len = (u_int16_t)m->m_len; ip->ip_tos=((ip->ip_tos & 0x1E) | 0xC0); /* high priority for errors */