- Notifications
You must be signed in to change notification settings - Fork13.3k
Initialize SoftAP DhcpServer object on demand#8546
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes from1 commit
Commits
Show all changes
21 commits Select commitHold shift + click to select a range
2a46b8f Initialize SoftAP DhcpServer object on demand
mcspr953cae8 nonos helpers have a separate header
mcsprbb5a7d3 wifi ap needs this anyway, simplify sketch includes
mcspr666bab4 missing example
mcspr92d7cd6 existing name :/
mcsprf42de0a trying to fix header dependency
mcspr70b89c5 restyle
mcsprea92ded not a c header
mcsprcc5fc18 no need to init
mcsprf650e1e Merge branch 'master' into dhcps-init-tweaks
mcspr955c19a move dhcp server getter to WiFi
mcspr8a76b20 ...move things back, still expose as WiFi method
mcspra69d87a review fix
mcspr6d39ad4 Merge remote-tracking branch 'fork/dhcps-init-tweaks' into dhcps-init…
mcsprbfd67da include -nonos header in wifi lib though
mcspr9bc2cb8 Merge remote-tracking branch 'origin/master' into dhcps-init-tweaks
mcspr91ad893 no more lwip include
mcspr205f769 Merge remote-tracking branch 'origin/master' into dhcps-init-tweaks
mcsprefae1be style
mcsprf5a417a need mock dhcpserver instance
mcspr801bc4b Merge branch 'master' into dhcps-init-tweaks
d-a-vFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
NextNext commit
Initialize SoftAP DhcpServer object on demand
Remove dependency on global ctor, and just construct the object whensomeone asks us to do it. Only dependency right now is netif_git, whichis expected to be initialized by the lwip code some time beforedhcps_start happens.Removing ip_info from begin(), since we never reference later on.Also removing the specific check for netif id and simplify the ctors.Update tests and recover old nonos-sdk dhcps functions that were not implemented.
- Loading branch information
Uh oh!
There was an error while loading.Please reload this page.
commit2a46b8fac65d38b5b4effdf25816e892ffe729df
There are no files selected for viewing
87 changes: 61 additions & 26 deletionscores/esp8266/LwipDhcpServer-NonOS.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
49 changes: 10 additions & 39 deletionscores/esp8266/LwipDhcpServer.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
35 changes: 19 additions & 16 deletionscores/esp8266/LwipDhcpServer.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
5 changes: 3 additions & 2 deletionslibraries/ESP8266WiFi/examples/RangeExtender-NAPT/RangeExtender-NAPT.ino
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
16 changes: 10 additions & 6 deletionslibraries/ESP8266WiFi/src/ESP8266WiFiAP.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -37,7 +37,9 @@ extern "C" { | ||
| } | ||
| #include "debug.h" | ||
| #include <LwipDhcpServer.h> | ||
| #include <LwipDhcpServer-NonOS.h> | ||
| // ----------------------------------------------------------------------------------------------------------------------- | ||
| // ---------------------------------------------------- Private functions ------------------------------------------------ | ||
| @@ -166,7 +168,8 @@ bool ESP8266WiFiAPClass::softAP(const char* ssid, const char* psk, int channel, | ||
| DEBUG_WIFI("[AP] softap config unchanged\n"); | ||
| } | ||
| auto& server = dhcpSoftAP(); | ||
| server.end(); | ||
| // check IP config | ||
| struct ip_info ip; | ||
| @@ -186,7 +189,7 @@ bool ESP8266WiFiAPClass::softAP(const char* ssid, const char* psk, int channel, | ||
| ret = false; | ||
| } | ||
| server.begin(); | ||
| return ret; | ||
| } | ||
| @@ -244,21 +247,22 @@ bool ESP8266WiFiAPClass::softAPConfig(IPAddress local_ip, IPAddress gateway, IPA | ||
| dhcp_lease.end_ip.addr = ip.v4(); | ||
| DEBUG_WIFI("[APConfig] DHCP IP end: %s\n", ip.toString().c_str()); | ||
| auto& server = dhcpSoftAP(); | ||
| if(!server.set_dhcps_lease(&dhcp_lease)) | ||
| { | ||
| DEBUG_WIFI("[APConfig] wifi_set_ip_info failed!\n"); | ||
| ret = false; | ||
| } | ||
| // set lease time to 720min --> 12h | ||
| if(!server.set_dhcps_lease_time(720)) | ||
| { | ||
d-a-v marked this conversation as resolved. OutdatedShow resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| DEBUG_WIFI("[APConfig] wifi_softap_set_dhcps_lease_time failed!\n"); | ||
| ret = false; | ||
| } | ||
| uint8 mode = info.gw.addr ? 1 : 0; | ||
| if(!server.set_dhcps_offer_option(OFFER_ROUTER, &mode)) | ||
| { | ||
| DEBUG_WIFI("[APConfig] wifi_softap_set_dhcps_offer_option failed!\n"); | ||
| ret = false; | ||
12 changes: 7 additions & 5 deletionstests/host/common/user_interface.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.