Lines Matching refs:sock

75 	int sock;  in get_socket_priv()  local
84 sock = socket(PF_INET, type, 0); in get_socket_priv()
89 return (sock); in get_socket_priv()
112 test_ip_options(int sock, const char *socktypename) in test_ip_options() argument
122 if (getsockopt(sock, IPPROTO_IP, IP_OPTIONS, test_options, &len) < 0) in test_ip_options()
138 if (setsockopt(sock, IPPROTO_IP, IP_OPTIONS, &new_options, in test_ip_options()
152 if (getsockopt(sock, IPPROTO_IP, IP_OPTIONS, test_options, &len) < 0) in test_ip_options()
182 if (setsockopt(sock, IPPROTO_IP, IP_OPTIONS, NULL, 0) < 0) in test_ip_options()
192 if (getsockopt(sock, IPPROTO_IP, IP_OPTIONS, test_options, &len) < 0) in test_ip_options()
215 int flag[2], sock; in test_ip_hdrincl() local
221 sock = socket(PF_INET, SOCK_STREAM, 0); in test_ip_hdrincl()
222 if (sock == -1) in test_ip_hdrincl()
227 if (getsockopt(sock, IPPROTO_IP, IP_HDRINCL, flag, &len) == 0) in test_ip_hdrincl()
236 if (setsockopt(sock, IPPROTO_IP, IP_HDRINCL, flag, sizeof(flag[0])) in test_ip_hdrincl()
246 close(sock); in test_ip_hdrincl()
251 sock = socket(PF_INET, SOCK_DGRAM, 0); in test_ip_hdrincl()
252 if (sock == -1) in test_ip_hdrincl()
257 if (getsockopt(sock, IPPROTO_IP, IP_HDRINCL, flag, &len) == 0) in test_ip_hdrincl()
266 if (setsockopt(sock, IPPROTO_IP, IP_HDRINCL, flag, sizeof(flag[0])) in test_ip_hdrincl()
276 close(sock); in test_ip_hdrincl()
285 sock = socket(PF_INET, SOCK_RAW, 0); in test_ip_hdrincl()
287 if (sock != -1) in test_ip_hdrincl()
292 if (sock == -1) in test_ip_hdrincl()
301 if (getsockopt(sock, IPPROTO_IP, IP_HDRINCL, flag, &len) < 0) in test_ip_hdrincl()
317 if (setsockopt(sock, IPPROTO_IP, IP_HDRINCL, flag, sizeof(flag[0])) in test_ip_hdrincl()
327 if (getsockopt(sock, IPPROTO_IP, IP_HDRINCL, flag, &len) < 0) in test_ip_hdrincl()
345 if (setsockopt(sock, IPPROTO_IP, IP_HDRINCL, flag, sizeof(flag[0])) in test_ip_hdrincl()
355 if (getsockopt(sock, IPPROTO_IP, IP_HDRINCL, flag, &len) < 0) in test_ip_hdrincl()
363 close(sock); in test_ip_hdrincl()
389 test_ip_uchar(int sock, const char *socktypename, int option, in test_ip_uchar() argument
402 if (getsockopt(sock, IPPROTO_IP, option, val, &len) < 0) in test_ip_uchar()
424 if (setsockopt(sock, IPPROTO_IP, option, val, sizeof(val[0])) < 0) in test_ip_uchar()
434 if (getsockopt(sock, IPPROTO_IP, option, val, &len) < 0) in test_ip_uchar()
455 if (setsockopt(sock, IPPROTO_IP, option, val, sizeof(val[0])) < 0) in test_ip_uchar()
481 if (setsockopt(sock, IPPROTO_IP, option, val, sizeof(val[0])) < 0) { in test_ip_uchar()
495 if (getsockopt(sock, IPPROTO_IP, option, val, &len) < 0) in test_ip_uchar()
529 test_ip_boolean(int sock, const char *socktypename, int option, in test_ip_boolean() argument
548 if (getsockopt(sock, IPPROTO_IP, option, val, &len) < 0) in test_ip_boolean()
567 if (setsockopt(sock, IPPROTO_IP, option, &newvalue, sizeof(newvalue)) in test_ip_boolean()
579 if (getsockopt(sock, IPPROTO_IP, option, val, &len) < 0) in test_ip_boolean()
605 if (setsockopt(sock, IPPROTO_IP, option, &newvalue, sizeof(newvalue)) in test_ip_boolean()
616 if (getsockopt(sock, IPPROTO_IP, option, val, &len) < 0) in test_ip_boolean()
639 test_ip_multicast_membership(int sock, const char *socktypename) in test_ip_multicast_membership() argument
649 if (getsockopt(sock, SOL_SOCKET, SO_TYPE, &sotype, &sotypelen) < 0) in test_ip_multicast_membership()
686 if (setsockopt(sock, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mreq, in test_ip_multicast_membership()
690 sock, socktypename, addrbuf, "INADDR_ANY"); in test_ip_multicast_membership()
699 if (setsockopt(sock, IPPROTO_IP, IP_DROP_MEMBERSHIP, &mreq, in test_ip_multicast_membership()
703 sock, socktypename, addrbuf, "INADDR_ANY"); in test_ip_multicast_membership()
712 test_ip_multicast_if(int sock, const char *socktypename) in test_ip_multicast_if() argument
725 test_ip_multicast_vif(int sock, const char *socktypename) in test_ip_multicast_vif() argument
741 int i, sock, socktype; in testsuite() local
761 sock = get_socket(socktype, priv); in testsuite()
762 if (sock == -1) in testsuite()
765 test_ip_uchar(sock, socktypename, IP_TOS, "IP_TOS", 0); in testsuite()
766 close(sock); in testsuite()
768 sock = get_socket(socktype, priv); in testsuite()
769 if (sock == -1) in testsuite()
772 test_ip_uchar(sock, socktypename, IP_TTL, "IP_TTL", 64); in testsuite()
773 close(sock); in testsuite()
775 sock = get_socket(socktype, priv); in testsuite()
776 if (sock == -1) in testsuite()
779 test_ip_boolean(sock, socktypename, IP_RECVOPTS, in testsuite()
781 close(sock); in testsuite()
783 sock = get_socket(socktype, priv); in testsuite()
784 if (sock == -1) in testsuite()
787 test_ip_boolean(sock, socktypename, IP_RECVRETOPTS, in testsuite()
789 close(sock); in testsuite()
791 sock = get_socket(socktype, priv); in testsuite()
792 if (sock == -1) in testsuite()
795 test_ip_boolean(sock, socktypename, IP_RECVDSTADDR, in testsuite()
797 close(sock); in testsuite()
799 sock = get_socket(socktype, priv); in testsuite()
800 if (sock == -1) in testsuite()
803 test_ip_boolean(sock, socktypename, IP_RECVTTL, "IP_RECVTTL", in testsuite()
805 close(sock); in testsuite()
807 sock = get_socket(socktype, priv); in testsuite()
808 if (sock == -1) in testsuite()
811 test_ip_boolean(sock, socktypename, IP_RECVIF, "IP_RECVIF", in testsuite()
813 close(sock); in testsuite()
815 sock = get_socket(socktype, priv); in testsuite()
816 if (sock == -1) in testsuite()
819 test_ip_boolean(sock, socktypename, IP_FAITH, "IP_FAITH", 0, in testsuite()
821 close(sock); in testsuite()
823 sock = get_socket(socktype, priv); in testsuite()
824 if (sock == -1) in testsuite()
827 test_ip_boolean(sock, socktypename, IP_ONESBCAST, in testsuite()
829 close(sock); in testsuite()
835 sock = get_socket(socktype, priv); in testsuite()
836 if (sock == -1) in testsuite()
839 test_ip_uchar(sock, socktypename, IP_MULTICAST_TTL, in testsuite()
841 close(sock); in testsuite()
849 sock = get_socket(socktype, priv); in testsuite()
850 if (sock == -1) in testsuite()
853 test_ip_boolean(sock, socktypename, IP_MULTICAST_LOOP, in testsuite()
855 close(sock); in testsuite()
857 sock = get_socket(socktype, priv); in testsuite()
858 if (sock == -1) in testsuite()
862 close(sock); in testsuite()
864 sock = get_socket(socktype, priv); in testsuite()
865 if (sock == -1) in testsuite()
868 test_ip_multicast_membership(sock, socktypename); in testsuite()
869 close(sock); in testsuite()