forked from mfulz_github/qmk_firmware
Fix DHCPClient init code in the Webserver project writing to the incorrect application state location (thanks to Mike Alexander).
This commit is contained in:
parent
a71820b259
commit
41ef05a6e5
|
@ -43,17 +43,19 @@ struct timer DHCPTimer;
|
|||
/** Initialization function for the DHCP client. */
|
||||
void DHCPClientApp_Init(void)
|
||||
{
|
||||
uip_udp_appstate_t* const AppState = &uip_udp_conn->appstate;
|
||||
|
||||
/* Create a new UDP connection to the DHCP server port for the DHCP solicitation */
|
||||
/* Create an IP address to the broadcast network address */
|
||||
uip_ipaddr_t DHCPServerIPAddress;
|
||||
uip_ipaddr(&DHCPServerIPAddress, 255, 255, 255, 255);
|
||||
AppState->DHCPClient.Connection = uip_udp_new(&DHCPServerIPAddress, HTONS(DHCPC_SERVER_PORT));
|
||||
|
||||
/* Create a new UDP connection to the DHCP server port for the DHCP solicitation */
|
||||
struct uip_udp_conn* Connection = uip_udp_new(&DHCPServerIPAddress, HTONS(DHCPC_SERVER_PORT));
|
||||
|
||||
/* If the connection was successfully created, bind it to the local DHCP client port */
|
||||
if(AppState->DHCPClient.Connection != NULL)
|
||||
if (Connection != NULL)
|
||||
{
|
||||
uip_udp_bind(AppState->DHCPClient.Connection, HTONS(DHCPC_CLIENT_PORT));
|
||||
uip_udp_appstate_t* const AppState = &Connection->appstate;
|
||||
|
||||
uip_udp_bind(Connection, HTONS(DHCPC_CLIENT_PORT));
|
||||
AppState->DHCPClient.CurrentState = DHCP_STATE_SendDiscover;
|
||||
}
|
||||
|
||||
|
@ -188,13 +190,13 @@ uint16_t DHCPClientApp_FillDHCPHeader(DHCP_Header_t* DHCPHeader, uint8_t DHCPMes
|
|||
DHCPHeader->TransactionID = DHCP_TRANSACTION_ID;
|
||||
DHCPHeader->ElapsedSeconds = 0;
|
||||
DHCPHeader->Flags = HTONS(BOOTP_BROADCAST);
|
||||
memcpy(&DHCPHeader->ClientIP, &uip_hostaddr, sizeof(uip_ipaddr_t));
|
||||
memcpy(&DHCPHeader->YourIP, &AppState->DHCPClient.DHCPOffer_Data.AllocatedIP, sizeof(uip_ipaddr_t));
|
||||
memcpy(&DHCPHeader->NextServerIP, &AppState->DHCPClient.DHCPOffer_Data.ServerIP, sizeof(uip_ipaddr_t));
|
||||
memcpy(&DHCPHeader->ClientIP, &uip_hostaddr, sizeof(uip_ipaddr_t));
|
||||
memcpy(&DHCPHeader->YourIP, &AppState->DHCPClient.DHCPOffer_Data.AllocatedIP, sizeof(uip_ipaddr_t));
|
||||
memcpy(&DHCPHeader->NextServerIP, &AppState->DHCPClient.DHCPOffer_Data.ServerIP, sizeof(uip_ipaddr_t));
|
||||
memcpy(&DHCPHeader->ClientHardwareAddress, &MACAddress, sizeof(struct uip_eth_addr));
|
||||
DHCPHeader->Cookie = DHCP_MAGIC_COOKIE;
|
||||
|
||||
/* Add a DHCP type and terminator options to the start of the DHCP options field */
|
||||
/* Add a DHCP message type and terminator options to the start of the DHCP options field */
|
||||
DHCPHeader->Options[0] = DHCP_OPTION_MSG_TYPE;
|
||||
DHCPHeader->Options[1] = 1;
|
||||
DHCPHeader->Options[2] = DHCPMessageType;
|
||||
|
|
|
@ -717,7 +717,6 @@ typedef union
|
|||
struct
|
||||
{
|
||||
uint8_t CurrentState;
|
||||
struct uip_udp_conn* Connection;
|
||||
|
||||
struct
|
||||
{
|
||||
|
|
|
@ -119,6 +119,7 @@ LUFA_PATH = ../../
|
|||
LUFA_OPTS = -D FIXED_CONTROL_ENDPOINT_SIZE=8
|
||||
LUFA_OPTS += -D FIXED_NUM_CONFIGURATIONS=1
|
||||
LUFA_OPTS += -D USE_FLASH_DESCRIPTORS
|
||||
LUFA_OPTS += -D FAST_STREAM_TRANSFERS
|
||||
LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue