When sending packets directly to the DHCP server, use a socket and send
directly rather than bogusly sending it out as a link layer broadcast (which fails to be received on some networks). PR: bin/96018 MFC after: 2 weeks
This commit is contained in:
parent
059c9e5c61
commit
8ca3089abc
@ -245,6 +245,21 @@ send_packet(struct interface_info *interface, struct dhcp_packet *raw,
|
||||
unsigned char buf[256];
|
||||
struct iovec iov[2];
|
||||
int result, bufp = 0;
|
||||
int sock;
|
||||
|
||||
if (to->sin_addr.s_addr != INADDR_BROADCAST) {
|
||||
note("SENDING DIRECT");
|
||||
/* We know who the server is, send the packet via
|
||||
normal socket interface */
|
||||
|
||||
if ((sock = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP)) >= 0) {
|
||||
result = sendto (sock, (char *)raw, len, 0,
|
||||
(struct sockaddr *)to, sizeof *to);
|
||||
close(sock);
|
||||
if (result > 0)
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
/* Assemble the headers... */
|
||||
assemble_hw_header(interface, buf, &bufp, hto);
|
||||
|
Loading…
x
Reference in New Issue
Block a user