| 6481 | } |
| 6482 | |
| 6483 | int |
| 6484 | sctp_soreceive(struct socket *so, |
| 6485 | struct sockaddr **psa, |
| 6486 | struct uio *uio, |
| 6487 | struct mbuf **mp0, |
| 6488 | struct mbuf **controlp, |
| 6489 | int *flagsp) |
| 6490 | { |
| 6491 | int error, fromlen; |
| 6492 | uint8_t sockbuf[256]; |
| 6493 | struct sockaddr *from; |
| 6494 | struct sctp_extrcvinfo sinfo; |
| 6495 | int filling_sinfo = 1; |
| 6496 | int flags; |
| 6497 | struct sctp_inpcb *inp; |
| 6498 | |
| 6499 | inp = (struct sctp_inpcb *)so->so_pcb; |
| 6500 | /* pickup the assoc we are reading from */ |
| 6501 | if (inp == NULL) { |
| 6502 | SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTPUTIL, EINVAL); |
| 6503 | return (EINVAL); |
| 6504 | } |
| 6505 | if ((sctp_is_feature_off(inp, SCTP_PCB_FLAGS_RECVDATAIOEVNT) && |
| 6506 | sctp_is_feature_off(inp, SCTP_PCB_FLAGS_RECVRCVINFO) && |
| 6507 | sctp_is_feature_off(inp, SCTP_PCB_FLAGS_RECVNXTINFO)) || |
| 6508 | (controlp == NULL)) { |
| 6509 | /* user does not want the sndrcv ctl */ |
| 6510 | filling_sinfo = 0; |
| 6511 | } |
| 6512 | if (psa) { |
| 6513 | from = (struct sockaddr *)sockbuf; |
| 6514 | fromlen = sizeof(sockbuf); |
| 6515 | from->sa_len = 0; |
| 6516 | } else { |
| 6517 | from = NULL; |
| 6518 | fromlen = 0; |
| 6519 | } |
| 6520 | |
| 6521 | if (filling_sinfo) { |
| 6522 | memset(&sinfo, 0, sizeof(struct sctp_extrcvinfo)); |
| 6523 | } |
| 6524 | if (flagsp != NULL) { |
| 6525 | flags = *flagsp; |
| 6526 | } else { |
| 6527 | flags = 0; |
| 6528 | } |
| 6529 | error = sctp_sorecvmsg(so, uio, mp0, from, fromlen, &flags, |
| 6530 | (struct sctp_sndrcvinfo *)&sinfo, filling_sinfo); |
| 6531 | if (flagsp != NULL) { |
| 6532 | *flagsp = flags; |
| 6533 | } |
| 6534 | if (controlp != NULL) { |
| 6535 | /* copy back the sinfo in a CMSG format */ |
| 6536 | if (filling_sinfo && ((flags & MSG_NOTIFICATION) == 0)) { |
| 6537 | *controlp = sctp_build_ctl_nchunk(inp, |
| 6538 | (struct sctp_sndrcvinfo *)&sinfo); |
| 6539 | } else { |
| 6540 | *controlp = NULL; |
nothing calls this directly
no test coverage detected