lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] LWIP how to setup multiple netif


From: K Nagesh
Subject: [lwip-users] LWIP how to setup multiple netif
Date: Tue, 27 Apr 2021 12:07:00 +0530

Dear Sir/Mam,

I'm trying to setup a multiple interface lwIP stack. But I don't get it to work. So I hope someone can point out what is incorrect.


    ip4_addr_t netif_ipaddr, netif_netmask, netif_gw;
    ethernetif_config_t enet_config0 = {
        .phyHandle  = &phyHandle0,
        .macAddress = {0x91, 0xda, 0xa3, 0x39, 0xdf, 0x0a},
    };

    ethernetif_config_t enet_config1 = {
        .phyHandle  = &phyHandle1,
        .macAddress = {0x91, 0xda, 0xa3, 0x39, 0xdf, 0x0b},
    };

    tcpip_init(NULL, NULL);

    // port 1
    netif_ipaddr.addr = PP_HTONL(LWIP_MAKEU32(192, 168, 0, 102));
    netif_netmask.addr = PP_HTONL(LWIP_MAKEU32(255, 255, 255, 0));
    netif_gw.addr = PP_HTONL(LWIP_MAKEU32(192, 168, 0, 100));

    netifapi_netif_add(&netif[1], &netif_ipaddr, &netif_netmask, &netif_gw, &enet_config1, ethernetif1_init, tcpip_input);
    netifapi_netif_set_default(&netif[1]);
    netifapi_netif_set_up(&netif[1]);


    // Port 0
    netif_ipaddr.addr = PP_HTONL(LWIP_MAKEU32(192, 168, 1, 102));
    netif_netmask.addr = PP_HTONL(LWIP_MAKEU32(255, 255, 255, 0));
    netif_gw.addr = PP_HTONL(LWIP_MAKEU32(192, 168, 1, 100));

    netifapi_netif_add(&netif[0], &netif_ipaddr, &netif_netmask, &netif_gw, &enet_config0, ethernetif0_init, tcpip_input);
    netifapi_netif_set_up(&netif[0]);

If I configure one of them it works fine. But when configure both non of them work.
please any suggestion?



--
Thanks&Regards,
K.S.S.Nagesh

reply via email to

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