Lines Matching refs:ip
227 if (bytes < ntohs(packet.ip.tot_len)) {
233 bytes = ntohs(packet.ip.tot_len);
238 if (packet.ip.protocol != IPPROTO_UDP || packet.ip.version != IPVERSION ||
239 packet.ip.ihl != sizeof(packet.ip) >> 2 || packet.udp.dest != htons(CLIENT_PORT) ||
241 ntohs(packet.udp.len) != (short) (bytes - sizeof(packet.ip))) {
248 check = packet.ip.check;
249 packet.ip.check = 0;
250 if (check != checksum(&(packet.ip), sizeof(packet.ip))) {
256 source = packet.ip.saddr;
257 dest = packet.ip.daddr;
260 memset(&packet.ip, 0, sizeof(packet.ip));
262 packet.ip.protocol = IPPROTO_UDP;
263 packet.ip.saddr = source;
264 packet.ip.daddr = dest;
265 packet.ip.tot_len = packet.udp.len; /* cheat on the psuedo-header */
271 memcpy(payload, &(packet.data), bytes - (sizeof(packet.ip) + sizeof(packet.udp)));
278 return bytes - (sizeof(packet.ip) + sizeof(packet.udp));