Skip to content
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

Uses outdated lwIP API? #17

Closed
lurch opened this issue Jul 23, 2022 · 8 comments · Fixed by #39
Closed

Uses outdated lwIP API? #17

lurch opened this issue Jul 23, 2022 · 8 comments · Fixed by #39

Comments

@lurch
Copy link
Contributor

lurch commented Jul 23, 2022

Related to raspberrypi/pico-examples#247

Whilst I wasn't able to reproduce the originally-reported problem in that issue, curiosity prompted me to do a bit of digging anyway... 😉

https://github.com/georgerobotics/cyw43-driver/blob/main/src/cyw43_lwip.c#L182 does

mdns_resp_add_netif(n, mdns_hostname, 60);

however the third parameter to mdns_resp_add_netif was removed from lwIP on 13th November 2018. Looking at the dates of the lwIP release-tags, I guess this means that there was a backwards-incompatible API change between the 2.1.1 and 2.1.2 versions of lwIP 😕 And annoyingly, even though https://savannah.nongnu.org/projects/lwip mentions the 2.1.3 release of lwIP (which agrees with GitHub), http://www.nongnu.org/lwip/ shows the Doxygen for the 2.1.0 release, which uses the old API 🤦‍♂️

@dpgeorge
Copy link

In MicroPython we use the STABLE-2_1_2_RELEASE of lwIP. The signature of the MDNS function in that release is:

err_t mdns_resp_add_netif(struct netif *netif, const char *hostname, u32_t dns_ttl);

So it looks correct for that version.

I guess the point is, we should update to STABLE-2_1_3_RELEASE 😄

@lurch
Copy link
Contributor Author

lurch commented Jul 26, 2022

In MicroPython we use the STABLE-2_1_2_RELEASE of lwIP.

Well that's kinda awkward, as pico-sdk uses lwip @ 239918c which appears to be the current HEAD of lwIP master.
ping @kilograham and @peterharperuk

Does the code in cyw43-driver need to be conditional on what version of lwIP it's being compiled against?

Looks like lwIP's STABLE-2_1_2_RELEASE is dated 22 Nov 2018, STABLE-2_1_3_RELEASE is dated 10 Nov 2021 and master is dated 9 May 2022.

Oh! Looks like STABLE-2_1_3_RELEASE also has the function-signature mdns_resp_add_netif(struct netif *netif, const char *hostname, u32_t dns_ttl), so I was clearly wrong in my earlier complaint that lwIP were breaking APis in minor version releases, oops 🤦‍♂️

EDIT: Ah, and STABLE-2_1_x (dated 10 Nov 2021) also uses the three-arg form of mdns_resp_add_netif, but is "120 commits ahead, 548 commits behind master" 😭

@dpgeorge
Copy link

Does the code in cyw43-driver need to be conditional on what version of lwIP it's being compiled against?

Yes it probably does. This driver can support various lwIP versions if needed, and to do that would use #if conditions.

But right now I think everything works with STABLE-2_1_2_RELEASE and current HEAD of lwIP master branch?

@lurch
Copy link
Contributor Author

lurch commented Jul 26, 2022

But right now I think everything works with STABLE-2_1_2_RELEASE and current HEAD of lwIP master branch?

Yes, I believe so (the other people I pinged will know more about this than me). But I guess raspberrypi/pico-examples#247 implies that things might break if different preprocessor-definitions are used? 🤷

@dpgeorge
Copy link

See micropython/micropython#8960 for update of MicroPython to 2.1.3.

@peterharperuk
Copy link
Collaborator

Is it really worth our time to get the driver to work with an old version of lwip? It seems to work with 2.1.2, 2.1.3 and master?

@lurch
Copy link
Contributor Author

lurch commented Sep 8, 2022

Yeah, apologies for any confusion my misunderstanding caused - all the 2.1.x versions of lwIP are API-compatible; so it's only the 2.1.x versions and master that have slight API-breakage under specific circumstances. STABLE-2_1_3_RELEASE (as used by MicroPython) is the latest tagged release of lwIP and dates from 10 Nov 2021 whereas lwIP master (as used by pico-sdk) currently dates from 9 May 2022.

I'm happy for this to be closed if everyone is happy with the current situation?

@peterharperuk
Copy link
Collaborator

Actually, I can repro it now on the sdk.

peterharperuk added a commit to peterharperuk/cyw43-driver that referenced this issue Sep 8, 2022
The host name for mDns wasn't using CYW43_HOST_NAME.
The mdns_resp_add_netif changed after lwip version 2.1.2.
Avoid calling mdns_resp_remove_netif if it's not been added.
Call mdns_resp_announce when STA connected.

Fixes georgerobotics#16 and georgerobotics#17
shaun2029 pushed a commit to shaun2029/cyw43-driver that referenced this issue Dec 21, 2022
The lwip mDNS API has changed which can cause problems building it.
The suggestion is that this code should not be in the driver anyway,
so remove it.

Fixes georgerobotics#17
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants