Lines Matching defs:ip
83 #define IPV4_PSEUDOHEADER(ip, tlen) \
84 ip[12], ip[13], ip[14], ip[15], /* Source address */ \
85 ip[16], ip[17], ip[18], ip[19], /* Destination address */ \
86 0, ip[9], /* 0, protocol */ \
179 int is_ipv4_fragment(struct iphdr *ip) {
181 return ntohs(ip->frag_off) & (IP_OFFMASK | IP_MF);
193 int ipv4_fragment_offset(struct iphdr *ip) {
194 return ntohs(ip->frag_off) & IP_OFFMASK;
209 struct iphdr *ip = (struct iphdr *) packet;
210 ASSERT_GE(len, sizeof(*ip)) << msg << ": IPv4 packet shorter than IPv4 header\n";
211 EXPECT_EQ(5, ip->ihl) << msg << ": Unsupported IP header length\n";
212 EXPECT_EQ(len, ntohs(ip->tot_len)) << msg << ": Incorrect IPv4 length\n";
213 EXPECT_EQ(0, ip_checksum(ip, sizeof(*ip))) << msg << ": Incorrect IP checksum\n";
214 protocol = ip->protocol;
215 payload = ip + 1;
216 if (!is_ipv4_fragment(ip)) {
217 payload_length = len - sizeof(*ip);
218 pseudo_checksum = ipv4_pseudo_header_checksum(ip, payload_length);
253 FAIL() << msg << ": Unsupported IP version " << version << "\n";
288 struct iphdr *ip = NULL;
308 ASSERT_EQ(pos, ipv4_fragment_offset(ip_orig) * 8 + ((i != 0) ? sizeof(*ip): 0))
314 ip = (struct iphdr *) reassembled;
335 FAIL() << msg << ": Invalid IP version << " << version;
357 if (ip) {
358 ip->frag_off &= ~htons(IP_MF);
359 ip->tot_len = htons(total_length);
360 ip->check = 0;
361 ip->check = ip_checksum(ip, sizeof(*ip));
362 ASSERT_FALSE(is_ipv4_fragment(ip)) << msg << ": reassembled IPv4 packet is a fragment!\n";
402 struct iphdr *ip = (struct iphdr *) packet;
403 udp = (struct udphdr *) (ip + 1);
404 ip, ntohs(udp->len));
414 FAIL() << "unsupported IP version" << version << "\n";
458 FAIL() << msg << ": Unsupported IP version " << version << "\n";
522 struct iphdr *ip;
530 ip = (struct iphdr *) packet;
531 if (is_ipv4_fragment(ip)) {
534 protocol = ip->protocol;
535 payload = ip + 1;
650 // Check the generated IP address is in the same prefix as the interface IPv6 address.
735 // Now try using the real function which sees if IP addresses are free using bind().
821 uint8_t ip[] = { IPV4_UDP_HEADER };
823 uint32_t ipv4_pseudo_sum = ipv4_pseudo_header_checksum((struct iphdr *) ip, UDP_LEN);