Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Vendor Class Identifier in DHCP offers and requests. #22

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions ioLibrary/Internet/DHCP/dhcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions ioLibrary/Internet/DHCP/dhcp.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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"


Expand Down