2292801-bind-ipv6-only.patch 824 B

1234567891011121314151617181920212223242526272829303132
  1. commit fdc18ea52fca355be23dc48a3818bf01571269c3
  2. author: dldmitry
  3. date: 2016-04-28T18:37:37+03:00
  4. revision: 2292801
  5. libevent: bind to ipv6 only
  6. __BYPASS_CHECKS__
  7. --- libevent/http.c (index)
  8. +++ libevent/http.c (working tree)
  9. @@ -4393,6 +4393,12 @@ bind_socket_ai(struct evutil_addrinfo *ai, int reuse)
  10. return (-1);
  11. }
  12. +#if defined IPV6_V6ONLY
  13. + int v6opt = 1;
  14. + if (ai->ai_family == AF_INET6 && setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, &v6opt, sizeof(v6opt)) < 0)
  15. + goto out;
  16. +#endif
  17. +
  18. if (setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, (void *)&on, sizeof(on))<0)
  19. goto out;
  20. if (reuse) {
  21. @@ -4427,6 +4433,8 @@ make_addrinfo(const char *address, ev_uint16_t port)
  22. static const char* names[] = {
  23. "127.0.0.1",
  24. "::1",
  25. + "0.0.0.0",
  26. + "::",
  27. "localhost",
  28. "localhost.localdomain",
  29. "localhost6",