From owner-svn-src-all@freebsd.org Mon May 4 20:19:58 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 332852C1E02; Mon, 4 May 2020 20:19:58 +0000 (UTC) (envelope-from rrs@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49GDjp0NGmz3GBL; Mon, 4 May 2020 20:19:58 +0000 (UTC) (envelope-from rrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 03C3C1D4F; Mon, 4 May 2020 20:19:58 +0000 (UTC) (envelope-from rrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 044KJvHB051860; Mon, 4 May 2020 20:19:57 GMT (envelope-from rrs@FreeBSD.org) Received: (from rrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 044KJvsw051859; Mon, 4 May 2020 20:19:57 GMT (envelope-from rrs@FreeBSD.org) Message-Id: <202005042019.044KJvsw051859@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rrs set sender to rrs@FreeBSD.org using -f From: Randall Stewart Date: Mon, 4 May 2020 20:19:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360638 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: rrs X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 360638 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 May 2020 20:19:58 -0000 Author: rrs Date: Mon May 4 20:19:57 2020 New Revision: 360638 URL: https://svnweb.freebsd.org/changeset/base/360638 Log: Adjust the fb to have a way to ask the underlying stack if it can support the PRUS option (OOB). And then have the new function call that to validate and give the correct error response if needed to the user (rack and bbr do not support obsoleted OOB data). Sponsoered by: Netflix Inc. Differential Revision: https://reviews.freebsd.org/D24574 Modified: head/sys/netinet/tcp_usrreq.c head/sys/netinet/tcp_var.h Modified: head/sys/netinet/tcp_usrreq.c ============================================================================== --- head/sys/netinet/tcp_usrreq.c Mon May 4 18:40:56 2020 (r360637) +++ head/sys/netinet/tcp_usrreq.c Mon May 4 20:19:57 2020 (r360638) @@ -133,6 +133,8 @@ static void tcp_disconnect(struct tcpcb *); static void tcp_usrclosed(struct tcpcb *); static void tcp_fill_info(struct tcpcb *, struct tcp_info *); +static int tcp_pru_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,15 @@ tcp_usr_send(struct socket *so, int flags, struct mbuf goto out; } tp = intotcpcb(inp); + if (flags & PRUS_OOB) { + if ((error = tcp_pru_options_support(tp, PRUS_OOB)) != 0) { + if (control) + m_freem(control); + if (m && (flags & PRUS_NOTREADY) == 0) + m_freem(m); + goto out; + } + } TCPDEBUG1(); if (nam != NULL && tp->t_state < TCPS_SYN_SENT) { switch (nam->sa_family) { @@ -1362,6 +1373,24 @@ tcp_usr_close(struct socket *so) NET_EPOCH_EXIT(et); } +static int +tcp_pru_options_support(struct tcpcb *tp, int flags) +{ + /* + * If the specific TCP stack has a pru_options + * specified then it does not always support + * all the PRU_XX options and we must ask it. + * If the function is not specified then all + * of the PRU_XX options are supported. + */ + int ret = 0; + + if (tp->t_fb->tfb_pru_options) { + ret = (*tp->t_fb->tfb_pru_options)(tp, flags); + } + return (ret); +} + /* * Receive out-of-band data. */ @@ -1381,6 +1410,10 @@ tcp_usr_rcvoob(struct socket *so, struct mbuf *m, int goto out; } tp = intotcpcb(inp); + error = tcp_pru_options_support(tp, PRUS_OOB); + if (error) { + goto out; + } TCPDEBUG1(); if ((so->so_oobmark == 0 && (so->so_rcv.sb_state & SBS_RCVATMARK) == 0) || Modified: head/sys/netinet/tcp_var.h ============================================================================== --- head/sys/netinet/tcp_var.h Mon May 4 18:40:56 2020 (r360637) +++ head/sys/netinet/tcp_var.h Mon May 4 20:19:57 2020 (r360638) @@ -345,6 +345,7 @@ struct tcp_function_block { void (*tfb_tcp_rexmit_tmr)(struct tcpcb *); int (*tfb_tcp_handoff_ok)(struct tcpcb *); void (*tfb_tcp_mtu_chg)(struct tcpcb *); + int (*tfb_pru_options)(struct tcpcb *, int); volatile uint32_t tfb_refcnt; uint32_t tfb_flags; uint8_t tfb_id;