Lines Matching defs:len

45     0x45, 0x00,    0,   41,  /* Version=4, IHL=5, ToS=0x80, len=41 */     \
184 int is_ipv6_fragment(struct ip6_hdr *ip6, size_t len) {
189 return len >= sizeof(*ip6) + sizeof(*frag) &&
201 void check_packet(const uint8_t *packet, size_t len, const char *msg) {
210 ASSERT_GE(len, sizeof(*ip)) << msg << ": IPv4 packet shorter than IPv4 header\n";
212 EXPECT_EQ(len, ntohs(ip->tot_len)) << msg << ": Incorrect IPv4 length\n";
217 payload_length = len - sizeof(*ip);
226 ASSERT_GE(len, sizeof(*ip6)) << msg << ": IPv6 packet shorter than IPv6 header\n";
227 EXPECT_EQ(len - sizeof(*ip6), htons(ip6->ip6_plen)) << msg << ": Incorrect IPv6 length\n";
231 ASSERT_GE(len, sizeof(*ip6) + sizeof(*frag))
236 if (!is_ipv6_fragment(ip6, len)) {
237 payload_length = len - sizeof(*ip6) - sizeof(*frag);
243 payload_length = len - sizeof(*ip6);
281 EXPECT_EQ(payload_length, ntohs(udp->len)) << msg << ": Incorrect UDP length\n";
296 int len = lengths[i];
300 check_packet(packet, len, "Fragment sanity check");
321 ASSERT_TRUE(is_ipv6_fragment(ip6_orig, len))
347 int payload_length = len - payload_offset;
374 void check_data_matches(const void *expected, const void *actual, size_t len, const char *msg) {
375 if (memcmp(expected, actual, len)) {
377 int hexdump_len = len * 3 + (len / 20 + 1) * 5;
380 for (unsigned i = 0; i < len; i++) {
404 pseudo_checksum = ipv4_pseudo_header_checksum(ip, ntohs(udp->len));
410 pseudo_checksum = ipv6_pseudo_header_checksum(ip6, ntohs(udp->len), IPPROTO_UDP);
419 udp->check = ip_checksum_finish(ip_checksum_add(pseudo_checksum, udp, ntohs(udp->len)));
472 int len = readv(read_fd, iov, 2);
473 if (len > (int) sizeof(new_tun_header)) {
474 ASSERT_LT((size_t) len, *outlen) << msg << ": Translated packet buffer too small\n";
476 *outlen = len - sizeof(new_tun_header);
479 FAIL() << msg << ": Packet was not translated: len=" << len;
892 int len, i;