Lines Matching defs:ip4
156 const struct iphdr *const ip4 = (void *)(eth + 1);
171 if (ip4->version != 4)
175 if (ip4->ihl != 5)
179 if (bpf_htons(ip4->tot_len) > 0xFFFF - sizeof(struct ipv6hdr))
185 for (int i = 0; i < sizeof(*ip4) / sizeof(__u16); ++i)
186 sum4 += ((__u16 *)ip4)[i];
188 // Note that sum4 is guaranteed to be non-zero by virtue of ip4->version == 4
196 if (bpf_ntohs(ip4->tot_len) < sizeof(*ip4))
200 if (ip4->frag_off & ~bpf_htons(IP_DF))
203 switch (ip4->protocol) {
210 if (data + sizeof(*ip4) + sizeof(struct udphdr) > data_end)
212 const struct udphdr *uh = (const struct udphdr *)(ip4 + 1);
231 .priority = ip4->tos >> 4, // __u8:4
232 .flow_lbl = {(ip4->tos & 0xF) << 4, 0, 0}, // __u8[3]
233 .payload_len = bpf_htons(bpf_ntohs(ip4->tot_len) - 20), // __be16
234 .nexthdr = ip4->protocol, // __u8
235 .hop_limit = ip4->ttl, // __u8