diff options
Diffstat (limited to 'freebsd/sbin/dhclient/packet.c')
-rw-r--r-- | freebsd/sbin/dhclient/packet.c | 23 |
1 files changed, 2 insertions, 21 deletions
diff --git a/freebsd/sbin/dhclient/packet.c b/freebsd/sbin/dhclient/packet.c index e4fa0e86..28a9ccec 100644 --- a/freebsd/sbin/dhclient/packet.c +++ b/freebsd/sbin/dhclient/packet.c @@ -57,11 +57,6 @@ __FBSDID("$FreeBSD$"); u_int32_t checksum(unsigned char *, unsigned, u_int32_t); u_int32_t wrapsum(u_int32_t); -void assemble_ethernet_header(struct interface_info *, unsigned char *, - int *, struct hardware *); -ssize_t decode_ethernet_header(struct interface_info *, unsigned char *, - int bufix, struct hardware *); - u_int32_t checksum(unsigned char *buf, unsigned nbytes, u_int32_t sum) { @@ -97,14 +92,11 @@ wrapsum(u_int32_t sum) void assemble_hw_header(struct interface_info *interface, unsigned char *buf, - int *bufix, struct hardware *to) + int *bufix) { struct ether_header eh; - if (to != NULL && to->hlen == 6) /* XXX */ - memcpy(eh.ether_dhost, to->haddr, sizeof(eh.ether_dhost)); - else - memset(eh.ether_dhost, 0xff, sizeof(eh.ether_dhost)); + memset(eh.ether_dhost, 0xff, sizeof(eh.ether_dhost)); if (interface->hw_address.hlen == sizeof(eh.ether_shost)) memcpy(eh.ether_shost, interface->hw_address.haddr, sizeof(eh.ether_shost)); @@ -137,17 +129,6 @@ assemble_udp_ip_header(unsigned char *buf, int *bufix, u_int32_t from, ip.ip_dst.s_addr = to; ip.ip_sum = wrapsum(checksum((unsigned char *)&ip, sizeof(ip), 0)); - - /* - * While the BPF -- used for broadcasts -- expects a "true" IP header - * with all the bytes in network byte order, the raw socket interface - * which is used for unicasts expects the ip_len field to be in host - * byte order. In both cases, the checksum has to be correct, so this - * is as good a place as any to turn the bytes around again. - */ - if (to != INADDR_BROADCAST) - ip.ip_len = ntohs(ip.ip_len); - memcpy(&buf[*bufix], &ip, sizeof(ip)); *bufix += sizeof(ip); |