diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2005-01-31 21:23:09 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2005-01-31 21:23:09 +0000 |
commit | 6878c60384a68a15e48842a2b9c6426ce0c5ce3e (patch) | |
tree | f5fd1d8f640f7e60a6882a3247b65f80cbe105e6 /usr.sbin/dhcpd | |
parent | b01697208e456c3cde9d056745fef3aadc840010 (diff) |
Simply use the ethernet source address of the request as new ethernet
destination instead of the one included in the dhcp packet. Especially
because there are to many cases where the supplied address is wrong.
This hopefully solves all problems with gateways involved, like the
one reported by Dylan Martin.
OK krw@ henning@ millert@
Diffstat (limited to 'usr.sbin/dhcpd')
-rw-r--r-- | usr.sbin/dhcpd/bootp.c | 10 | ||||
-rw-r--r-- | usr.sbin/dhcpd/dhcp.c | 15 |
2 files changed, 4 insertions, 21 deletions
diff --git a/usr.sbin/dhcpd/bootp.c b/usr.sbin/dhcpd/bootp.c index 2021976dc91..037f1f4973e 100644 --- a/usr.sbin/dhcpd/bootp.c +++ b/usr.sbin/dhcpd/bootp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bootp.c,v 1.11 2004/09/16 18:35:42 deraadt Exp $ */ +/* $OpenBSD: bootp.c,v 1.12 2005/01/31 21:23:08 claudio Exp $ */ /* * BOOTP Protocol support. @@ -52,7 +52,6 @@ bootp(struct packet *packet) struct dhcp_packet raw; struct sockaddr_in to; struct in_addr from; - struct hardware hto; struct tree_cache *options[256]; struct subnet *subnet = NULL; struct lease *lease; @@ -307,11 +306,6 @@ lose: else memcpy(raw.file, packet->raw->file, sizeof(raw.file)); - /* Set up the hardware destination address... */ - hto.htype = packet->raw->htype; - hto.hlen = packet->raw->hlen; - memcpy(hto.haddr, packet->raw->chaddr, hto.hlen); - from = packet->interface->primary_address; /* Report what we're doing... */ @@ -353,5 +347,5 @@ lose: errno = 0; (void) send_packet(packet->interface, &raw, - outgoing.packet_length, from, &to, &hto); + outgoing.packet_length, from, &to, packet->haddr); } diff --git a/usr.sbin/dhcpd/dhcp.c b/usr.sbin/dhcpd/dhcp.c index e8533de5268..3946fd80686 100644 --- a/usr.sbin/dhcpd/dhcp.c +++ b/usr.sbin/dhcpd/dhcp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dhcp.c,v 1.17 2005/01/29 16:29:09 millert Exp $ */ +/* $OpenBSD: dhcp.c,v 1.18 2005/01/31 21:23:08 claudio Exp $ */ /* * Copyright (c) 1995, 1996, 1997, 1998, 1999 @@ -483,7 +483,6 @@ nak_lease(struct packet *packet, struct iaddr *cip) struct dhcp_packet raw; unsigned char nak = DHCPNAK; struct packet outgoing; - struct hardware hto; struct tree_cache *options[256], dhcpnak_tree, dhcpmsg_tree; memset(options, 0, sizeof options); @@ -537,10 +536,6 @@ nak_lease(struct packet *packet, struct iaddr *cip) packet->raw->chaddr), packet->raw->giaddr.s_addr ? inet_ntoa(packet->raw->giaddr) : packet->interface->name); - hto.htype = packet->raw->htype; - hto.hlen = packet->raw->hlen; - memcpy(hto.haddr, packet->raw->chaddr, hto.hlen); - /* Set up the common stuff... */ memset(&to, 0, sizeof to); to.sin_family = AF_INET; @@ -1099,7 +1094,6 @@ dhcp_reply(struct lease *lease) struct dhcp_packet raw; struct sockaddr_in to; struct in_addr from; - struct hardware hto; struct lease_state *state = lease->state; int nulltp, bootpp; u_int8_t *prl; @@ -1196,11 +1190,6 @@ dhcp_reply(struct lease *lease) lease->hardware_addr.haddr), state->giaddr.s_addr ? inet_ntoa(state->giaddr) : state->ip->name); - /* Set up the hardware address... */ - hto.htype = lease->hardware_addr.htype; - hto.hlen = lease->hardware_addr.hlen; - memcpy(hto.haddr, lease->hardware_addr.haddr, hto.hlen); - memset(&to, 0, sizeof to); to.sin_family = AF_INET; #ifdef HAVE_SA_LEN @@ -1263,7 +1252,7 @@ dhcp_reply(struct lease *lease) memcpy(&from, state->from.iabuf, sizeof from); (void) send_packet(state->ip, &raw, packet_length, - from, &to, &hto); + from, &to, &state->haddr); free_lease_state(state, "dhcp_reply"); lease->state = NULL; |