diff options
Diffstat (limited to 'Demos')
-rw-r--r-- | Demos/Device/ClassDriver/RNDISEthernet/Lib/DHCP.c | 12 | ||||
-rw-r--r-- | Demos/Device/ClassDriver/RNDISEthernet/Lib/DHCP.h | 3 | ||||
-rw-r--r-- | Demos/Device/LowLevel/RNDISEthernet/Lib/DHCP.c | 12 | ||||
-rw-r--r-- | Demos/Device/LowLevel/RNDISEthernet/Lib/DHCP.h | 3 |
4 files changed, 26 insertions, 4 deletions
diff --git a/Demos/Device/ClassDriver/RNDISEthernet/Lib/DHCP.c b/Demos/Device/ClassDriver/RNDISEthernet/Lib/DHCP.c index 7b191b11c..816e33c37 100644 --- a/Demos/Device/ClassDriver/RNDISEthernet/Lib/DHCP.c +++ b/Demos/Device/ClassDriver/RNDISEthernet/Lib/DHCP.c @@ -95,12 +95,20 @@ int16_t DHCP_ProcessDHCPPacket(void* IPHeaderInStart, : DHCP_MESSAGETYPE_ACK; *(DHCPOptionsOUTStart++) = DHCP_OPTION_SUBNETMASK; - *(DHCPOptionsOUTStart++) = 4; + *(DHCPOptionsOUTStart++) = sizeof(IP_Address_t); *(DHCPOptionsOUTStart++) = 0xFF; *(DHCPOptionsOUTStart++) = 0xFF; *(DHCPOptionsOUTStart++) = 0xFF; *(DHCPOptionsOUTStart++) = 0x00; + *(DHCPOptionsOUTStart++) = DHCP_OPTION_LEASETIME; + *(DHCPOptionsOUTStart++) = sizeof(uint32_t); + /* Lease Time 86400s (ONE_DAY) */ + *(DHCPOptionsOUTStart++) = 0x00; + *(DHCPOptionsOUTStart++) = 0x01; + *(DHCPOptionsOUTStart++) = 0x51; + *(DHCPOptionsOUTStart++) = 0x80; + *(DHCPOptionsOUTStart++) = DHCP_OPTION_DHCPSERVER; *(DHCPOptionsOUTStart++) = sizeof(IP_Address_t); memcpy(DHCPOptionsOUTStart, &ServerIPAddress, sizeof(IP_Address_t)); @@ -108,7 +116,7 @@ int16_t DHCP_ProcessDHCPPacket(void* IPHeaderInStart, *(DHCPOptionsOUTStart++) = DHCP_OPTION_END; - return (sizeof(DHCP_Header_t) + 12 + sizeof(IP_Address_t)); + return (sizeof(DHCP_Header_t) + 18 + sizeof(IP_Address_t)); } } diff --git a/Demos/Device/ClassDriver/RNDISEthernet/Lib/DHCP.h b/Demos/Device/ClassDriver/RNDISEthernet/Lib/DHCP.h index 325fe0353..e2ba4fc65 100644 --- a/Demos/Device/ClassDriver/RNDISEthernet/Lib/DHCP.h +++ b/Demos/Device/ClassDriver/RNDISEthernet/Lib/DHCP.h @@ -60,6 +60,9 @@ /** DHCP option list entry header, indicating that a subnet mask will follow. */ #define DHCP_OPTION_SUBNETMASK 1 + /** DHCP option list entry header, indicating that the Lease Time will follow. */ + #define DHCP_OPTION_LEASETIME 51 + /** DHCP option list entry header, indicating that the DHCP message type constant will follow. */ #define DHCP_OPTION_MESSAGETYPE 53 diff --git a/Demos/Device/LowLevel/RNDISEthernet/Lib/DHCP.c b/Demos/Device/LowLevel/RNDISEthernet/Lib/DHCP.c index fc501c308..0e98977df 100644 --- a/Demos/Device/LowLevel/RNDISEthernet/Lib/DHCP.c +++ b/Demos/Device/LowLevel/RNDISEthernet/Lib/DHCP.c @@ -95,12 +95,20 @@ int16_t DHCP_ProcessDHCPPacket(void* IPHeaderInStart, : DHCP_MESSAGETYPE_ACK; *(DHCPOptionsOUTStart++) = DHCP_OPTION_SUBNETMASK; - *(DHCPOptionsOUTStart++) = 4; + *(DHCPOptionsOUTStart++) = sizeof(IP_Address_t); *(DHCPOptionsOUTStart++) = 0xFF; *(DHCPOptionsOUTStart++) = 0xFF; *(DHCPOptionsOUTStart++) = 0xFF; *(DHCPOptionsOUTStart++) = 0x00; + *(DHCPOptionsOUTStart++) = DHCP_OPTION_LEASETIME; + *(DHCPOptionsOUTStart++) = sizeof(uint32_t); + /* Lease Time 86400s (ONE_DAY) */ + *(DHCPOptionsOUTStart++) = 0x00; + *(DHCPOptionsOUTStart++) = 0x01; + *(DHCPOptionsOUTStart++) = 0x51; + *(DHCPOptionsOUTStart++) = 0x80; + *(DHCPOptionsOUTStart++) = DHCP_OPTION_DHCPSERVER; *(DHCPOptionsOUTStart++) = sizeof(IP_Address_t); memcpy(DHCPOptionsOUTStart, &ServerIPAddress, sizeof(IP_Address_t)); @@ -108,7 +116,7 @@ int16_t DHCP_ProcessDHCPPacket(void* IPHeaderInStart, *(DHCPOptionsOUTStart++) = DHCP_OPTION_END; - return (sizeof(DHCP_Header_t) + 12 + sizeof(IP_Address_t)); + return (sizeof(DHCP_Header_t) + 18 + sizeof(IP_Address_t)); } } diff --git a/Demos/Device/LowLevel/RNDISEthernet/Lib/DHCP.h b/Demos/Device/LowLevel/RNDISEthernet/Lib/DHCP.h index 325fe0353..e2ba4fc65 100644 --- a/Demos/Device/LowLevel/RNDISEthernet/Lib/DHCP.h +++ b/Demos/Device/LowLevel/RNDISEthernet/Lib/DHCP.h @@ -60,6 +60,9 @@ /** DHCP option list entry header, indicating that a subnet mask will follow. */ #define DHCP_OPTION_SUBNETMASK 1 + /** DHCP option list entry header, indicating that the Lease Time will follow. */ + #define DHCP_OPTION_LEASETIME 51 + /** DHCP option list entry header, indicating that the DHCP message type constant will follow. */ #define DHCP_OPTION_MESSAGETYPE 53 |