Lines Matching refs:packet
161 } packet; in receive_packet() local
167 nread = read(s, &packet, sizeof(packet)); in receive_packet()
181 } else if (packet.ip.version != IPVERSION || packet.ip.ihl != (sizeof(packet.ip) >> 2)) { in receive_packet()
185 } else if (nread < ntohs(packet.ip.tot_len)) { in receive_packet()
187 ALOGD("Packet was truncated (read %d, needed %d)", nread, ntohs(packet.ip.tot_len)); in receive_packet()
189 } else if (packet.ip.protocol != IPPROTO_UDP) { in receive_packet()
191 ALOGD("IP protocol (%d) is not UDP", packet.ip.protocol); in receive_packet()
193 } else if (packet.udp.dest != htons(PORT_BOOTP_CLIENT)) { in receive_packet()
195 ALOGD("UDP dest port (%d) is not DHCP client", ntohs(packet.udp.dest)); in receive_packet()
207 sum = finish_sum(checksum(&packet.ip, sizeof(packet.ip), 0)); in receive_packet()
209 ALOGW("IP header checksum failure (0x%x)", packet.ip.check); in receive_packet()
217 dhcp_size = ntohs(packet.udp.len) - sizeof(packet.udp); in receive_packet()
232 saddr = packet.ip.saddr; in receive_packet()
233 daddr = packet.ip.daddr; in receive_packet()
234 nread = ntohs(packet.ip.tot_len); in receive_packet()
235 memset(&packet.ip, 0, sizeof(packet.ip)); in receive_packet()
236 packet.ip.saddr = saddr; in receive_packet()
237 packet.ip.daddr = daddr; in receive_packet()
238 packet.ip.protocol = IPPROTO_UDP; in receive_packet()
239 packet.ip.tot_len = packet.udp.len; in receive_packet()
240 temp = packet.udp.check; in receive_packet()
241 packet.udp.check = 0; in receive_packet()
242 sum = finish_sum(checksum(&packet, nread, 0)); in receive_packet()
243 packet.udp.check = temp; in receive_packet()
250 memcpy(msg, &packet.dhcp, dhcp_size); in receive_packet()