Lines Matching defs:iphdr
29 #define IP4_HLEN (sizeof(struct iphdr))
101 static uint16_t udp_checksum(struct ip *iphdr, struct udphdr *udphdr)
106 sum = raw_checksum((uint8_t *)&iphdr->ip_src, 2 * sizeof(iphdr->ip_src),
117 static uint16_t udp6_checksum(struct ip6_hdr *iphdr, struct udphdr *udphdr)
122 sum = raw_checksum((uint8_t *)&iphdr->ip6_src, 2 * sizeof(iphdr->ip6_src),
176 struct ip *iphdr = (struct ip *)ip_frame;
180 iphdr->ip_off = htons(offset / 8);
183 iphdr->ip_off = htons(offset / 8 | IP4_MF);
185 iphdr->ip_len = htons(frag_len);
206 struct ip *iphdr = (struct ip *)ip_frame;
232 memset(iphdr, 0, sizeof(*iphdr));
233 iphdr->ip_hl = 5;
234 iphdr->ip_v = 4;
235 iphdr->ip_tos = 0;
236 iphdr->ip_id = htons(ip_id++);
237 iphdr->ip_ttl = 0x40;
238 iphdr->ip_p = IPPROTO_UDP;
239 iphdr->ip_src.s_addr = htonl(INADDR_LOOPBACK);
240 iphdr->ip_dst = addr4;
241 iphdr->ip_sum = 0;
312 iphdr->ip_off = htons(offset / 8 | IP4_MF);
313 iphdr->ip_len = htons(frag_len);