100-disabled-ipv6-fix.patch 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. --- a/net.c
  2. +++ b/net.c
  3. @@ -307,9 +307,11 @@ void net_send_tcp(int index)
  4. struct sockaddr_storage local;
  5. struct sockaddr_storage remote;
  6. struct sockaddr_in *local4 = (struct sockaddr_in *) &local;
  7. - struct sockaddr_in6 *local6 = (struct sockaddr_in6 *) &local;
  8. struct sockaddr_in *remote4 = (struct sockaddr_in *) &remote;
  9. +#ifdef ENABLE_IPV6
  10. + struct sockaddr_in6 *local6 = (struct sockaddr_in6 *) &local;
  11. struct sockaddr_in6 *remote6 = (struct sockaddr_in6 *) &remote;
  12. +#endif
  13. socklen_t len;
  14. ttl = index + 1;
  15. @@ -566,8 +568,10 @@ void net_send_query(int index)
  16. /* sendto() assumes packet length includes the IPv4 header but not the
  17. IPv6 header. */
  18. - spacketsize = abs(packetsize) -
  19. - ( ( af == AF_INET ) ? 0 : sizeof (struct ip6_hdr) );
  20. + spacketsize = abs(packetsize);
  21. +#ifdef ENABLE_IPV6
  22. + spacketsize -= ( ( af == AF_INET ) ? 0 : sizeof (struct ip6_hdr) );
  23. +#endif
  24. rv = sendto(sendsock, packet, spacketsize, 0, remotesockaddr, salen);
  25. if (first && (rv < 0) && ((errno == EINVAL) || (errno == EMSGSIZE))) {
  26. /* Try the first packet again using host byte order. */
  27. --- a/dns.c
  28. +++ b/dns.c
  29. @@ -49,7 +49,7 @@
  30. #include <unistd.h>
  31. #include <fcntl.h>
  32. //#include <ctype.h>
  33. -//#include <string.h>
  34. +#include <string.h>
  35. #include <stdio.h>
  36. #include <stdlib.h>
  37. #include <signal.h>
  38. --- a/net.h
  39. +++ b/net.h
  40. @@ -20,6 +20,7 @@
  41. #include <netdb.h>
  42. #include <arpa/inet.h>
  43. #include <netinet/in.h>
  44. +#include <sys/select.h>
  45. #include <sys/socket.h>
  46. #ifdef ENABLE_IPV6
  47. #include <netinet/ip6.h>