Index: tcp_usrreq.c =================================================================== --- tcp_usrreq.c +++ tcp_usrreq.c @@ -133,6 +133,8 @@ static void tcp_usrclosed(struct tcpcb *); static void tcp_fill_info(struct tcpcb *, struct tcp_info *); +static int tcp_options_support(struct tcpcb *tp, int flags); + #ifdef TCPDEBUG #define TCPDEBUG0 int ostate = 0 #define TCPDEBUG1() ostate = tp ? tp->t_state : 0 @@ -979,6 +981,16 @@ goto out; } tp = intotcpcb(inp); + if ((flags & MSG_OOB) || (flags & PRUS_OOB)) { + if ((error = tcp_options_support(tp, PRUS_OOB)) != 0) { + if (control) + m_freem(control); + if (m && (flags & PRUS_NOTREADY) == 0) + m_freem(m); + error = ECONNRESET; + goto out; + } + } TCPDEBUG1(); if (nam != NULL && tp->t_state < TCPS_SYN_SENT) { switch (nam->sa_family) { @@ -1362,6 +1374,19 @@ NET_EPOCH_EXIT(et); } +static int +tcp_options_support(struct tcpcb *tp, int flags) +{ + /* + * For now we say we support anything, we + * need to change this so that we ask the + * specific stack and let it decide if + * it supports PRUS_OOB or possibly other + * flags in the future. + */ + return (0); +} + /* * Receive out-of-band data. */ @@ -1381,6 +1406,10 @@ goto out; } tp = intotcpcb(inp); + error = tcp_options_support(tp, PRUS_OOB); + if (error) { + goto out; + } TCPDEBUG1(); if ((so->so_oobmark == 0 && (so->so_rcv.sb_state & SBS_RCVATMARK) == 0) ||