diff --git a/ioLibrary/Internet/DHCP/dhcp.c b/ioLibrary/Internet/DHCP/dhcp.c index f26e2e4..efb7724 100644 --- a/ioLibrary/Internet/DHCP/dhcp.c +++ b/ioLibrary/Internet/DHCP/dhcp.c @@ -224,6 +224,8 @@ uint32_t DHCP_XID; // Any number RIP_MSG* pDHCPMSG; // Buffer pointer for DHCP processing +uint8_t VENDOR_ID[] = DHCP_VENDOR_ID; + uint8_t HOST_NAME[] = DCHP_HOST_NAME; uint8_t DHCP_CHADDR[6] = {0, }; // DHCP Client MAC address. @@ -387,6 +389,13 @@ void send_DHCP_DISCOVER(void) pDHCPMSG->OPT[k++] = 0x01; pDHCPMSG->OPT[k++] = DHCP_DISCOVER; + // Class identifier + pDHCPMSG->OPT[k++] = dhcpClassIdentifier; + pDHCPMSG->OPT[k++] = 0; // fill zero length of class identifier + for(i = 0 ; VENDOR_ID[i] != 0; i++) + pDHCPMSG->OPT[k++] = VENDOR_ID[i]; + pDHCPMSG->OPT[k - (i+1)] = i; + // Client identifier pDHCPMSG->OPT[k++] = dhcpClientIdentifier; pDHCPMSG->OPT[k++] = 0x07; @@ -476,6 +485,13 @@ void send_DHCP_REQUEST(void) pDHCPMSG->OPT[k++] = 0x01; pDHCPMSG->OPT[k++] = DHCP_REQUEST; + // Class identifier + pDHCPMSG->OPT[k++] = dhcpClassIdentifier; + pDHCPMSG->OPT[k++] = 0; // fill zero length of class identifier + for(i = 0 ; VENDOR_ID[i] != 0; i++) + pDHCPMSG->OPT[k++] = VENDOR_ID[i]; + pDHCPMSG->OPT[k - (i+1)] = i; + pDHCPMSG->OPT[k++] = dhcpClientIdentifier; pDHCPMSG->OPT[k++] = 0x07; pDHCPMSG->OPT[k++] = 0x01; diff --git a/ioLibrary/Internet/DHCP/dhcp.h b/ioLibrary/Internet/DHCP/dhcp.h old mode 100644 new mode 100755 index b3df630..1749918 --- a/ioLibrary/Internet/DHCP/dhcp.h +++ b/ioLibrary/Internet/DHCP/dhcp.h @@ -67,6 +67,8 @@ #define MAGIC_COOKIE 0x63825363 ///< Any number. You can be modifyed it any number +#define DHCP_VENDOR_ID "WIZnetSE\0" ///< Vendor ID used for DHCP requests, using Class-Id (option 60) + #define DCHP_HOST_NAME "WIZnet\0"