Lines Matching refs:test
368 ttl_bind_dest(const ttl_test_t *test, int sock, struct sockaddr_storage *dst) in ttl_bind_dest() argument
375 if (test->tt_domain == PF_INET) { in ttl_bind_dest()
381 "to an IPv4 address", test->tt_desc); in ttl_bind_dest()
391 "to an IPv6 address", test->tt_desc); in ttl_bind_dest()
399 test->tt_desc); in ttl_bind_dest()
406 test->tt_desc); in ttl_bind_dest()
418 ttl_connect(const ttl_test_t *test, int port, int src, int dst, int *cfd, in ttl_connect() argument
422 int namelen = test->tt_domain == PF_INET ? sizeof (struct sockaddr_in) : in ttl_connect()
428 warn("TEST FAILED: %s: failed to listen", test->tt_desc); in ttl_connect()
433 warn("TEST FAILED: %s: failed to connect", test->tt_desc); in ttl_connect()
439 "associate to watch connect", test->tt_desc); in ttl_connect()
443 if (test->tt_pass == TTL_NOCONNECT) { in ttl_connect()
445 "connect\n", test->tt_desc); in ttl_connect()
449 test->tt_desc); in ttl_connect()
456 "POLLOUT, found 0x%x", test->tt_desc, pe.portev_events); in ttl_connect()
465 "associate to watch accept", test->tt_desc); in ttl_connect()
470 test->tt_desc); in ttl_connect()
476 "POLLIN, found 0x%x", test->tt_desc, pe.portev_events); in ttl_connect()
483 test->tt_desc); in ttl_connect()
487 if (test->tt_pass != TTL_SENDRECV) { in ttl_connect()
489 test->tt_desc); in ttl_connect()
498 ttl_check_ancil(const ttl_test_t *test, const struct msghdr *msg) in ttl_check_ancil() argument
502 if (test->tt_domain == PF_INET) { in ttl_check_ancil()
512 "data, found %u", test->tt_desc, CMSG_SPACE(sizeof (int)), in ttl_check_ancil()
524 if (test->tt_ttl != 0 && val != test->tt_ttl) { in ttl_check_ancil()
526 "0x%x, found 0x%x", test->tt_desc, test->tt_ttl, in ttl_check_ancil()
532 test->tt_desc); in ttl_check_ancil()
537 test->tt_desc); in ttl_check_ancil()
546 ttl_sendrecv(const ttl_test_t *test, int port, int src, int dst, in ttl_sendrecv() argument
550 int namelen = test->tt_domain == PF_INET ? sizeof (struct sockaddr_in) : in ttl_sendrecv()
562 test->tt_desc); in ttl_sendrecv()
567 "associate to watch recv", test->tt_desc); in ttl_sendrecv()
571 if (test->tt_pass == TTL_NODATA) { in ttl_sendrecv()
573 "for data\n", test->tt_desc); in ttl_sendrecv()
577 test->tt_desc); in ttl_sendrecv()
584 "POLLIN, found 0x%x", test->tt_desc, pe.portev_events); in ttl_sendrecv()
599 test->tt_desc, sret); in ttl_sendrecv()
603 if (test->tt_pass != TTL_SENDRECV) { in ttl_sendrecv()
605 test->tt_desc); in ttl_sendrecv()
613 if (data != tt_msg && test->tt_type != SOCK_RAW) { in ttl_sendrecv()
615 "0x%x", test->tt_desc, tt_msg, data); in ttl_sendrecv()
619 if (test->tt_type == SOCK_DGRAM && !ttl_check_ancil(test, &msg)) { in ttl_sendrecv()
624 test->tt_desc); in ttl_sendrecv()
629 ttl_test_one(const ttl_test_t *test) in ttl_test_one() argument
640 src = socket(test->tt_domain, test->tt_type | SOCK_NONBLOCK, in ttl_test_one()
641 test->tt_proto); in ttl_test_one()
644 test->tt_desc); in ttl_test_one()
649 dst = socket(test->tt_domain, test->tt_type | SOCK_NONBLOCK, in ttl_test_one()
650 test->tt_proto); in ttl_test_one()
653 test->tt_desc); in ttl_test_one()
658 if (!ttl_bind_dest(test, dst, &dst_addr)) { in ttl_test_one()
663 if (test->tt_domain == PF_INET) { in ttl_test_one()
675 if (test->tt_ttl > 0 && setsockopt(src, level, ttlopt, &test->tt_ttl, in ttl_test_one()
678 test->tt_desc, test->tt_ttl); in ttl_test_one()
683 if (setsockopt(dst, level, minttlopt, &test->tt_minttl, in ttl_test_one()
686 test->tt_desc, test->tt_minttl); in ttl_test_one()
691 if (test->tt_type == SOCK_DGRAM && setsockopt(dst, level, recvopt, &en, in ttl_test_one()
694 test->tt_desc); in ttl_test_one()
699 if (test->tt_type != SOCK_DGRAM && test->tt_type != SOCK_RAW) { in ttl_test_one()
700 if (!ttl_connect(test, port, src, dst, &cfd, in ttl_test_one()
705 if (test->tt_pass != TTL_SENDRECV) { in ttl_test_one()
713 if (!ttl_sendrecv(test, port, src, tdst, in ttl_test_one()