- EthIntf: filtering double link setting to the same state

This commit is contained in:
Wiesner András 2024-04-23 23:36:50 +02:00
parent 0750e952c4
commit 499b5f030c

View File

@ -96,9 +96,10 @@ static ThreadReturnType task_ethintf(ThreadParamType param) {
} break; } break;
case ETH_IIE_LINK_CHG_NOTIFY: { case ETH_IIE_LINK_CHG_NOTIFY: {
bool ls = event_data; bool ls = event_data;
ethinf_set_link_state(intf, ls); bool prev_ls = ethinf_get_link_state(intf); // get previous link state
ethinf_set_link_state(intf, ls); // set new link state
if (intf->dhcp != NULL) { if ((intf->dhcp != NULL) && (ls != prev_ls)) { // no double start!
if (ls) { // if link is on if (ls) { // if link is on
dhcp_start(intf->dhcp); dhcp_start(intf->dhcp);
} else { // if link is off } else { // if link is off