(td, uap)
| 210 | } |
| 211 | |
| 212 | int |
| 213 | sys_sctp_generic_sendmsg (td, uap) |
| 214 | struct thread *td; |
| 215 | struct sctp_generic_sendmsg_args /* { |
| 216 | int sd, |
| 217 | caddr_t msg, |
| 218 | int mlen, |
| 219 | caddr_t to, |
| 220 | __socklen_t tolen, |
| 221 | struct sctp_sndrcvinfo *sinfo, |
| 222 | int flags |
| 223 | } */ *uap; |
| 224 | { |
| 225 | struct sctp_sndrcvinfo sinfo, *u_sinfo = NULL; |
| 226 | struct socket *so; |
| 227 | struct file *fp = NULL; |
| 228 | struct sockaddr *to = NULL; |
| 229 | #ifdef KTRACE |
| 230 | struct uio *ktruio = NULL; |
| 231 | #endif |
| 232 | struct uio auio; |
| 233 | struct iovec iov[1]; |
| 234 | cap_rights_t rights; |
| 235 | int error = 0, len; |
| 236 | |
| 237 | if (uap->sinfo != NULL) { |
| 238 | error = copyin(uap->sinfo, &sinfo, sizeof (sinfo)); |
| 239 | if (error != 0) |
| 240 | return (error); |
| 241 | u_sinfo = &sinfo; |
| 242 | } |
| 243 | |
| 244 | cap_rights_init_one(&rights, CAP_SEND); |
| 245 | if (uap->tolen != 0) { |
| 246 | error = getsockaddr(&to, uap->to, uap->tolen); |
| 247 | if (error != 0) { |
| 248 | to = NULL; |
| 249 | goto sctp_bad2; |
| 250 | } |
| 251 | cap_rights_set_one(&rights, CAP_CONNECT); |
| 252 | } |
| 253 | |
| 254 | AUDIT_ARG_FD(uap->sd); |
| 255 | error = getsock_cap(td, uap->sd, &rights, &fp, NULL, NULL); |
| 256 | if (error != 0) |
| 257 | goto sctp_bad; |
| 258 | #ifdef KTRACE |
| 259 | if (to && (KTRPOINT(td, KTR_STRUCT))) |
| 260 | ktrsockaddr(to); |
| 261 | #endif |
| 262 | |
| 263 | iov[0].iov_base = uap->msg; |
| 264 | iov[0].iov_len = uap->mlen; |
| 265 | |
| 266 | so = (struct socket *)fp->f_data; |
| 267 | if (so->so_proto->pr_protocol != IPPROTO_SCTP) { |
| 268 | error = EOPNOTSUPP; |
| 269 | goto sctp_bad; |
nothing calls this directly
no test coverage detected