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

dhcpserver.c LWIP_HOOK_DHCPS_POST_APPEND_OPTS invocation contains incorrect struct member (IDFGH-10098) #11373

Closed
3 tasks done
wuyuanyi135 opened this issue May 10, 2023 · 4 comments · Fixed by #11374
Closed
3 tasks done
Assignees
Labels
Resolution: NA Issue resolution is unavailable Status: Done Issue is done internally Type: Bug bugs in IDF

Comments

@wuyuanyi135
Copy link
Contributor

wuyuanyi135 commented May 10, 2023

Answers checklist.

  • I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
  • I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

IDF version.

v5.0.1

Operating System used.

Windows

How did you build your project?

Command line with CMake

If you are using Windows, please specify command line type.

PowerShell

What is the expected behavior?

N/A

What is the actual behavior?

When trying to implement the hook as mentioned in #11372

The following line contains an error about the dereference to member netif

LWIP_HOOK_DHCPS_POST_APPEND_OPTS(dhcps->netif, dhcps, DHCPOFFER, &end)

which should be correct to LWIP_HOOK_DHCPS_POST_APPEND_OPTS(dhcps->dhcps_netif, dhcps, DHCPOFFER, &end)

There are three invocations that should be corrected.

In summary,

diff --git a/components/lwip/apps/dhcpserver/dhcpserver.c b/components/lwip/apps/dhcpserver/dhcpserver.c
index 4a65f86..ce7d39b 100644
--- a/components/lwip/apps/dhcpserver/dhcpserver.c
+++ b/components/lwip/apps/dhcpserver/dhcpserver.c
@@ -546,7 +557,7 @@ static void send_offer(dhcps_t *dhcps, struct dhcps_msg *m, u16_t len)

     end = add_msg_type(&m->options[4], DHCPOFFER);
     end = add_offer_options(dhcps, end);
-    LWIP_HOOK_DHCPS_POST_APPEND_OPTS(dhcps->netif, dhcps, DHCPOFFER, &end)
+    LWIP_HOOK_DHCPS_POST_APPEND_OPTS(dhcps->dhcps_netif, dhcps, DHCPOFFER, &end)
     end = add_end(end);

     p = dhcps_pbuf_alloc(len);
@@ -624,7 +635,7 @@ static void send_nak(dhcps_t *dhcps, struct dhcps_msg *m, u16_t len)
     create_msg(dhcps, m);

     end = add_msg_type(&m->options[4], DHCPNAK);
-    LWIP_HOOK_DHCPS_POST_APPEND_OPTS(dhcps->netif, dhcps, DHCPNAK, &end)
+    LWIP_HOOK_DHCPS_POST_APPEND_OPTS(dhcps->dhcps_netif, dhcps, DHCPNAK, &end)
     end = add_end(end);

     p = dhcps_pbuf_alloc(len);
@@ -701,7 +712,7 @@ static void send_ack(dhcps_t *dhcps, struct dhcps_msg *m, u16_t len)

     end = add_msg_type(&m->options[4], DHCPACK);
     end = add_offer_options(dhcps, end);
-    LWIP_HOOK_DHCPS_POST_APPEND_OPTS(dhcps->netif, dhcps, DHCPACK, &end)
+    LWIP_HOOK_DHCPS_POST_APPEND_OPTS(dhcps->dhcps_netif, dhcps, DHCPACK, &end)
     end = add_end(end);

     p = dhcps_pbuf_alloc(len);

This compilation error exists in both v5.0.1 and master branch.

Steps to reproduce.

Build or installation Logs.

C:/Espressif/frameworks/esp-idf-v5.0.1/components/lwip/apps/dhcpserver/dhcpserver.c:560:43: error: 'dhcps_t' has no member named 'netif'
  560 |     LWIP_HOOK_DHCPS_POST_APPEND_OPTS(dhcps->netif, dhcps, DHCPOFFER, &end)

More Information.

No response

@wuyuanyi135 wuyuanyi135 added the Type: Bug bugs in IDF label May 10, 2023
@espressif-bot espressif-bot added the Status: Opened Issue is new label May 10, 2023
@github-actions github-actions bot changed the title dhcpserver.c LWIP_HOOK_DHCPS_POST_APPEND_OPTS invocation contains incorrect struct member dhcpserver.c LWIP_HOOK_DHCPS_POST_APPEND_OPTS invocation contains incorrect struct member (IDFGH-10098) May 10, 2023
@wuyuanyi135
Copy link
Contributor Author

Anyone takes care of this issue?

@david-cermak
Copy link
Collaborator

Thanks for reporting this bug and fixing it! If you feel like it you can open a PR with your correction in https://github.com/espressif/esp-idf/pulls

@AxelLin
Copy link
Contributor

AxelLin commented May 17, 2023

@david-cermak
FYI, #11374

@espressif-bot espressif-bot added Status: In Progress Work is in progress and removed Status: Opened Issue is new labels May 17, 2023
@espressif-bot espressif-bot added Status: Done Issue is done internally Resolution: NA Issue resolution is unavailable and removed Status: In Progress Work is in progress labels Jun 12, 2023
@wuyuanyi135
Copy link
Contributor Author

@david-cermak Hi. I just noticed this fix was marked as NA. Could you please explain what the problem is?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: NA Issue resolution is unavailable Status: Done Issue is done internally Type: Bug bugs in IDF
Projects
None yet
4 participants