MCPcopy Create free account
hub / github.com/F-Stack/f-stack / tcp_usr_rcvoob

Function tcp_usr_rcvoob

freebsd/netinet/tcp_usrreq.c:1484–1526  ·  view source on GitHub ↗

* Receive out-of-band data. */

Source from the content-addressed store, hash-verified

1482 * Receive out-of-band data.
1483 */
1484static int
1485tcp_usr_rcvoob(struct socket *so, struct mbuf *m, int flags)
1486{
1487 int error = 0;
1488 struct inpcb *inp;
1489 struct tcpcb *tp = NULL;
1490
1491 TCPDEBUG0;
1492 inp = sotoinpcb(so);
1493 KASSERT(inp != NULL, ("tcp_usr_rcvoob: inp == NULL"));
1494 INP_WLOCK(inp);
1495 if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) {
1496 error = ECONNRESET;
1497 goto out;
1498 }
1499 tp = intotcpcb(inp);
1500 error = tcp_pru_options_support(tp, PRUS_OOB);
1501 if (error) {
1502 goto out;
1503 }
1504 TCPDEBUG1();
1505 if ((so->so_oobmark == 0 &&
1506 (so->so_rcv.sb_state & SBS_RCVATMARK) == 0) ||
1507 so->so_options & SO_OOBINLINE ||
1508 tp->t_oobflags & TCPOOB_HADDATA) {
1509 error = EINVAL;
1510 goto out;
1511 }
1512 if ((tp->t_oobflags & TCPOOB_HAVEDATA) == 0) {
1513 error = EWOULDBLOCK;
1514 goto out;
1515 }
1516 m->m_len = 1;
1517 *mtod(m, caddr_t) = tp->t_iobc;
1518 if ((flags & MSG_PEEK) == 0)
1519 tp->t_oobflags ^= (TCPOOB_HAVEDATA | TCPOOB_HADDATA);
1520
1521out:
1522 TCPDEBUG2(PRU_RCVOOB);
1523 TCP_PROBE2(debug__user, tp, PRU_RCVOOB);
1524 INP_WUNLOCK(inp);
1525 return (error);
1526}
1527
1528#ifdef INET
1529struct pr_usrreqs tcp_usrreqs = {

Callers

nothing calls this directly

Calls 1

tcp_pru_options_supportFunction · 0.85

Tested by

no test coverage detected