lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-users] Use IPv4/IPv6 Dual Stack


From: antonio
Subject: [lwip-users] Use IPv4/IPv6 Dual Stack
Date: Thu, 26 Apr 2018 05:22:14 -0700 (MST)

Hi all, 
After using with IPv4 for long time, I decided to enable dual stack, i.e,
using both IPv4/6 simultaneously. 
I followed the configuration from lwip-contrib/ports/unix/unixsim/*.c.

I have a small *socket-based HTTP web-server*, and I am using a simulation
like environment, with a *TAP_IF* which allows me to access internet through
my simulator and LWIP-2.0.3. With IPV4 ONLY it works fine...
However, I am unable to have an application compile with
LWIP_IPV4/LWIP_IPv6=1. I run into problems with addresses, 
since I use the TapIf address to initialize my structures.

static void* my_http_server_thread(void* arg)
{
   struct sockaddr_storage client_addr;
    struct addrinfo hints, *addr_list, *cur;
    char* serv_ip_addr;

    /* Do name resolution with both IPv6 and IPv4 */
    memset( &hints, 0, sizeof( hints ) );
    hints.ai_family = AF_UNSPEC;
    hints.ai_socktype = SOCK_STREAM;
    hints.ai_protocol = IPPROTO_TCP;

    serv_ip_addr = ipaddr_ntoa( (const ip_addr_t*)arg);

    if(serv_ip_addr == NULL){
        hints.ai_flags = AI_PASSIVE;
    }

    err_code = getaddrinfo(serv_ip_addr, SERVER_HTTP_PORT_NUM, &hints,
&addr_list );
    LWIP_ASSERT(" getaddrinfo err_code>=0", err_code >=0);

........
}

from My initialization, I call this  which always gives an error.. :( (see
bellow)

    #if LWIP_IPV4
    ip_addr_set_ipaddr(&srv_ip_addr, (const
ip4_addr_t*)netif_ip4_addr(&netif_tap));
    #else
    ip_addr_set_ipaddr(&srv_ip_addr, (const
ip6_addr_t*)netif_ip6_addr(&netif_tap, 0));
    #endif /* LWIP_IPV4*/

Then I call my thread here
os_create_thread("http", http_server_thread, (void*)&srv_ip_addr, 1, 1024);

ERROR MESSAGES
include/lwip/ip_addr.h:118:39: error: 'ip4_addr_t {aka const struct
ip4_addr}' has no member named 'u_addr'
 #define ip_2_ip4(ipaddr)   (&((ipaddr)->u_addr.ip4))
                                       ^
lwip2/include/lwip/ip4_addr.h:111:38: note: in definition of macro
'ip4_addr_set'
                                     (src)->addr))
                                      ^
lwip2/include/lwip/ip_addr.h:159:32: note: in expansion of macro 'ip_2_ip4'
   ip4_addr_set(ip_2_ip4(dest), ip_2_ip4(src)); ip_clear_no4(dest);
}}while(0)
                                ^
lwip2/include/lwip/ip_addr.h:161:39: note: in expansion of macro
'ip_addr_set'
 #define ip_addr_set_ipaddr(dest, src) ip_addr_set(dest, src)
                                       ^
lwip_apps/thread_http-server.c:662:5: note: in expansion of macro
'ip_addr_set_ipaddr'
     ip_addr_set_ipaddr(&srv_ip_addr, /*(const
ip4_addr_t*)*/netif_ip4_addr(&netif_tap));


Thanks In advance. 



--
Sent from: http://lwip.100.n7.nabble.com/lwip-users-f3.html



reply via email to

[Prev in Thread] Current Thread [Next in Thread]