Lines Matching refs:ip
201 if (bytes < ntohs(packet.ip.tot_len)) {
207 bytes = ntohs(packet.ip.tot_len);
210 if (packet.ip.protocol != IPPROTO_UDP || packet.ip.version != IPVERSION ||
211 packet.ip.ihl != sizeof(packet.ip) >> 2 || packet.udp.dest != htons(CLIENT_PORT) ||
213 ntohs(packet.udp.len) != (short) (bytes - sizeof(packet.ip))) {
219 check = packet.ip.check;
220 packet.ip.check = 0;
221 if (check != checksum(&(packet.ip), sizeof(packet.ip))) {
227 source = packet.ip.saddr;
228 dest = packet.ip.daddr;
231 memset(&packet.ip, 0, sizeof(packet.ip));
233 packet.ip.protocol = IPPROTO_UDP;
234 packet.ip.saddr = source;
235 packet.ip.daddr = dest;
236 packet.ip.tot_len = packet.udp.len; /* cheat on the psuedo-header */
242 memcpy(payload, &(packet.data), bytes - (sizeof(packet.ip) + sizeof(packet.udp)));
249 return bytes - (sizeof(packet.ip) + sizeof(packet.udp));