]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS-Plus/Source/FreeRTOS-Plus-UDP/FreeRTOS_DHCP.c
Improve DCHP handling by removing the yiaddr field from outgoing DHCP packets and...
[freertos] / FreeRTOS-Plus / Source / FreeRTOS-Plus-UDP / FreeRTOS_DHCP.c
index f2226726b36acfd0ded648984df8036aab0a845b..aab435bda52da6674a6f42d3deff2bef022f414d 100644 (file)
@@ -135,10 +135,12 @@ made up of the length byte, and minimum one byte value. */
        #define dhcpCLIENT_PORT 0x4400\r
        #define dhcpSERVER_PORT 0x4300\r
        #define dhcpCOOKIE              0x63538263\r
+       #define dhcpBROADCAST   0x0080\r
 #else\r
        #define dhcpCLIENT_PORT 0x0044\r
        #define dhcpSERVER_PORT 0x0043\r
        #define dhcpCOOKIE              0x63825363\r
+       #define dhcpBROADCAST   0x8000\r
 #endif /* ipconfigBYTE_ORDER */\r
 \r
 #include "pack_struct_start.h"\r
@@ -296,7 +298,9 @@ void vDHCPProcess( portBASE_TYPE xReset, xMACAddress_t *pxMACAddress, uint32_t *
                                                /* Static configuration is being used, so the network is now up. */\r
                                                #if ipconfigFREERTOS_PLUS_NABTO == 1\r
                                                {\r
-                                                       vStartNabtoTask();\r
+                                                       /* Return value is used in configASSERT() inside the \r
+                                                       function. */\r
+                                                       ( void ) xStartNabtoTask();\r
                                                }\r
                                                #endif /* ipconfigFREERTOS_PLUS_NABTO */\r
 \r
@@ -324,10 +328,13 @@ void vDHCPProcess( portBASE_TYPE xReset, xMACAddress_t *pxMACAddress, uint32_t *
                                }\r
                                #endif\r
 \r
-                               /* Static configuration is being used, so the network is now up. */\r
+                               /* Static configuration is being used, so the network is now \r
+                               up. */\r
                                #if ipconfigFREERTOS_PLUS_NABTO == 1\r
                                {\r
-                                       vStartNabtoTask();\r
+                                       /* Return value is used in configASSERT() inside the \r
+                                       function. */\r
+                                       ( void ) xStartNabtoTask();\r
                                }\r
                                #endif /* ipconfigFREERTOS_PLUS_NABTO */\r
 \r
@@ -640,8 +647,8 @@ uint8_t *pucUDPPayloadBuffer;
        pxDHCPMessage->ucAddressType = dhcpADDRESS_TYPE_ETHERNET;\r
        pxDHCPMessage->ucAddressLength = dhcpETHERNET_ADDRESS_LENGTH;\r
        pxDHCPMessage->ulTransactionID = ulTransactionId;\r
-       pxDHCPMessage->ulYourIPAddress_yiaddr = ulOfferedIPAddress;\r
        pxDHCPMessage->ulDHCPCookie = dhcpCOOKIE;\r
+       pxDHCPMessage->usFlags = dhcpBROADCAST;\r
        memcpy( ( void * ) &( pxDHCPMessage->ucClientHardwareAddress[ 0 ] ), ( void * ) pxMACAddress, sizeof( xMACAddress_t ) );\r
 \r
        /* Copy in the const part of the options options. */\r