Home
last modified time | relevance | path

Searched refs:cmsg (Results 1 – 25 of 57) sorted by relevance

123

/linux-6.6.21/drivers/isdn/capi/
Dcapiutil.c231 #define TYP (cdef[cmsg->par[cmsg->p]].typ)
232 #define OFF (((u8 *)cmsg) + cdef[cmsg->par[cmsg->p]].off)
234 static void jumpcstruct(_cmsg *cmsg) in jumpcstruct() argument
237 for (cmsg->p++, layer = 1; layer;) { in jumpcstruct()
239 cmsg->p++; in jumpcstruct()
464 #define NAME (pnames[cmsg->par[cmsg->p]])
466 static _cdebbuf *protocol_message_2_pars(_cdebbuf *cdb, _cmsg *cmsg, int level) in protocol_message_2_pars() argument
468 if (!cmsg->par) in protocol_message_2_pars()
471 for (; TYP != _CEND; cmsg->p++) { in protocol_message_2_pars()
483 cdb = bufprint(cdb, "%-*s = 0x%x\n", slen, NAME, *(u8 *) (cmsg->m + cmsg->l)); in protocol_message_2_pars()
[all …]
/linux-6.6.21/tools/testing/selftests/net/
Dcmsg_sender.c220 struct cmsghdr *cmsg; in ca_write_cmsg_u32() local
225 cmsg = (struct cmsghdr *)(cbuf + *cmsg_len); in ca_write_cmsg_u32()
230 cmsg->cmsg_level = level; in ca_write_cmsg_u32()
231 cmsg->cmsg_type = optname; in ca_write_cmsg_u32()
232 cmsg->cmsg_len = CMSG_LEN(sizeof(__u32)); in ca_write_cmsg_u32()
233 *(__u32 *)CMSG_DATA(cmsg) = uopt->val; in ca_write_cmsg_u32()
239 struct cmsghdr *cmsg; in cs_write_cmsg() local
268 cmsg = (struct cmsghdr *)(cbuf + cmsg_len); in cs_write_cmsg()
273 cmsg->cmsg_level = SOL_SOCKET; in cs_write_cmsg()
274 cmsg->cmsg_type = SCM_TXTIME; in cs_write_cmsg()
[all …]
Dudpgso_bench_tx.c139 static void flush_cmsg(struct cmsghdr *cmsg) in flush_cmsg() argument
147 switch (cmsg->cmsg_level) { in flush_cmsg()
149 if (cmsg->cmsg_type == SO_TIMESTAMPING) { in flush_cmsg()
151 tss = (struct scm_timestamping *)CMSG_DATA(cmsg); in flush_cmsg()
156 cmsg->cmsg_type); in flush_cmsg()
161 switch (cmsg->cmsg_type) { in flush_cmsg()
165 err = (struct sock_extended_err *)CMSG_DATA(cmsg); in flush_cmsg()
200 cmsg->cmsg_type); in flush_cmsg()
206 cmsg->cmsg_level); in flush_cmsg()
216 struct cmsghdr *cmsg; in flush_errqueue_recv() local
[all …]
Dtimestamping.c159 struct cmsghdr *cmsg; in printpacket() local
172 for (cmsg = CMSG_FIRSTHDR(msg); in printpacket()
173 cmsg; in printpacket()
174 cmsg = CMSG_NXTHDR(msg, cmsg)) { in printpacket()
175 printf(" cmsg len %zu: ", cmsg->cmsg_len); in printpacket()
176 switch (cmsg->cmsg_level) { in printpacket()
179 switch (cmsg->cmsg_type) { in printpacket()
182 (struct timeval *)CMSG_DATA(cmsg); in printpacket()
190 (struct timespec *)CMSG_DATA(cmsg); in printpacket()
198 (struct timespec *)CMSG_DATA(cmsg); in printpacket()
[all …]
Drxtimestamp.c183 struct cmsghdr *cmsg; in do_recv() local
207 for (cmsg = CMSG_FIRSTHDR(&hdr); cmsg != NULL; in do_recv()
208 cmsg = CMSG_NXTHDR(&hdr, cmsg)) { in do_recv()
209 if (cmsg->cmsg_level != SOL_SOCKET) in do_recv()
211 cmsg->cmsg_level); in do_recv()
212 switch (cmsg->cmsg_type) { in do_recv()
220 ts = (struct scm_timestamping *)CMSG_DATA(cmsg); in do_recv()
227 error(1, 0, "Unexpected cmsg_type %d", cmsg->cmsg_type); in do_recv()
Dudpgso_bench_rx.c220 struct cmsghdr *cmsg; in recv_msg() local
235 for (cmsg = CMSG_FIRSTHDR(&msg); cmsg != NULL; in recv_msg()
236 cmsg = CMSG_NXTHDR(&msg, cmsg)) { in recv_msg()
237 if (cmsg->cmsg_level == SOL_UDP in recv_msg()
238 && cmsg->cmsg_type == UDP_GRO) { in recv_msg()
239 *gso_size = *(int *)CMSG_DATA(cmsg); in recv_msg()
/linux-6.6.21/net/handshake/
Dalert.c39 struct cmsghdr *cmsg; in tls_alert_send() local
56 cmsg = CMSG_FIRSTHDR(&msg); in tls_alert_send()
57 cmsg->cmsg_level = SOL_TLS; in tls_alert_send()
58 cmsg->cmsg_type = TLS_SET_RECORD_TYPE; in tls_alert_send()
59 cmsg->cmsg_len = CMSG_LEN(sizeof(record_type)); in tls_alert_send()
60 memcpy(CMSG_DATA(cmsg), &record_type, sizeof(record_type)); in tls_alert_send()
74 u8 tls_get_record_type(const struct sock *sk, const struct cmsghdr *cmsg) in tls_get_record_type() argument
78 if (cmsg->cmsg_level != SOL_TLS) in tls_get_record_type()
80 if (cmsg->cmsg_type != TLS_GET_RECORD_TYPE) in tls_get_record_type()
83 record_type = *((u8 *)CMSG_DATA(cmsg)); in tls_get_record_type()
/linux-6.6.21/include/linux/
Dsocket.h115 #define __CMSG_NXTHDR(ctl, len, cmsg) __cmsg_nxthdr((ctl),(len),(cmsg)) argument
116 #define CMSG_NXTHDR(mhdr, cmsg) cmsg_nxthdr((mhdr), (cmsg)) argument
120 #define CMSG_DATA(cmsg) \ argument
121 ((void *)(cmsg) + sizeof(struct cmsghdr))
122 #define CMSG_USER_DATA(cmsg) \ argument
123 ((void __user *)(cmsg) + sizeof(struct cmsghdr))
131 #define CMSG_OK(mhdr, cmsg) ((cmsg)->cmsg_len >= sizeof(struct cmsghdr) && \ argument
132 (cmsg)->cmsg_len <= (unsigned long) \
134 ((char *)(cmsg) - (char *)(mhdr)->msg_control)))
135 #define for_each_cmsghdr(cmsg, msg) \ argument
[all …]
/linux-6.6.21/tools/perf/trace/beauty/include/linux/
Dsocket.h115 #define __CMSG_NXTHDR(ctl, len, cmsg) __cmsg_nxthdr((ctl),(len),(cmsg)) argument
116 #define CMSG_NXTHDR(mhdr, cmsg) cmsg_nxthdr((mhdr), (cmsg)) argument
120 #define CMSG_DATA(cmsg) \ argument
121 ((void *)(cmsg) + sizeof(struct cmsghdr))
122 #define CMSG_USER_DATA(cmsg) \ argument
123 ((void __user *)(cmsg) + sizeof(struct cmsghdr))
131 #define CMSG_OK(mhdr, cmsg) ((cmsg)->cmsg_len >= sizeof(struct cmsghdr) && \ argument
132 (cmsg)->cmsg_len <= (unsigned long) \
134 ((char *)(cmsg) - (char *)(mhdr)->msg_control)))
135 #define for_each_cmsghdr(cmsg, msg) \ argument
[all …]
/linux-6.6.21/drivers/md/
Dmd-cluster.c504 static void process_add_new_disk(struct mddev *mddev, struct cluster_msg *cmsg) in process_add_new_disk() argument
514 sprintf(disk_uuid + len, "%pU", cmsg->uuid); in process_add_new_disk()
515 snprintf(raid_slot, 16, "RAID_DISK=%d", le32_to_cpu(cmsg->raid_slot)); in process_add_new_disk()
737 static int __sendmsg(struct md_cluster_info *cinfo, struct cluster_msg *cmsg) in __sendmsg() argument
742 cmsg->slot = cpu_to_le32(slot); in __sendmsg()
750 memcpy(cinfo->message_lockres->lksb.sb_lvbptr, (void *)cmsg, in __sendmsg()
788 static int sendmsg(struct md_cluster_info *cinfo, struct cluster_msg *cmsg, in sendmsg() argument
795 ret = __sendmsg(cinfo, cmsg); in sendmsg()
986 struct cluster_msg cmsg = {0}; in resync_bitmap() local
989 cmsg.type = cpu_to_le32(BITMAP_NEEDS_SYNC); in resync_bitmap()
[all …]
/linux-6.6.21/net/ipv6/
Ddatagram.c765 struct cmsghdr *cmsg; in ip6_datagram_send_ctl() local
772 for_each_cmsghdr(cmsg, msg) { in ip6_datagram_send_ctl()
775 if (!CMSG_OK(msg, cmsg)) { in ip6_datagram_send_ctl()
780 if (cmsg->cmsg_level == SOL_SOCKET) { in ip6_datagram_send_ctl()
781 err = __sock_cmsg_send(sk, cmsg, &ipc6->sockc); in ip6_datagram_send_ctl()
787 if (cmsg->cmsg_level != SOL_IPV6) in ip6_datagram_send_ctl()
790 switch (cmsg->cmsg_type) { in ip6_datagram_send_ctl()
797 if (cmsg->cmsg_len < CMSG_LEN(sizeof(struct in6_pktinfo))) { in ip6_datagram_send_ctl()
802 src_info = (struct in6_pktinfo *)CMSG_DATA(cmsg); in ip6_datagram_send_ctl()
850 if (cmsg->cmsg_len < CMSG_LEN(4)) { in ip6_datagram_send_ctl()
[all …]
/linux-6.6.21/tools/testing/selftests/landlock/
Dcommon.h214 struct cmsghdr *cmsg; in recv_fd() local
221 cmsg = CMSG_FIRSTHDR(&msg); in recv_fd()
222 if (cmsg->cmsg_len != CMSG_LEN(sizeof(fd_rx))) in recv_fd()
225 memcpy(&fd_rx, CMSG_DATA(cmsg), sizeof(fd_rx)); in recv_fd()
248 struct cmsghdr *cmsg = CMSG_FIRSTHDR(&msg); in send_fd() local
250 cmsg->cmsg_len = CMSG_LEN(sizeof(fd_tx)); in send_fd()
251 cmsg->cmsg_level = SOL_SOCKET; in send_fd()
252 cmsg->cmsg_type = SCM_RIGHTS; in send_fd()
253 memcpy(CMSG_DATA(cmsg), &fd_tx, sizeof(fd_tx)); in send_fd()
/linux-6.6.21/samples/seccomp/
Duser-trap.c35 struct cmsghdr *cmsg; in send_fd() local
46 cmsg = CMSG_FIRSTHDR(&msg); in send_fd()
47 cmsg->cmsg_level = SOL_SOCKET; in send_fd()
48 cmsg->cmsg_type = SCM_RIGHTS; in send_fd()
49 cmsg->cmsg_len = CMSG_LEN(sizeof(int)); in send_fd()
50 *((int *)CMSG_DATA(cmsg)) = fd; in send_fd()
51 msg.msg_controllen = cmsg->cmsg_len; in send_fd()
64 struct cmsghdr *cmsg; in recv_fd() local
81 cmsg = CMSG_FIRSTHDR(&msg); in recv_fd()
83 return *((int *)CMSG_DATA(cmsg)); in recv_fd()
/linux-6.6.21/tools/testing/selftests/net/af_unix/
Dscm_pidfd.c132 struct cmsghdr *cmsg; in cmsg_check() local
161 for (cmsg = CMSG_FIRSTHDR(&msg); cmsg != NULL; in cmsg_check()
162 cmsg = CMSG_NXTHDR(&msg, cmsg)) { in cmsg_check()
163 if (cmsg->cmsg_level == SOL_SOCKET && in cmsg_check()
164 cmsg->cmsg_type == SCM_PIDFD) { in cmsg_check()
165 if (cmsg->cmsg_len < sizeof(*pidfd)) { in cmsg_check()
170 pidfd = (void *)CMSG_DATA(cmsg); in cmsg_check()
173 if (cmsg->cmsg_level == SOL_SOCKET && in cmsg_check()
174 cmsg->cmsg_type == SCM_CREDENTIALS) { in cmsg_check()
175 if (cmsg->cmsg_len < sizeof(*ucred)) { in cmsg_check()
[all …]
/linux-6.6.21/net/core/
Dscm.c66 static int scm_fp_copy(struct cmsghdr *cmsg, struct scm_fp_list **fplp) in scm_fp_copy() argument
68 int *fdp = (int*)CMSG_DATA(cmsg); in scm_fp_copy()
73 num = (cmsg->cmsg_len - sizeof(struct cmsghdr))/sizeof(int); in scm_fp_copy()
140 struct cmsghdr *cmsg; in __scm_send() local
143 for_each_cmsghdr(cmsg, msg) { in __scm_send()
154 if (!CMSG_OK(msg, cmsg)) in __scm_send()
157 if (cmsg->cmsg_level != SOL_SOCKET) in __scm_send()
160 switch (cmsg->cmsg_type) in __scm_send()
165 err=scm_fp_copy(cmsg, &p->fp); in __scm_send()
174 if (cmsg->cmsg_len != CMSG_LEN(sizeof(struct ucred))) in __scm_send()
[all …]
/linux-6.6.21/Documentation/networking/
Dtls.rst140 struct cmsghdr *cmsg;
146 cmsg = CMSG_FIRSTHDR(&msg);
147 cmsg->cmsg_level = SOL_TLS;
148 cmsg->cmsg_type = TLS_SET_RECORD_TYPE;
149 cmsg->cmsg_len = CMSG_LEN(cmsg_len);
150 *CMSG_DATA(cmsg) = record_type;
151 msg.msg_controllen = cmsg->cmsg_len;
168 type passed via cmsg. If no cmsg buffer is provided, an error is
170 received without a cmsg buffer set.
175 char cmsg[CMSG_SPACE(sizeof(unsigned char))];
[all …]
/linux-6.6.21/net/rds/
Dsend.c892 struct cmsghdr *cmsg; in rds_rm_size() local
902 for_each_cmsghdr(cmsg, msg) { in rds_rm_size()
903 if (!CMSG_OK(msg, cmsg)) in rds_rm_size()
906 if (cmsg->cmsg_level != SOL_RDS) in rds_rm_size()
909 switch (cmsg->cmsg_type) { in rds_rm_size()
928 retval = rds_rdma_extra_size(CMSG_DATA(cmsg), iov); in rds_rm_size()
972 struct cmsghdr *cmsg) in rds_cmsg_zcopy() argument
976 if (cmsg->cmsg_len < CMSG_LEN(sizeof(*cookie)) || in rds_cmsg_zcopy()
979 cookie = CMSG_DATA(cmsg); in rds_cmsg_zcopy()
988 struct cmsghdr *cmsg; in rds_cmsg_send() local
[all …]
Drdma.c609 struct cmsghdr *cmsg, in rds_cmsg_rdma_args() argument
622 if (cmsg->cmsg_len < CMSG_LEN(sizeof(struct rds_rdma_args)) in rds_cmsg_rdma_args()
626 args = CMSG_DATA(cmsg); in rds_cmsg_rdma_args()
809 struct cmsghdr *cmsg) in rds_cmsg_rdma_dest() argument
816 if (cmsg->cmsg_len < CMSG_LEN(sizeof(rds_rdma_cookie_t)) || in rds_cmsg_rdma_dest()
820 memcpy(&rm->m_rdma_cookie, CMSG_DATA(cmsg), sizeof(rm->m_rdma_cookie)); in rds_cmsg_rdma_dest()
852 struct cmsghdr *cmsg) in rds_cmsg_rdma_map() argument
854 if (cmsg->cmsg_len < CMSG_LEN(sizeof(struct rds_get_mr_args)) || in rds_cmsg_rdma_map()
858 return __rds_rdma_map(rs, CMSG_DATA(cmsg), &rm->m_rdma_cookie, in rds_cmsg_rdma_map()
866 struct cmsghdr *cmsg) in rds_cmsg_atomic() argument
[all …]
/linux-6.6.21/arch/um/os-Linux/drivers/
Dtuntap_user.c71 struct cmsghdr *cmsg; in tuntap_open_tramp() local
111 cmsg = CMSG_FIRSTHDR(&msg); in tuntap_open_tramp()
112 if (cmsg == NULL) { in tuntap_open_tramp()
117 if ((cmsg->cmsg_level != SOL_SOCKET) || in tuntap_open_tramp()
118 (cmsg->cmsg_type != SCM_RIGHTS)) { in tuntap_open_tramp()
123 *fd_out = ((int *) CMSG_DATA(cmsg))[0]; in tuntap_open_tramp()
/linux-6.6.21/net/
Dcompat.c107 #define CMSG_COMPAT_DATA(cmsg) \ argument
108 ((void __user *)((char __user *)(cmsg) + sizeof(struct compat_cmsghdr)))
126 struct compat_cmsghdr __user *cmsg, int cmsg_len) in cmsg_compat_nxthdr()
128 char __user *ptr = (char __user *)cmsg + CMSG_COMPAT_ALIGN(cmsg_len); in cmsg_compat_nxthdr()
184 struct compat_cmsghdr cmsg; in cmsghdr_from_user_compat_to_kern() local
185 if (copy_from_user(&cmsg, ucmsg, sizeof(cmsg))) in cmsghdr_from_user_compat_to_kern()
187 if (!CMSG_COMPAT_OK(cmsg.cmsg_len, ucmsg, kmsg)) in cmsghdr_from_user_compat_to_kern()
189 tmp = ((cmsg.cmsg_len - sizeof(*ucmsg)) + sizeof(struct cmsghdr)); in cmsghdr_from_user_compat_to_kern()
193 kcmsg->cmsg_level = cmsg.cmsg_level; in cmsghdr_from_user_compat_to_kern()
194 kcmsg->cmsg_type = cmsg.cmsg_type; in cmsghdr_from_user_compat_to_kern()
[all …]
/linux-6.6.21/tools/testing/selftests/bpf/prog_tests/
Dlwt_reroute.c100 struct cmsghdr *cmsg = CMSG_FIRSTHDR(&msg); in overflow_fq() local
120 cmsg->cmsg_type = SCM_TXTIME; in overflow_fq()
121 cmsg->cmsg_level = SOL_SOCKET; in overflow_fq()
122 cmsg->cmsg_len = CMSG_LEN(sizeof(uint64_t)); in overflow_fq()
130 *(uint64_t *)CMSG_DATA(cmsg) = (now.tv_nsec + 1) * NSEC_PER_SEC + in overflow_fq()
/linux-6.6.21/arch/um/os-Linux/
Dfile.c510 struct cmsghdr *cmsg; in os_rcv_fd() local
529 cmsg = CMSG_FIRSTHDR(&msg); in os_rcv_fd()
530 if (cmsg == NULL) { in os_rcv_fd()
535 if ((cmsg->cmsg_level != SOL_SOCKET) || in os_rcv_fd()
536 (cmsg->cmsg_type != SCM_RIGHTS)) { in os_rcv_fd()
541 new = ((int *) CMSG_DATA(cmsg))[0]; in os_rcv_fd()
664 struct cmsghdr *cmsg = CMSG_FIRSTHDR(&msg); in os_sendmsg_fds() local
670 cmsg->cmsg_level = SOL_SOCKET; in os_sendmsg_fds()
671 cmsg->cmsg_type = SCM_RIGHTS; in os_sendmsg_fds()
672 cmsg->cmsg_len = CMSG_LEN(fds_size); in os_sendmsg_fds()
[all …]
/linux-6.6.21/net/rxrpc/
Dsendmsg.c465 struct cmsghdr *cmsg; in rxrpc_sendmsg_cmsg() local
472 for_each_cmsghdr(cmsg, msg) { in rxrpc_sendmsg_cmsg()
473 if (!CMSG_OK(msg, cmsg)) in rxrpc_sendmsg_cmsg()
476 len = cmsg->cmsg_len - sizeof(struct cmsghdr); in rxrpc_sendmsg_cmsg()
478 cmsg->cmsg_level, cmsg->cmsg_type, len); in rxrpc_sendmsg_cmsg()
480 if (cmsg->cmsg_level != SOL_RXRPC) in rxrpc_sendmsg_cmsg()
483 switch (cmsg->cmsg_type) { in rxrpc_sendmsg_cmsg()
488 p->call.user_call_ID = *(u32 *)CMSG_DATA(cmsg); in rxrpc_sendmsg_cmsg()
493 CMSG_DATA(cmsg); in rxrpc_sendmsg_cmsg()
504 p->abort_code = *(unsigned int *)CMSG_DATA(cmsg); in rxrpc_sendmsg_cmsg()
[all …]
/linux-6.6.21/tools/testing/selftests/net/mptcp/
Dmptcp_inq.c314 struct cmsghdr *cmsg; in get_tcp_inq() local
316 for (cmsg = CMSG_FIRSTHDR(msgh); cmsg ; cmsg = CMSG_NXTHDR(msgh, cmsg)) { in get_tcp_inq()
317 if (cmsg->cmsg_level == IPPROTO_TCP && cmsg->cmsg_type == TCP_CM_INQ) { in get_tcp_inq()
318 memcpy(inqv, CMSG_DATA(cmsg), sizeof(*inqv)); in get_tcp_inq()
/linux-6.6.21/tools/testing/selftests/bpf/
Dxdp_hw_metadata.c193 struct cmsghdr *cmsg; in verify_skb_metadata() local
208 for (cmsg = CMSG_FIRSTHDR(&hdr); cmsg != NULL; in verify_skb_metadata()
209 cmsg = CMSG_NXTHDR(&hdr, cmsg)) { in verify_skb_metadata()
211 if (cmsg->cmsg_level != SOL_SOCKET) in verify_skb_metadata()
214 switch (cmsg->cmsg_type) { in verify_skb_metadata()
216 ts = (struct scm_timestamping *)CMSG_DATA(cmsg); in verify_skb_metadata()

123