Support for broken clients (MSFT 98)

This commit is contained in:
Russ Dill 2001-08-24 21:56:24 +00:00
parent 15a8ed91b4
commit 94b1de2e09
2 changed files with 20 additions and 19 deletions

View File

@ -23,6 +23,12 @@
int get_packet(struct dhcpMessage *packet, int fd)
{
int bytes;
int i;
char broken_vendors[][8] = {
"MSFT 98",
""
};
char *vendor;
memset(packet, 0, sizeof(struct dhcpMessage));
bytes = read(fd, packet, sizeof(struct dhcpMessage));
@ -36,6 +42,20 @@ int get_packet(struct dhcpMessage *packet, int fd)
return -1;
}
DEBUG(LOG_INFO, "oooooh!!! got some!");
if (packet->op == BOOTREQUEST && (vendor = get_option(packet, DHCP_VENDOR))) {
for (i = 0; broken_vendors[i][0]; i++) {
if (vendor[OPT_LEN - 2] == (signed) strlen(broken_vendors[i]) &&
!strncmp(vendor, broken_vendors[i], vendor[OPT_LEN - 2]) &&
!(ntohs(packet->flags) & BROADCAST_FLAG)) {
DEBUG(LOG_INFO, "broken client (%s), forcing broadcast",
broken_vendors[i]);
packet->flags |= htons(BROADCAST_FLAG);
}
}
}
return bytes;
}

View File

@ -46,25 +46,6 @@ static int send_packet_to_client(struct dhcpMessage *payload, int force_broadcas
{
u_int32_t ciaddr;
char chaddr[6];
int i;
char broken_vendors[][8] = {
"MSFT 98",
""
};
char *vendor;
if ((vendor = get_option(payload, DHCP_VENDOR))) {
for (i = 0; broken_vendors[i][0]; i++) {
if (vendor[OPT_LEN - 2] == (signed) strlen(broken_vendors[i]) &&
!strncmp(vendor, broken_vendors[i], vendor[OPT_LEN - 2]) &&
!(ntohs(payload->flags) & BROADCAST_FLAG)) {
DEBUG(LOG_INFO, "broken client (%s), forcing broadcast\n",
broken_vendors[i]);
payload->flags |= htons(BROADCAST_FLAG);
}
}
}
if (force_broadcast) {
DEBUG(LOG_INFO, "broadcasting packet to client (NAK)");