-
Notifications
You must be signed in to change notification settings - Fork 13.3k
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
DHCP custom option #8582
DHCP custom option #8582
Conversation
To the risk of being pedantic, If there a way to retrieve user option from flash ? |
Sure, but what is the use-case anyway? Suppose, we have #8451 with a pointer attached to the instance instead dhcpSoftAP.custom_offer_options = [](auto& options, const DhcpServer& server) {
options.add(/* code = */ 43, /* data = */ {0xca, 0xfe, 0xca, 0xfe, 0xfe});
char clientId[32];
... somehow generate it from server._netif data ...
options.add(93, reinterpret_cast<const uint8_t*>(&clientId[0]), len);
}; Where |
My fingers always hurt when storing an array in a source code, which is copied on boot from flash to ram, then by code from ram to ram. Data are there three times, so this was my question. Of course some dhcp configuration blocks are dynamic, so it should not be prevented to deal with them.
But yes, dhcp data blocks are often dynamic and among the static ones not many are long enough to get a real ram gain. |
With the above, add() could accept u8 pointer then and do memcpy. |
Updated. Since it is also a showcase of the existing options helpers, size of changes... increased (sry). Overloading |
/to d-a-v it has automatic storage, here it's the same stack based one (just one less line for us)
libraries/ESP8266WiFi/examples/RangeExtender-NAPT/RangeExtender-NAPT.ino
Outdated
Show resolved
Hide resolved
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.
Nice one !
Hello, In 'LwipDhcpServer.cpp' line 444 I found: shouldn't that be: (use 'm' instead of '&m')? Also, in 'ESP8266WiFiAP.cpp', the call to In previous cores, I can use custom IP such as '192.168.0.XXX' using DHCP in access point mode, but if Could you verify those two? Thank you! |
it should. just a bad c/p
|
As noticed in esp8266#8582 (comment) Plus, handle the case when `pbuf->len` is less than struct size
As noticed in esp8266#8582 (comment) Can't really use `server.begin()` and `server.end()` directly, only default static IP is applied to the interface since DHCP server is deemed 'running' (see `wifi_softap_dhcps_status()` return value)
* Fix sending NACK, use helper function to fill pbuf As noticed in #8582 (comment) Plus, handle the case when `pbuf->len` is less than struct size * Make sure to call SDK functions to start and stop DHCP server As noticed in #8582 (comment) Can't really use `server.begin()` and `server.end()` directly, only default static IP is applied to the interface since DHCP server is deemed 'running' (see `wifi_softap_dhcps_status()` return value) * s Co-authored-by: david gauchard <[email protected]>
* works * fixup! works * back to callbacks * names * daisy chain * seconds * less inline * fix dns setter * might as well keep using initlist /to d-a-v it has automatic storage, here it's the same stack based one (just one less line for us) * shift blame * naming * fix impl * revert to ip4 dns * merge fix * restyle * masking done wrong
…266#8602) * Fix sending NACK, use helper function to fill pbuf As noticed in esp8266#8582 (comment) Plus, handle the case when `pbuf->len` is less than struct size * Make sure to call SDK functions to start and stop DHCP server As noticed in esp8266#8582 (comment) Can't really use `server.begin()` and `server.end()` directly, only default static IP is applied to the interface since DHCP server is deemed 'running' (see `wifi_softap_dhcps_status()` return value) * s Co-authored-by: david gauchard <[email protected]>
@bwjohns4
re comments in #8571