Andrew Boyson / net

Dependents:   oldheating gps motorhome heating

Files at this revision

API Documentation at this revision

Comitter:
andrewboyson
Date:
Thu Dec 31 12:32:51 2020 +0000
Parent:
179:55342264fca1
Child:
181:169881ecd52f
Commit message:
Fixed DHCP problem with not providing the offered IP in the request resulting in a NAQ.

Changed in this revision

udp/dhcp/dhcp.c Show annotated file Show diff for this revision Revisions of this file
--- a/udp/dhcp/dhcp.c	Wed Dec 30 19:26:19 2020 +0000
+++ b/udp/dhcp/dhcp.c	Thu Dec 31 12:32:51 2020 +0000
@@ -273,11 +273,12 @@
     {
         case DHCPOFFER:
             if (DhcpTrace) { LogTime("DHCP <- offer ip "); Ip4AddressLog(yiaddr); Log("\r\n"); }
+            DhcpLocalIp = yiaddr; //Save the offered ip - should really be in another variable as we have not had the ACK yet from our request but hey ho.
             *pSizeTx = sendRequest(pPacketTx, DHCPREQUEST, siaddr, yiaddr);
             return BROADCAST;
         case DHCPACK:
             if (DhcpTrace) { LogTime("DHCP <- ack ip ");   Ip4AddressLog(yiaddr); Log("\r\n"); }
-            DhcpLocalIp = yiaddr;
+            DhcpLocalIp = yiaddr; //Save our IP
             elapsedLifeMsTimer = MsTimerCount;  //Start the life timer
             delayMs = MIN_REPEAT_DELAY_TIME_MS; //Set the delay time back to minimum
             break;