Lines Matching refs:ip
168 if (bytes < ntohs(packet.ip.tot_len)) {
174 bytes = ntohs(packet.ip.tot_len);
177 if (packet.ip.protocol != IPPROTO_UDP || packet.ip.version != IPVERSION
178 || packet.ip.ihl != sizeof(packet.ip) >> 2
181 || ntohs(packet.udp.len) != (uint16_t)(bytes - sizeof(packet.ip))
188 check = packet.ip.check;
189 packet.ip.check = 0;
190 if (check != udhcp_checksum(&(packet.ip), sizeof(packet.ip))) {
196 source = packet.ip.saddr;
197 dest = packet.ip.daddr;
200 memset(&packet.ip, 0, sizeof(packet.ip));
202 packet.ip.protocol = IPPROTO_UDP;
203 packet.ip.saddr = source;
204 packet.ip.daddr = dest;
205 packet.ip.tot_len = packet.udp.len; /* cheat on the psuedo-header */
211 memcpy(payload, &(packet.data), bytes - (sizeof(packet.ip) + sizeof(packet.udp)));
218 return bytes - (sizeof(packet.ip) + sizeof(packet.udp));