Confd_connect with IPV6 addressing failed

I’ve faced the below issue in my project. Can you help me ?

Code snip:

memset(&m_addr_ipv6, 0, sizeof(m_addr_ipv6));
inet_pton(AF_INET6, "::1", &m_addr_ipv6.sin6_addr);
m_addr_ipv6.sin6_family = AF_INET6;
m_addr_ipv6.sin6_port = htons(CONFD_PORT);
int errval = confd_connect(dctx, ctlsock, CONTROL_SOCKET, (struct sockaddr*)&m_addr_ipv6,


ERRNOSTR=“system call failed” LASTERR=“Failed to connect to ConfD: Address family not supported by protocol” ERRNO=24.

You omitted the socket() call, but you likely use the wrong family when you create the socket. Example:

    //if ((ctlsock = socket(PF_INET, SOCK_STREAM, 0)) < 0 )
    if ((ctlsock = socket(PF_INET6, SOCK_STREAM, 0)) < 0 )
        confd_fatal("Failed to open ctlsocket\n");