Changeset View
Changeset View
Standalone View
Standalone View
sbin/dhclient/packet.c
Show First 20 Lines • Show All 151 Lines • ▼ Show 20 Lines | decode_hw_header(unsigned char *buf, int bufix, struct hardware *from) | ||||
struct ether_header eh; | struct ether_header eh; | ||||
memcpy(&eh, buf + bufix, ETHER_HEADER_SIZE); | memcpy(&eh, buf + bufix, ETHER_HEADER_SIZE); | ||||
memcpy(from->haddr, eh.ether_shost, sizeof(eh.ether_shost)); | memcpy(from->haddr, eh.ether_shost, sizeof(eh.ether_shost)); | ||||
from->htype = ARPHRD_ETHER; | from->htype = ARPHRD_ETHER; | ||||
from->hlen = sizeof(eh.ether_shost); | from->hlen = sizeof(eh.ether_shost); | ||||
return (sizeof(eh)); | return (sizeof(eh) + (ntohs(eh.ether_type) == ETHERTYPE_VLAN ? | ||||
ETHER_VLAN_ENCAP_LEN : 0)); | |||||
} | } | ||||
ssize_t | ssize_t | ||||
decode_udp_ip_header(unsigned char *buf, int bufix, struct sockaddr_in *from, | decode_udp_ip_header(unsigned char *buf, int bufix, struct sockaddr_in *from, | ||||
unsigned char *data, int buflen) | unsigned char *data, int buflen) | ||||
{ | { | ||||
struct ip *ip; | struct ip *ip; | ||||
struct udphdr *udp; | struct udphdr *udp; | ||||
▲ Show 20 Lines • Show All 82 Lines • Show Last 20 Lines |