Skip to content

pkg/lwip: fix dependencies when LWIP IPv4 and LWIP_DHCP is used#21869

Merged
mguetschow merged 1 commit intoRIOT-OS:masterfrom
krzysztof-cabaj:pkg_lwip_ipv4_dependencies_v2
Nov 14, 2025
Merged

pkg/lwip: fix dependencies when LWIP IPv4 and LWIP_DHCP is used#21869
mguetschow merged 1 commit intoRIOT-OS:masterfrom
krzysztof-cabaj:pkg_lwip_ipv4_dependencies_v2

Conversation

@krzysztof-cabaj
Copy link
Contributor

@krzysztof-cabaj krzysztof-cabaj commented Nov 11, 2025

Contribution description

When LWIP IPv4 and LWIP DHCP is used, in file build/pkg/lwip/src/include/lwip/acd.h (Address Conflict Detection)
definition of struct etharp_hdr is needed. This definition is available in the module netdev_eth.

In link @mguetschow reported that previous solution from PR #21342 did not work for nrf52840dk.

This PR is some "dirty-hack" to solve this problem.

TODO:
Find the root cause of the problem. PR #17174 and PR #17162 could be a good starting point.

Testing procedure

Without this PR on current master LWIP_IPV4=1 make -C examples/networking/coap/gcoap_dtls BOARD=nrf52840dk ends with error:

"make" -C /data/RIOT/RIOT/build/pkg/lwip/src/api -f /data/RIOT/RIOT/Makefile.base MODULE=lwip_api
In file included from /data/RIOT/RIOT/build/pkg/lwip/src/include/lwip/dhcp.h:49,
                 from /data/RIOT/RIOT/build/pkg/lwip/src/include/lwip/netifapi.h:41,
                 from /data/RIOT/RIOT/build/pkg/lwip/src/api/netifapi.c:46:
/data/RIOT/RIOT/build/pkg/lwip/src/include/lwip/acd.h:97:48: error: 'struct etharp_hdr' declared inside parameter list will not be visible outside of this definition or declaration [-Werror]
   97 | void acd_arp_reply(struct netif *netif, struct etharp_hdr *hdr);
      |                                                ^~~~~~~~~~

With this PR, everything works well.
I tested this for nrf52840dk (lack of Ethernet interface but radio interface), nucleo-f439zi (with Ethernet interface), native (lack of any network interface).

Issues/PRs references

Fixes PR #21342

@github-actions github-actions bot added Area: network Area: Networking Area: pkg Area: External package ports labels Nov 11, 2025
@crasbe crasbe added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) labels Nov 11, 2025
@crasbe crasbe requested a review from mguetschow November 11, 2025 10:27
@riot-ci
Copy link

riot-ci commented Nov 11, 2025

Murdock results

✔️ PASSED

6be2534 pkg/lwip: fix dependencies when LWIP IPv4 and LWIP_DHCP is used

Success Failures Total Runtime
10930 0 10931 09m:24s

Artifacts

Copy link
Contributor

@mguetschow mguetschow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for looking into this! To be honest, I'm not a big fan of this hack, as it seems to only provide a superficial fix at the cost of modeling a wrong netdev during dependency resolution.

While trying to figure out the root cause, I found

#if defined(MODULE_LWIP_ARP) && defined(MODULE_LWIP_ETHERNET)
#define LWIP_ARP 1
#else /* MODULE_LWIP_ARP */
#define LWIP_ARP 0
#endif /* MODULE_LWIP_ARP */

which was added with #17174

It seems to me that the issue #17162 mentioned there is closer to the root cause.

I still think we should merge this now as it improves things, but I'd ask you to add a TODO note to the comment pointing to the issue above and stating that this should be fixed more fundamentally.

@krzysztof-cabaj krzysztof-cabaj force-pushed the pkg_lwip_ipv4_dependencies_v2 branch 2 times, most recently from fcbd17e to b2fdbc3 Compare November 14, 2025 10:22
@krzysztof-cabaj krzysztof-cabaj force-pushed the pkg_lwip_ipv4_dependencies_v2 branch from b2fdbc3 to 6be2534 Compare November 14, 2025 10:32
@mguetschow mguetschow enabled auto-merge November 14, 2025 12:54
@mguetschow mguetschow added this pull request to the merge queue Nov 14, 2025
Merged via the queue into RIOT-OS:master with commit 490b595 Nov 14, 2025
28 checks passed
@leandrolanzieri leandrolanzieri added this to the Release 2026.01 milestone Jan 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: network Area: Networking Area: pkg Area: External package ports CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants