mirror of
https://github.com/cesanta/mongoose.git
synced 2024-12-28 07:28:13 +08:00
Merge pull request #2571 from cesanta/dhcpsidfb
Fallback to IP source address on DHCP servers not filling sid
This commit is contained in:
commit
0d2ae10bd9
@ -4873,7 +4873,8 @@ static void rx_dhcp_client(struct mg_tcpip_if *ifp, struct pkt *pkt) {
|
||||
ifp->state = MG_TCPIP_STATE_UP, ifp->ip = 0;
|
||||
} else if (msgtype == 2 && ifp->state == MG_TCPIP_STATE_UP && ip && gw &&
|
||||
lease) { // DHCPOFFER
|
||||
tx_dhcp_request_sel(ifp, ip, pkt->dhcp->siaddr); // select IP, (4.4.1)
|
||||
// select IP, (4.4.1) (fallback to IP source addr on foul play)
|
||||
tx_dhcp_request_sel(ifp, ip, pkt->dhcp->siaddr ? pkt->dhcp->siaddr : pkt->ip->src);
|
||||
ifp->state = MG_TCPIP_STATE_REQ; // REQUESTING state
|
||||
} else if (msgtype == 5) { // DHCPACK
|
||||
if (ifp->state == MG_TCPIP_STATE_REQ && ip && gw && lease) { // got an IP
|
||||
|
@ -398,7 +398,8 @@ static void rx_dhcp_client(struct mg_tcpip_if *ifp, struct pkt *pkt) {
|
||||
ifp->state = MG_TCPIP_STATE_UP, ifp->ip = 0;
|
||||
} else if (msgtype == 2 && ifp->state == MG_TCPIP_STATE_UP && ip && gw &&
|
||||
lease) { // DHCPOFFER
|
||||
tx_dhcp_request_sel(ifp, ip, pkt->dhcp->siaddr); // select IP, (4.4.1)
|
||||
// select IP, (4.4.1) (fallback to IP source addr on foul play)
|
||||
tx_dhcp_request_sel(ifp, ip, pkt->dhcp->siaddr ? pkt->dhcp->siaddr : pkt->ip->src);
|
||||
ifp->state = MG_TCPIP_STATE_REQ; // REQUESTING state
|
||||
} else if (msgtype == 5) { // DHCPACK
|
||||
if (ifp->state == MG_TCPIP_STATE_REQ && ip && gw && lease) { // got an IP
|
||||
|
Loading…
x
Reference in New Issue
Block a user