Lines Matching +full:4 +full:a

3  * Copyright (C) 2015-2019 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
8 * DEBUG_PRINT_TRIE_GRAPHVIZ to be 1, then every time there's a full tree in
9 * memory, it will be printed out as KERN_DEBUG in a format that can be passed
12 * randomized tests done against a trivial implementation, which may take
13 * upwards of a half-hour to complete. There's no set of users who should be
127 if (node->ip_version == 4) { in horrible_mask_self()
190 node->ip_version = 4; in horrible_allowedips_insert_v4()
220 if (node->ip_version == 4 && horrible_match_v4(node, ip)) in horrible_allowedips_lookup_v4()
287 get_random_bytes(ip, 4); in randomized_test()
301 memcpy(mutated, ip, 4); in randomized_test()
302 get_random_bytes(mutate_mask, 4); in randomized_test()
308 for (; k < 4; ++k) in randomized_test()
310 for (k = 0; k < 4; ++k) in randomized_test()
352 for (; k < 4; ++k) in randomized_test()
354 for (k = 0; k < 4; ++k) in randomized_test()
384 get_random_bytes(ip, 4); in randomized_test()
425 static __init inline struct in_addr *ip4(u8 a, u8 b, u8 c, u8 d) in ip4() argument
430 split[0] = a; in ip4()
437 static __init inline struct in6_addr *ip6(u32 a, u32 b, u32 c, u32 d) in ip6() argument
442 split[0] = cpu_to_be32(a); in ip6()
473 bool _s = lookup(t.root##version, (version) == 4 ? 32 : 128, \
479 bool _s = lookup(t.root##version, (version) == 4 ? 32 : 128, \
493 struct wg_peer *a = init_peer(), *b = init_peer(), *c = init_peer(), in wg_allowedips_selftest() local
508 if (!a || !b || !c || !d || !e || !f || !g || !h) { in wg_allowedips_selftest()
513 insert(4, a, 192, 168, 4, 0, 24); in wg_allowedips_selftest()
514 insert(4, b, 192, 168, 4, 4, 32); in wg_allowedips_selftest()
515 insert(4, c, 192, 168, 0, 0, 16); in wg_allowedips_selftest()
516 insert(4, d, 192, 95, 5, 64, 27); in wg_allowedips_selftest()
518 insert(4, c, 192, 95, 5, 65, 27); in wg_allowedips_selftest()
521 insert(4, e, 0, 0, 0, 0, 0); in wg_allowedips_selftest()
528 insert(6, a, 0x24046800, 0x40040800, 0xdeadbeef, 0xdeadbeef, 128); in wg_allowedips_selftest()
531 insert(4, g, 64, 15, 112, 0, 20); in wg_allowedips_selftest()
533 insert(4, h, 64, 15, 123, 211, 25); in wg_allowedips_selftest()
534 insert(4, a, 10, 0, 0, 0, 25); in wg_allowedips_selftest()
535 insert(4, b, 10, 0, 0, 128, 25); in wg_allowedips_selftest()
536 insert(4, a, 10, 1, 0, 0, 30); in wg_allowedips_selftest()
537 insert(4, b, 10, 1, 0, 4, 30); in wg_allowedips_selftest()
538 insert(4, c, 10, 1, 0, 8, 29); in wg_allowedips_selftest()
539 insert(4, d, 10, 1, 0, 16, 29); in wg_allowedips_selftest()
548 test(4, a, 192, 168, 4, 20); in wg_allowedips_selftest()
549 test(4, a, 192, 168, 4, 0); in wg_allowedips_selftest()
550 test(4, b, 192, 168, 4, 4); in wg_allowedips_selftest()
551 test(4, c, 192, 168, 200, 182); in wg_allowedips_selftest()
552 test(4, c, 192, 95, 5, 68); in wg_allowedips_selftest()
553 test(4, e, 192, 95, 5, 96); in wg_allowedips_selftest()
564 test(6, a, 0x24046800, 0x40040800, 0xdeadbeef, 0xdeadbeef); in wg_allowedips_selftest()
565 test(4, g, 64, 15, 116, 26); in wg_allowedips_selftest()
566 test(4, g, 64, 15, 127, 3); in wg_allowedips_selftest()
567 test(4, g, 64, 15, 123, 1); in wg_allowedips_selftest()
568 test(4, h, 64, 15, 123, 128); in wg_allowedips_selftest()
569 test(4, h, 64, 15, 123, 129); in wg_allowedips_selftest()
570 test(4, a, 10, 0, 0, 52); in wg_allowedips_selftest()
571 test(4, b, 10, 0, 0, 220); in wg_allowedips_selftest()
572 test(4, a, 10, 1, 0, 2); in wg_allowedips_selftest()
573 test(4, b, 10, 1, 0, 6); in wg_allowedips_selftest()
574 test(4, c, 10, 1, 0, 10); in wg_allowedips_selftest()
575 test(4, d, 10, 1, 0, 20); in wg_allowedips_selftest()
577 insert(4, a, 1, 0, 0, 0, 32); in wg_allowedips_selftest()
578 insert(4, a, 64, 0, 0, 0, 32); in wg_allowedips_selftest()
579 insert(4, a, 128, 0, 0, 0, 32); in wg_allowedips_selftest()
580 insert(4, a, 192, 0, 0, 0, 32); in wg_allowedips_selftest()
581 insert(4, a, 255, 0, 0, 0, 32); in wg_allowedips_selftest()
582 wg_allowedips_remove_by_peer(&t, a, &mutex); in wg_allowedips_selftest()
583 test_negative(4, a, 1, 0, 0, 0); in wg_allowedips_selftest()
584 test_negative(4, a, 64, 0, 0, 0); in wg_allowedips_selftest()
585 test_negative(4, a, 128, 0, 0, 0); in wg_allowedips_selftest()
586 test_negative(4, a, 192, 0, 0, 0); in wg_allowedips_selftest()
587 test_negative(4, a, 255, 0, 0, 0); in wg_allowedips_selftest()
591 insert(4, a, 192, 168, 0, 0, 16); in wg_allowedips_selftest()
592 insert(4, a, 192, 168, 0, 0, 24); in wg_allowedips_selftest()
593 wg_allowedips_remove_by_peer(&t, a, &mutex); in wg_allowedips_selftest()
594 test_negative(4, a, 192, 168, 0, 1); in wg_allowedips_selftest()
603 wg_allowedips_insert_v6(&t, &ip, 128, a, &mutex); in wg_allowedips_selftest()
606 wg_allowedips_insert_v6(&t, &ip, 128, a, &mutex); in wg_allowedips_selftest()
609 wg_allowedips_insert_v6(&t, &ip, 128, a, &mutex); in wg_allowedips_selftest()
613 insert(4, a, 192, 95, 5, 93, 27); in wg_allowedips_selftest()
614 insert(6, a, 0x26075300, 0x60006b00, 0, 0xc05f0543, 128); in wg_allowedips_selftest()
615 insert(4, a, 10, 1, 0, 20, 29); in wg_allowedips_selftest()
616 insert(6, a, 0x26075300, 0x6d8a6bf8, 0xdab1f1df, 0xc05f1523, 83); in wg_allowedips_selftest()
617 insert(6, a, 0x26075300, 0x6d8a6bf8, 0xdab1f1df, 0xc05f1523, 21); in wg_allowedips_selftest()
618 list_for_each_entry(iter_node, &a->allowedips_list, peer_list) { in wg_allowedips_selftest()
661 kfree(a); in wg_allowedips_selftest()