configure IPv6 check is broken in several ways

Issue #1058 resolved
Florian Weimer created an issue

The check currently looks like this:

        AC_MSG_CHECKING(for IPv6 support)
        AC_CACHE_VAL(ac_cv_ipv6,
                AC_RUN_IFELSE([
                AC_LANG_SOURCE([[
                #include <sys/types.h>
                #include <sys/socket.h>
                #include <netinet/in.h>
                /* Make sure the definitions for AF_INET6 and struct sockaddr_in6
                 * are defined, and that we can actually create an IPv6 TCP socket.*/
                main()
                {
                        int fd;
                        struct sockaddr_in6 foo;
                        fd = socket(AF_INET6, SOCK_STREAM, 0);
                        exit(fd >= 0 ? 0 : 1);
                }]])],
                [ac_cv_ipv6=yes],
                [ac_cv_ipv6=no],
                [ac_cv_ipv6=no])
        )

The issues are:

  • The return type of main should be declared as int. Implicit int is no longer part of C as of C99.
  • The exit function declaration needs to be declared, probably by including <stdint.h>. Implicit function declarations were also removed in C99.
  • It seems wrong to disable run-time IPv6 support if IPv6 is disabled in the build environment. This shouldn’t be a run-time check. And maybe it’s not even necessary to check for AF_INET6 support these days.

I can send a patch, but it’s going to be so trivial that I can’t bother our legal team about signing the CLA, sorry.

Related to:

Comments (1)

  1. Log in to comment