aboutsummaryrefslogtreecommitdiffstats
path: root/Demos/Device/ClassDriver
diff options
context:
space:
mode:
authorStefan Hellermann <stefan@the2masters.de>2015-09-30 09:59:19 +0200
committerStefan Hellermann <stefan@the2masters.de>2015-09-30 09:59:19 +0200
commit55adec1f4f9b600ade83c9269632cdc4b6a8b9e1 (patch)
treeb742f9c2b4fd5ab350f24022b713cd26115e1898 /Demos/Device/ClassDriver
parent7638128d47f90dafbbf8bc2454971afd726e005e (diff)
downloadlufa-55adec1f4f9b600ade83c9269632cdc4b6a8b9e1.tar.gz
lufa-55adec1f4f9b600ade83c9269632cdc4b6a8b9e1.tar.bz2
lufa-55adec1f4f9b600ade83c9269632cdc4b6a8b9e1.zip
Add DHCP Lease Time to RNDIS Demo
The RNDIS ClassDriver and LowLevel Demo won't work on some Linux hosts as their DHCP client requires the DHCP Option Lease Time. Add it to both Demos. Tested on Fedora Linux 22.
Diffstat (limited to 'Demos/Device/ClassDriver')
-rw-r--r--Demos/Device/ClassDriver/RNDISEthernet/Lib/DHCP.c12
-rw-r--r--Demos/Device/ClassDriver/RNDISEthernet/Lib/DHCP.h3
2 files changed, 13 insertions, 2 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