Lines Matching refs:cmsg
67 print_fds(const struct cmsghdr *const cmsg, const size_t cmsg_len) in print_fds() argument
75 int *fdp = (int *) CMSG_DATA(cmsg); in print_fds()
104 struct cmsghdr *cmsg = get_cmsghdr(page, msg_controllen); in test_scm_rights1() local
107 cmsg->cmsg_len = cmsg_len; in test_scm_rights1()
109 cmsg->cmsg_level = SOL_SOCKET; in test_scm_rights1()
111 cmsg->cmsg_type = SCM_RIGHTS; in test_scm_rights1()
116 memcpy(CMSG_DATA(cmsg), src, src_len - CMSG_LEN(0)); in test_scm_rights1()
118 mh->msg_control = cmsg; in test_scm_rights1()
128 printf(", msg_control=%p", cmsg); in test_scm_rights1()
132 print_fds(cmsg, src_len); in test_scm_rights1()
135 printf(", ... /* %p */", (void *) cmsg + aligned_cms_len); in test_scm_rights1()
160 struct cmsghdr *const cmsg[2] = { in test_scm_rights2() local
164 cmsg[0]->cmsg_len = cmsg_len[0]; in test_scm_rights2()
165 cmsg[0]->cmsg_level = SOL_SOCKET; in test_scm_rights2()
166 cmsg[0]->cmsg_type = SCM_RIGHTS; in test_scm_rights2()
168 memcpy(CMSG_DATA(cmsg[0]), src[0], cmsg_len[0] - CMSG_LEN(0)); in test_scm_rights2()
172 cmsg[1]->cmsg_len = cmsg_len[1]; in test_scm_rights2()
174 cmsg[1]->cmsg_level = SOL_SOCKET; in test_scm_rights2()
176 cmsg[1]->cmsg_type = SCM_RIGHTS; in test_scm_rights2()
180 memcpy(CMSG_DATA(cmsg[1]), src[1], src1_len - CMSG_LEN(0)); in test_scm_rights2()
182 mh->msg_control = cmsg[0]; in test_scm_rights2()
192 print_fds(cmsg[0], cmsg_len[0]); in test_scm_rights2()
195 print_fds(cmsg[1], src1_len); in test_scm_rights2()
198 printf(", ... /* %p */", (void *) cmsg[1] + aligned_cms_len[1]); in test_scm_rights2()
210 struct cmsghdr *cmsg = get_cmsghdr(page, len); in test_scm_rights3() local
212 cmsg->cmsg_len = CMSG_LEN(sizeof(int) * nfds); in test_scm_rights3()
213 cmsg->cmsg_level = SOL_SOCKET; in test_scm_rights3()
214 cmsg->cmsg_type = SCM_RIGHTS; in test_scm_rights3()
215 int *fdp = (int *) CMSG_DATA(cmsg); in test_scm_rights3()
220 mh->msg_control = cmsg; in test_scm_rights3()
227 (unsigned) cmsg->cmsg_len); in test_scm_rights3()
228 print_fds(cmsg, cmsg->cmsg_len); in test_scm_rights3()
237 struct cmsghdr *cmsg = get_cmsghdr(page, len); in test_scm_timestamp() local
239 cmsg->cmsg_len = CMSG_LEN(sizeof(struct timeval)); in test_scm_timestamp()
240 cmsg->cmsg_level = SOL_SOCKET; in test_scm_timestamp()
241 cmsg->cmsg_type = SCM_TIMESTAMP; in test_scm_timestamp()
242 struct timeval *tv = (struct timeval *) CMSG_DATA(cmsg); in test_scm_timestamp()
246 mh->msg_control = cmsg; in test_scm_timestamp()
255 (unsigned) cmsg->cmsg_len, in test_scm_timestamp()
260 cmsg = get_cmsghdr(page, len); in test_scm_timestamp()
262 cmsg->cmsg_len = CMSG_LEN(sizeof(struct timeval) - sizeof(long)); in test_scm_timestamp()
263 cmsg->cmsg_level = SOL_SOCKET; in test_scm_timestamp()
264 cmsg->cmsg_type = SCM_TIMESTAMP; in test_scm_timestamp()
266 mh->msg_control = cmsg; in test_scm_timestamp()
274 (unsigned) cmsg->cmsg_len, in test_scm_timestamp()
282 struct cmsghdr *cmsg = get_cmsghdr(page, len); in test_scm_timestampns() local
284 cmsg->cmsg_len = CMSG_LEN(sizeof(struct timespec)); in test_scm_timestampns()
285 cmsg->cmsg_level = SOL_SOCKET; in test_scm_timestampns()
286 cmsg->cmsg_type = SCM_TIMESTAMPNS; in test_scm_timestampns()
287 struct timespec *ts = (struct timespec *) CMSG_DATA(cmsg); in test_scm_timestampns()
291 mh->msg_control = cmsg; in test_scm_timestampns()
300 (unsigned) cmsg->cmsg_len, in test_scm_timestampns()
305 cmsg = get_cmsghdr(page, len); in test_scm_timestampns()
307 cmsg->cmsg_len = CMSG_LEN(sizeof(struct timespec) - sizeof(long)); in test_scm_timestampns()
308 cmsg->cmsg_level = SOL_SOCKET; in test_scm_timestampns()
309 cmsg->cmsg_type = SCM_TIMESTAMPNS; in test_scm_timestampns()
311 mh->msg_control = cmsg; in test_scm_timestampns()
320 (unsigned) cmsg->cmsg_len, in test_scm_timestampns()
328 struct cmsghdr *cmsg = get_cmsghdr(page, len); in test_scm_timestamping() local
330 cmsg->cmsg_len = CMSG_LEN(3 * sizeof(struct timespec)); in test_scm_timestamping()
331 cmsg->cmsg_level = SOL_SOCKET; in test_scm_timestamping()
332 cmsg->cmsg_type = SCM_TIMESTAMPING; in test_scm_timestamping()
333 struct timespec *ts = (struct timespec *) CMSG_DATA(cmsg); in test_scm_timestamping()
341 mh->msg_control = cmsg; in test_scm_timestamping()
351 (unsigned) cmsg->cmsg_len, (long long) ts[0].tv_sec, in test_scm_timestamping()
360 cmsg = get_cmsghdr(page, len); in test_scm_timestamping()
362 cmsg->cmsg_len = CMSG_LEN(3 * sizeof(struct timespec) - sizeof(long)); in test_scm_timestamping()
363 cmsg->cmsg_level = SOL_SOCKET; in test_scm_timestamping()
364 cmsg->cmsg_type = SCM_TIMESTAMPING; in test_scm_timestamping()
366 mh->msg_control = cmsg; in test_scm_timestamping()
375 (unsigned) cmsg->cmsg_len, in test_scm_timestamping()
380 print_security(const struct cmsghdr *const cmsg, const size_t cmsg_len) in print_security() argument
386 printf(", cmsg_data=\"%.*s\"", n, CMSG_DATA(cmsg)); in print_security()
404 struct cmsghdr *cmsg = get_cmsghdr(page, msg_controllen); in test_scm_security() local
406 cmsg->cmsg_len = cmsg_len; in test_scm_security()
407 cmsg->cmsg_level = cmsg_level; in test_scm_security()
408 cmsg->cmsg_type = SCM_SECURITY; in test_scm_security()
413 memcpy(CMSG_DATA(cmsg), src, src_len - CMSG_LEN(0)); in test_scm_security()
415 mh->msg_control = cmsg; in test_scm_security()
425 print_security(cmsg, src_len); in test_scm_security()
428 printf(", ... /* %p */", (void *) cmsg + aligned_cms_len); in test_scm_security()
443 struct cmsghdr *cmsg = get_cmsghdr(page, CMSG_LEN(0)); in test_unknown_type() local
445 cmsg->cmsg_len = CMSG_LEN(0); in test_unknown_type()
446 cmsg->cmsg_level = cmsg_level; in test_unknown_type()
447 cmsg->cmsg_type = 0xfacefeed; in test_unknown_type()
449 mh->msg_control = cmsg; in test_unknown_type()
450 mh->msg_controllen = cmsg->cmsg_len; in test_unknown_type()
457 (unsigned) cmsg->cmsg_len, cmsg_level_str, cmsg->cmsg_type, in test_unknown_type()
540 struct cmsghdr *const cmsg = get_cmsghdr(page, len); in test_ip_pktinfo() local
542 cmsg->cmsg_len = CMSG_LEN(sizeof(struct in_pktinfo)); in test_ip_pktinfo()
543 cmsg->cmsg_level = SOL_IP; in test_ip_pktinfo()
544 cmsg->cmsg_type = cmsg_type; in test_ip_pktinfo()
546 struct in_pktinfo *const info = (struct in_pktinfo *) CMSG_DATA(cmsg); in test_ip_pktinfo()
551 mh->msg_control = cmsg; in test_ip_pktinfo()
561 (unsigned) cmsg->cmsg_len, cmsg_type_str, in test_ip_pktinfo()
570 struct cmsghdr *const cmsg = get_cmsghdr(page, len); in test_ip_uint() local
572 cmsg->cmsg_len = CMSG_LEN(sizeof(int)); in test_ip_uint()
573 cmsg->cmsg_level = SOL_IP; in test_ip_uint()
574 cmsg->cmsg_type = cmsg_type; in test_ip_uint()
576 unsigned int *u = (void *) CMSG_DATA(cmsg); in test_ip_uint()
579 mh->msg_control = cmsg; in test_ip_uint()
587 (unsigned) cmsg->cmsg_len, cmsg_type_str, *u, len, in test_ip_uint()
596 struct cmsghdr *const cmsg = get_cmsghdr(page, len); in test_ip_uint8_t() local
598 cmsg->cmsg_len = CMSG_LEN(1); in test_ip_uint8_t()
599 cmsg->cmsg_level = SOL_IP; in test_ip_uint8_t()
600 cmsg->cmsg_type = cmsg_type; in test_ip_uint8_t()
601 *CMSG_DATA(cmsg) = 'A'; in test_ip_uint8_t()
603 mh->msg_control = cmsg; in test_ip_uint8_t()
611 (unsigned) cmsg->cmsg_len, cmsg_type_str, in test_ip_uint8_t()
639 struct cmsghdr *cmsg = get_cmsghdr(page, len); in test_ip_opts() local
641 cmsg->cmsg_len = CMSG_LEN(opts_len); in test_ip_opts()
642 cmsg->cmsg_level = SOL_IP; in test_ip_opts()
643 cmsg->cmsg_type = cmsg_type; in test_ip_opts()
646 CMSG_DATA(cmsg)[i] = 'A' + i; in test_ip_opts() local
648 mh->msg_control = cmsg; in test_ip_opts()
655 (unsigned) cmsg->cmsg_len, cmsg_type_str); in test_ip_opts()
656 print_ip_opts(CMSG_DATA(cmsg), opts_len); in test_ip_opts()
678 struct cmsghdr *const cmsg = get_cmsghdr(page, len); in test_ip_recverr() local
680 cmsg->cmsg_len = CMSG_LEN(sizeof(struct sock_ee)); in test_ip_recverr()
681 cmsg->cmsg_level = SOL_IP; in test_ip_recverr()
682 cmsg->cmsg_type = cmsg_type; in test_ip_recverr()
684 struct sock_ee *const e = (struct sock_ee *) CMSG_DATA(cmsg); in test_ip_recverr()
695 mh->msg_control = cmsg; in test_ip_recverr()
706 (unsigned) cmsg->cmsg_len, cmsg_type_str, in test_ip_recverr()
720 struct cmsghdr *const cmsg = get_cmsghdr(page, len); in test_ip_origdstaddr() local
722 cmsg->cmsg_len = CMSG_LEN(sizeof(struct sockaddr_in)); in test_ip_origdstaddr()
723 cmsg->cmsg_level = SOL_IP; in test_ip_origdstaddr()
724 cmsg->cmsg_type = cmsg_type; in test_ip_origdstaddr()
726 struct sockaddr_in *const sin = (struct sockaddr_in *) CMSG_DATA(cmsg); in test_ip_origdstaddr()
731 mh->msg_control = cmsg; in test_ip_origdstaddr()
740 (unsigned) cmsg->cmsg_len, cmsg_type_str, in test_ip_origdstaddr()
779 struct cmsghdr *cmsg = get_cmsghdr(page, CMSG_LEN(0)); in test_unknown_level() local
781 cmsg->cmsg_len = CMSG_LEN(0); in test_unknown_level()
782 cmsg->cmsg_level = SOL_TCP; in test_unknown_level()
783 cmsg->cmsg_type = 0xdeadbeef; in test_unknown_level()
785 mh->msg_control = cmsg; in test_unknown_level()
786 mh->msg_controllen = cmsg->cmsg_len; in test_unknown_level()
793 (unsigned) cmsg->cmsg_len, "SOL_TCP", cmsg->cmsg_type, in test_unknown_level()
809 struct cmsghdr *const cmsg = tail_alloc(len); in test_big_len() local
810 cmsg->cmsg_len = len; in test_big_len()
811 cmsg->cmsg_level = SOL_SOCKET; in test_big_len()
812 cmsg->cmsg_type = SCM_RIGHTS; in test_big_len()
814 mh->msg_control = cmsg; in test_big_len()
824 (unsigned) cmsg->cmsg_len); in test_big_len()
825 print_fds(cmsg, optmem_max); in test_big_len()