cpw%sneezy@LANL.GOV (C. Philip Wood) (12/24/88)
This diff includes previous diff for little and big endiens as well as the addition of a setsockopt to raise the max send buffer. It seems that some gateway/hosts will drop a datagram greater than 2048. One should be able to send and receive datagrams greater than 2048. EGP comes to mind. ------- traceroute.c ------- *** /tmp/da7076 Fri Dec 23 11:28:04 1988 --- traceroute.c Fri Dec 23 11:26:57 1988 *************** *** 169,170 **** --- 169,171 ---- #define MAXPACKET 4096 /* max packet size */ + #define UDP_SENDSPACE 2048 #ifndef MAXHOSTNAMELEN *************** *** 238,239 **** --- 239,241 ---- struct hostent *hp; + int value; *************** *** 352,353 **** --- 354,366 ---- + #ifdef SO_RCVBUF + if (datalen > UDP_SENDSPACE) { + value = datalen + sizeof (struct opacket); + if (setsockopt(sndsock, SOL_SOCKET, SO_SNDBUF, (char *)&value, + sizeof(value)) < 0) { + perror("setsockopt SO_SNDBUF"); + exit(6); + } + } + #endif SO_RCVBUF + if (source) { *************** *** 443,447 **** ! up->uh_sport = ident; ! up->uh_dport = port; ! up->uh_ulen = len - sizeof(struct ip); up->uh_sum = 0; --- 456,460 ---- ! up->uh_sport = htons(ident); ! up->uh_dport = htons(port); ! up->uh_ulen = htons(len - sizeof(struct ip)); up->uh_sum = 0; *************** *** 538,539 **** --- 551,554 ---- up = (struct udphdr *)((u_char *)hip + hlen); + up->uh_sport = ntohs(up->uh_sport); + up->uh_dport = ntohs(up->uh_dport); if (hlen + 12 <= cc && hip->ip_p == IPPROTO_UDP &&