Lines Matching refs:ip
89 struct iphdr ip; in send_packet() local
97 ip.version = IPVERSION; in send_packet()
98 ip.ihl = sizeof(ip) >> 2; in send_packet()
99 ip.tos = 0; in send_packet()
100 ip.tot_len = htons(sizeof(ip) + sizeof(udp) + size); in send_packet()
101 ip.id = 0; in send_packet()
102 ip.frag_off = 0; in send_packet()
103 ip.ttl = IPDEFTTL; in send_packet()
104 ip.protocol = IPPROTO_UDP; in send_packet()
105 ip.check = 0; in send_packet()
106 ip.saddr = saddr; in send_packet()
107 ip.daddr = daddr; in send_packet()
108 ip.check = finish_sum(checksum(&ip, sizeof(ip), 0)); in send_packet()
116 udpsum = checksum(&ip.saddr, sizeof(ip.saddr), 0); in send_packet()
117 udpsum = checksum(&ip.daddr, sizeof(ip.daddr), udpsum); in send_packet()
130 iov[0].iov_base = (char *)&ip; in send_packet()
131 iov[0].iov_len = sizeof(ip); in send_packet()
158 struct iphdr ip; in receive_packet() member
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()
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()
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()