Update to FreeBSD head 2016-08-23

Git mirror commit 9fe7c416e6abb28b1398fd3e5687099846800cfd.
This commit is contained in:
Sebastian Huber
2016-10-07 15:10:20 +02:00
parent 8c0eebac7d
commit c40e45b75e
1040 changed files with 156866 additions and 67039 deletions

View File

@@ -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);