-
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
more lwIP physical interfaces #6680
Merged
Merged
Changes from 1 commit
Commits
Show all changes
118 commits
Select commit
Hold shift + click to select a range
04bcb88
Extracts dhcp server from lwip2 and add it to the core.
d-a-v 1793b27
ethernet wip
d-a-v cb198b4
Merge branch 'master' into ethernet
d-a-v de4a287
ethernet wip
d-a-v d279c66
ethernet wip
d-a-v 9229ca5
Merge branch 'master' into ethernet
d-a-v 05d5b68
ethernet wip
d-a-v 9a3df51
ethernet wip
d-a-v c5c921e
ethernet wip: dhcpserver in a class wip
d-a-v 04b5ed7
ethernet wip
d-a-v cc2c2ce
now needed: void preinit(){ESP8266WiFiClass::preinitWiFiOff();}
d-a-v f893c32
ethernet wip
d-a-v 7df15f3
ethernet wip
d-a-v 19146a6
lwip2: no more dhcp inside
d-a-v e89f352
Merge branch 'master' into ethernet
d-a-v 5898985
ethernet wip
d-a-v 833d3af
Merge branch 'master' into ethernet
d-a-v deebbcb
ethernet wip
d-a-v a3b1d91
ethernet wip: dhcp server working for legacy AP on boot, and external…
d-a-v b8485d1
Merge branch 'master' into ethernet
d-a-v 919839d
ethernet wip
d-a-v 16ddd26
Merge branch 'master' into ethernet
d-a-v 574be13
ppp server updates
d-a-v 8d10e91
restyle
d-a-v 756ce0c
PPPServer: example
d-a-v 5b38c0d
astyle
d-a-v b79d841
comments
d-a-v 3fec74a
argument reorder common function for ::config()
d-a-v f15a93c
Merge branch 'ethernet' of github.com:d-a-v/Arduino into ethernet
d-a-v 6ac98da
fix upstream url
d-a-v f35f712
Merge branch 'master' into ethernet
d-a-v a8e231b
sync with lwip2
d-a-v 6be2382
Merge branch 'ethernet' of github.com:d-a-v/Arduino into ethernet
d-a-v c6c3805
sync with lwip2
d-a-v 7bdadd4
missing file
d-a-v 3282a3f
fix dhcp server on AP
d-a-v 370bd62
Merge branch 'master' into ethernet
d-a-v fc6fb1d
fix example
d-a-v 900c594
fix former declaration of dhcp server, and its current use
d-a-v 4b5a2c4
fix dhcp server when ipv6 is enabled
d-a-v 4ebd5c8
fixes for lwip1
d-a-v 1366903
fi macro arithmetic
d-a-v d09d62e
fix example
d-a-v d9d9339
add missing files (ppp)
d-a-v 5816590
fix emulation on host
d-a-v 04d02c3
fix example warnings
d-a-v 6ee5df9
Merge branch 'master' into ethernet
devyte 8f57757
Merge branch 'master' into ethernet
d-a-v 9eb9dee
Merge branch 'ethernet' of github.com:d-a-v/Arduino into ethernet
d-a-v 6b27eaa
Merge branch 'master' into ethernet
d-a-v bd8b32a
move hostname() from STA to generic interface
d-a-v 55b874c
Merge branch 'master' into ethernet
d-a-v 21694be
Merge branch 'master' into ethernet
d-a-v 9d77d1d
Merge branch 'ethernet' of github.com:d-a-v/Arduino into ethernet
d-a-v a81d110
Merge branch 'master' into ethernet
d-a-v b3acf27
Merge branch 'master' into ethernet
d-a-v df04b3c
Merge branch 'ethernet' of github.com:d-a-v/Arduino into ethernet
d-a-v 51aca37
Merge branch 'master' into ethernet
d-a-v 6e12d9e
Merge branch 'ethernet' of github.com:d-a-v/Arduino into ethernet
d-a-v 540e446
sync with lwip2
d-a-v 29d3de7
Merge branch 'master' into ethernet
d-a-v 50fec05
Merge branch 'master' into ethernet
d-a-v 488ae3e
Merge branch 'ethernet' of github.com:d-a-v/Arduino into ethernet
d-a-v 21ffcfe
Merge branch 'master' into ethernet
d-a-v 0b4689b
style
d-a-v 043d32c
fix using softserial API
d-a-v cc2be53
fix warning with macro
d-a-v 0dcfc84
fix include file with lwip1.4
d-a-v 967c349
lwIP-1.4 include fix
d-a-v 0f133cc
lwIP-1.4 include fix
d-a-v 3c15b76
+ comments
d-a-v e0e7cdb
remove non readable characters from comments
d-a-v af93802
magic_cookie is part of bootp rfc
d-a-v 639ef04
more comments
d-a-v a60ffaa
rebuild lwip lib
d-a-v 0673d0d
Merge branch 'master' into ethernet
d-a-v 44a680d
rebuild lwip libs
d-a-v 147f5a9
rebuild lwip libs
d-a-v b18ec7b
fix copy from pointer
d-a-v e258e16
Merge branch 'ethernet' of github.com:d-a-v/Arduino into ethernet
d-a-v fef264e
Merge branch 'master' into ethernet
d-a-v 59fe44e
Merge branch 'ethernet' of github.com:d-a-v/Arduino into ethernet
d-a-v d80cd31
do not filter mac address from within driver (https://github.com/d-a-…
d-a-v 50d9e83
fix compilation problem with IPv6
d-a-v 8b81709
per https://github.com/d-a-v/W5500lwIP/issues/17#issuecomment-638229509
d-a-v 08dca76
Merge branch 'master' into ethernet
d-a-v 03b0670
update
d-a-v 24f0e9a
Merge branch 'ethernet' of github.com:d-a-v/Arduino into ethernet
d-a-v 90da681
Merge branch 'master' into ethernet
d-a-v f8c7f10
fix compilation without local lwip1.4
d-a-v 63354f2
merge with master
d-a-v 5af7382
recompile lwip2
d-a-v 49068fd
fix example
d-a-v 96eb899
Merge branch 'master' into ethernet
d-a-v 8be6533
ppp server: release resource on fail
d-a-v 30a2aa7
reorder members
d-a-v a0239ac
per review and fixes
d-a-v b2dac9b
Merge branch 'master' into ethernet
d-a-v 5928211
Merge branch 'master' into ethernet
d-a-v 55ef5ef
Merge branch 'master' into ethernet
d-a-v 27ff946
Merge branch 'ethernet' of github.com:d-a-v/Arduino into ethernet
d-a-v 94fb55e
Merge branch 'master' into ethernet
d-a-v 97ad7ab
Merge branch 'master' into ethernet
d-a-v 509999b
Merge branch 'master' into ethernet
d-a-v 0a0f8a5
lwip2: recompiled PPP branch after sync w/ master
d-a-v 788928c
fix file name case confusion after merging from master
d-a-v 38fbe41
fix include file name, remove private constructor
d-a-v a3aaa49
fix emulatio on host too
d-a-v 29a3e29
Merge branch 'master' into ethernet
d-a-v dbc55c0
Merge branch 'master' into ethernet
d-a-v 723bed1
Merge branch 'master' into ethernet
earlephilhower ee5acfe
add lwip_hook_dhcp_parse_option()
d-a-v 8094f2d
Merge branch 'ethernet' of github.com:d-a-v/Arduino into ethernet
d-a-v 823a245
Merge branch 'master' into ethernet
d-a-v e67e830
Merge branch 'master' into ethernet
d-a-v 3d459da
lwIP recompilation
d-a-v c5461f6
+ethernet tcp client example in w5500 library examples
d-a-v 90f434f
add cores/esp8266/Lwip* files under AllmanStyle control
d-a-v File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
ethernet wip
- Loading branch information
commit 919839d1a61975c4098a154510b6a27c5ac22cef
There are no files selected for viewing
This file contains 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
This file contains 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 |
---|---|---|
|
@@ -137,10 +137,9 @@ const char mem_debug_file[] ICACHE_RODATA_ATTR = __FILE__; | |
#define LWIP_IS_OK(what,err) ((err) == ERR_OK) | ||
#endif | ||
|
||
|
||
const uint32 DhcpServer::magic_cookie = 0x63538263; | ||
|
||
int fw_has_started_dhcps = 0; | ||
int fw_has_started_softap_dhcps = 0; | ||
|
||
//////////////////////////////////////////////////////////////////////////////////// | ||
|
||
|
@@ -153,11 +152,16 @@ DhcpServer::DhcpServer (netif* netif): _netif(netif) | |
renew = false; | ||
dhcps_lease_time = DHCPS_LEASE_TIME_DEF; //minute | ||
|
||
if (netif->num == SOFTAP_IF && fw_has_started_dhcps == 1) | ||
if (netif->num == SOFTAP_IF && fw_has_started_softap_dhcps == 1) | ||
{ | ||
// nonos-sdk always starts DHCPS at boot | ||
// now that dhcps is in a class, we must wait c++ constructors to be initialized | ||
// when global variable `dhcpSoftAP` (netif number SOFTAP_IF) is initialized, | ||
// this constructor is called and calls begin(legacy-values): | ||
// 192.168.4.1 netmask 255.255.255.0 gateway 0.0.0.0 | ||
ip_info ip = { { 0x0104a8c0 }, { 0x00ffffff }, { 0 } }; | ||
start(&ip); | ||
fw_has_started_dhcps = 2; | ||
begin(&ip); | ||
fw_has_started_softap_dhcps = 2; | ||
} | ||
}; | ||
|
||
|
@@ -990,17 +994,16 @@ void DhcpServer::init_dhcps_lease(uint32 ip) | |
} | ||
/////////////////////////////////////////////////////////////////////////////////// | ||
|
||
void DhcpServer::start (struct ip_info *info) | ||
bool DhcpServer::begin (struct ip_info *info) | ||
{ | ||
if (pcb_dhcps != nullptr) | ||
{ | ||
udp_remove(pcb_dhcps); | ||
} | ||
|
||
pcb_dhcps = udp_new(); | ||
if (pcb_dhcps == nullptr || info == nullptr) | ||
{ | ||
os_printf("dhcps_start(): could not obtain pcb\n"); | ||
return false; | ||
} | ||
|
||
// wrong: answer will go to sta IP4_ADDR(&broadcast_dhcps, 255, 255, 255, 255); | ||
|
@@ -1023,10 +1026,20 @@ void DhcpServer::start (struct ip_info *info) | |
if (_netif->num == SOFTAP_IF) | ||
wifi_set_ip_info(SOFTAP_IF, info); // added for lwip-git, not sure whether useful | ||
_netif->flags |= NETIF_FLAG_UP | NETIF_FLAG_LINK_UP; // added for lwip-git | ||
|
||
return true; | ||
} | ||
|
||
void DhcpServer::stop () | ||
DhcpServer::~DhcpServer () | ||
{ | ||
end(); | ||
} | ||
|
||
void DhcpServer::end () | ||
{ | ||
if (!pcb_dhcps) | ||
return; | ||
|
||
udp_disconnect(pcb_dhcps); | ||
udp_remove(pcb_dhcps); | ||
pcb_dhcps = nullptr; | ||
|
@@ -1055,7 +1068,7 @@ void DhcpServer::stop () | |
} | ||
} | ||
|
||
bool DhcpServer::started () | ||
bool DhcpServer::isRunning () | ||
{ | ||
return !!_netif->state; | ||
} | ||
|
@@ -1070,7 +1083,6 @@ bool DhcpServer::started () | |
*******************************************************************************/ | ||
bool DhcpServer::set_dhcps_lease(struct dhcps_lease *please) | ||
{ | ||
struct ip_info info; | ||
uint32 softap_ip = 0; | ||
uint32 start_ip = 0; | ||
uint32 end_ip = 0; | ||
|
@@ -1084,7 +1096,7 @@ bool DhcpServer::set_dhcps_lease(struct dhcps_lease *please) | |
} | ||
} | ||
|
||
if (please == nullptr || started()) | ||
if (please == nullptr || isRunning()) | ||
{ | ||
return false; | ||
} | ||
|
@@ -1094,6 +1106,7 @@ bool DhcpServer::set_dhcps_lease(struct dhcps_lease *please) | |
#if 1 | ||
softap_ip = ip_2_ip4(&_netif->ip_addr)->addr; | ||
#else | ||
struct ip_info info; | ||
bzero(&info, sizeof(struct ip_info)); | ||
wifi_get_ip_info(SOFTAP_IF, &info); | ||
softap_ip = htonl(info.ip.addr); | ||
|
@@ -1156,21 +1169,21 @@ bool DhcpServer::get_dhcps_lease(struct dhcps_lease *please) | |
// if (dhcps_lease_flag){ | ||
if (dhcps_lease.enable == false) | ||
{ | ||
if (started()) | ||
if (isRunning()) | ||
{ | ||
return false; | ||
} | ||
} | ||
else | ||
{ | ||
// bzero(please, sizeof(dhcps_lease)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why the else with commented code? |
||
// if (!started()){ | ||
// if (!isRunning()){ | ||
// please->start_ip.addr = htonl(dhcps_lease.start_ip.addr); | ||
// please->end_ip.addr = htonl(dhcps_lease.end_ip.addr); | ||
// } | ||
} | ||
|
||
// if (started()){ | ||
// if (isRunning()){ | ||
// bzero(please, sizeof(dhcps_lease)); | ||
// please->start_ip.addr = dhcps_lease.start_ip.addr; | ||
// please->end_ip.addr = dhcps_lease.end_ip.addr; | ||
|
@@ -1249,7 +1262,7 @@ bool DhcpServer::set_dhcps_offer_option(uint8 level, void* optarg) | |
{ | ||
bool offer_flag = true; | ||
//uint8 option = 0; | ||
if (optarg == nullptr && !started()) | ||
if (optarg == nullptr && !isRunning()) | ||
{ | ||
return false; | ||
} | ||
|
@@ -1283,7 +1296,7 @@ bool DhcpServer::set_dhcps_lease_time(uint32 minute) | |
} | ||
} | ||
|
||
if (started()) | ||
if (isRunning()) | ||
{ | ||
return false; | ||
} | ||
|
@@ -1307,7 +1320,7 @@ bool DhcpServer::reset_dhcps_lease_time(void) | |
} | ||
} | ||
|
||
if (started()) | ||
if (isRunning()) | ||
{ | ||
return false; | ||
} | ||
|
This file contains 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 |
---|---|---|
|
@@ -6,18 +6,26 @@ | |
|
||
#if LWIP_VERSION_MAJOR != 1 | ||
|
||
extern "C" int fw_has_started_dhcps; | ||
|
||
class DhcpServer | ||
{ | ||
public: | ||
|
||
DhcpServer (netif* netif); | ||
~DhcpServer (); | ||
|
||
void setDns (int num, const ipv4_addr_t* dns); | ||
|
||
void start (struct ip_info *info); | ||
void stop (); | ||
bool begin (ip_info* info); | ||
void end (); | ||
bool isRunning (); | ||
|
||
// this is the C interface encapsulated in a class | ||
// (originally dhcpserver.c in lwIP-v1.4 in NonOS-SDK) | ||
// (not changing everything at once) | ||
// the API below is subject to change | ||
|
||
// legacy public C structure and API to eventually turn into C++ | ||
|
||
void init_dhcps_lease(uint32 ip); | ||
bool set_dhcps_lease(struct dhcps_lease *please); | ||
|
@@ -27,10 +35,10 @@ class DhcpServer | |
bool reset_dhcps_lease_time(void); | ||
uint32 get_dhcps_lease_time(void); | ||
|
||
bool started (); | ||
|
||
protected: | ||
|
||
// legacy C structure and API to eventually turn into C++ | ||
|
||
typedef struct _list_node { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. prefer direct struct declaration over typedef |
||
void *pnode; | ||
struct _list_node *pnext; | ||
|
@@ -81,7 +89,9 @@ class DhcpServer | |
static const uint32 magic_cookie; | ||
}; | ||
|
||
// SoftAP DHCP server always exists and is started on boot | ||
extern DhcpServer dhcpSoftAP; | ||
extern "C" int fw_has_started_softap_dhcps; | ||
|
||
#endif // LWIP_VERSION_MAJOR != 1 | ||
|
||
|
This file contains 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
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.
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.
@d-a-v the code for old lwip can be removed, ref: #7436
BTW: There will be only one LWIP in 3.0? Just asking to be aware of upcoming changes :)
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.
Not as easy as code removal. Old lwIP include files are needed to compile the other side of the glue.
I'm moving these files into lwip2 repository.
Yes, lwIP1.4 will not be available in esp8266 Arduino core v3.
edit Well I was speaking about lwip2. About dhcpserver this is right, only code removal !