netif->hwaddr_len of loopback interface is not ETH_HWADDR_LEN

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

netif->hwaddr_len of loopback interface is not ETH_HWADDR_LEN

Laurenz Altenmüller
Hi,

I want to unit test some embedded firmware on native host arch by
building it against the lwip unix port (latest master). Right now I want
to add a fake IP and MAC to the ARP table with
`etharp_add_static_entry()` so that the tested function can find it when
it uses `etharp_query()` and then `etharp_find_addr()` in its
implementation. For all this I'm using the netif I get from
`netif_get_loopif()`.

Unfortunately I hit the assert in etharp.c:1139 ("netif->hwaddr_len must
be the same as ETH_HWADDR_LEN for etharp!"). Using the debugger I can
confirm that `netif->hwaddr_len` of my loopback netif is 0.

Should I even be able to use the loopback interface for ARP things? Am I
just missing some initialization? (In my test's `setUp()` I call
`sys_init(); mem_init(); netif_init(); test_netif=netif_get_loopif();`)

Cheers
Laurenz


_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: netif->hwaddr_len of loopback interface is not ETH_HWADDR_LEN

goldsimon@gmx.de


Am 6. Juli 2020 19:09:51 MESZ schrieb "Laurenz Altenmüller" <[hidden email]>:

>Hi,
>
>I want to unit test some embedded firmware on native host arch by
>building it against the lwip unix port (latest master). Right now I
>want
>to add a fake IP and MAC to the ARP table with
>`etharp_add_static_entry()` so that the tested function can find it
>when
>it uses `etharp_query()` and then `etharp_find_addr()` in its
>implementation. For all this I'm using the netif I get from
>`netif_get_loopif()`.
>
>Unfortunately I hit the assert in etharp.c:1139 ("netif->hwaddr_len
>must
>be the same as ETH_HWADDR_LEN for etharp!"). Using the debugger I can
>confirm that `netif->hwaddr_len` of my loopback netif is 0.
>
>Should I even be able to use the loopback interface for ARP things?

No, the loopif is not meant to work with ARP. Our own unit tests use a dedicated tiny test netif for such tests.

Regards,
Simon

> Am
>I
>just missing some initialization? (In my test's `setUp()` I call
>`sys_init(); mem_init(); netif_init(); test_netif=netif_get_loopif();`)
>
>Cheers
>Laurenz
>
>
>_______________________________________________
>lwip-users mailing list
>[hidden email]
>https://lists.nongnu.org/mailman/listinfo/lwip-users

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users