-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pkg/lwip: Fix dualstack build when only using 6lowpan #17174
Conversation
Why only "Part of" and not "Fixes"? |
This can be fixed when applying diff --git a/pkg/lwip/contrib/netdev/lwip_netdev.c b/pkg/lwip/contrib/netdev/lwip_netdev.c
index e70e4eacee..34398470db 100644
--- a/pkg/lwip/contrib/netdev/lwip_netdev.c
+++ b/pkg/lwip/contrib/netdev/lwip_netdev.c
@@ -159,17 +159,19 @@ err_t lwip_netdev_init(struct netif *netif)
if (netdev->driver->set(netdev, NETOPT_SRC_LEN, &val, sizeof(val)) < 0) {
return ERR_IF;
}
- /* netif_create_ip6_linklocal_address() does weird byte-swapping
- * with full IIDs, so let's do it ourselves */
- addr = ip_2_ip6(&(netif->ip6_addr[0]));
- /* addr->addr is a uint32_t array */
- if (l2util_ipv6_iid_from_addr(dev_type,
- netif->hwaddr, netif->hwaddr_len,
- (eui64_t *)&addr->addr[2]) < 0) {
- return ERR_IF;
+ if (IS_USED(MODULE_IPV6_ADDR)) {
+ /* netif_create_ip6_linklocal_address() does weird byte-swapping
+ * with full IIDs, so let's do it ourselves */
+ addr = ip_2_ip6(&(netif->ip6_addr[0]));
+ /* addr->addr is a uint32_t array */
+ if (l2util_ipv6_iid_from_addr(dev_type,
+ netif->hwaddr, netif->hwaddr_len,
+ (eui64_t *)&addr->addr[2]) < 0) {
+ return ERR_IF;
+ }
+ ipv6_addr_set_link_local_prefix((ipv6_addr_t *)&addr->addr[0]);
+ ip6_addr_assign_zone(addr, IP6_UNICAST, netif);
}
- ipv6_addr_set_link_local_prefix((ipv6_addr_t *)&addr->addr[0]);
- ip6_addr_assign_zone(addr, IP6_UNICAST, netif);
/* Set address state. */
#if LWIP_IPV6_DUP_DETECT_ATTEMPTS
/* Will perform duplicate address detection (DAD). */ However, then another error is revealed:
Which is weird, as this part of the code is diff --git a/tests/lwip/Makefile b/tests/lwip/Makefile
index c7b2472561..42dde78c7c 100644
--- a/tests/lwip/Makefile
+++ b/tests/lwip/Makefile
@@ -16,0 +17,2 @@ endif
+$(warning $(LWIP_IPV6))
+ |
Ah... Lines 175 to 179 in ff8983c
selects Lines 59 to 62 in ff8983c
which leads to Lines 26 to 28 in ff8983c
IMHO the very first dependency listed should depend on |
Only part of because it only fixes the dualstack issue, and not when IPv6 is totally missing. I don't think we should guard on ipv6_addr, it could be useful to still format such addresses without having protocol support for them. The issue might be that |
Then |
But yes, this can be done as a follow-up. Likewise the dependency fix. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixes the issue described in #17162.
🎉 Congrats on your first merge commit! |
Contribution description
ip6_addr_t
(which is noop in v6-only setup)Testing procedure
BOARD=iotlab-m3 LWIP_IPV4=1 LWIP_IPV6=1 make -C tests/lwip -j
now worksBOARD=iotlab-m3 LWIP_IPV4=1 make -C tests/lwip -j
is still broken (since it disables IPv6): linking fails withundefined reference to 'ipv6_addr_link_local_prefix'
Issues/PRs references
Part of #17162