Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 23 May 2020 23:38:36 +0000 (UTC)
From:      Rick Macklem <rmacklem@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r361428 - in projects/nfs-over-tls/sys: fs/nfsserver kern sys
Message-ID:  <202005232338.04NNcaKw058662@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rmacklem
Date: Sat May 23 23:38:35 2020
New Revision: 361428
URL: https://svnweb.freebsd.org/changeset/base/361428

Log:
  Fix a few problems caused during the code merge of the up-to-date head kernel.
  I think it now builds, but will it work?

Modified:
  projects/nfs-over-tls/sys/fs/nfsserver/nfs_nfsdcache.c
  projects/nfs-over-tls/sys/kern/uipc_ktls.c
  projects/nfs-over-tls/sys/kern/uipc_sockbuf.c
  projects/nfs-over-tls/sys/sys/socket.h

Modified: projects/nfs-over-tls/sys/fs/nfsserver/nfs_nfsdcache.c
==============================================================================
--- projects/nfs-over-tls/sys/fs/nfsserver/nfs_nfsdcache.c	Sat May 23 23:10:03 2020	(r361427)
+++ projects/nfs-over-tls/sys/fs/nfsserver/nfs_nfsdcache.c	Sat May 23 23:38:35 2020	(r361428)
@@ -1021,22 +1021,8 @@ nfsrc_getlenandcksum(struct mbuf *m1, u_int16_t *cksum
 		len += m->m_len;
 		m = m->m_next;
 	}
-	/*
-	 * in_cksum() doesn't work for ext_pgs mbufs, so just return a
-	 * random checksum to avoid a false hit.
-	 * Since NFSv4.1 and NFSv4.2 does not actually use
-	 * the DRC, due to sessions, I think this should be ok.
-	 * Also, most NFS over TCP implementations do not implement
-	 * a DRC at all.  Unfortunately, the DRC is used for NFSv4.0
-	 * for the cases where there are sequenced operations, such as
-	 * file lock operations, so it must still be enabled for NFSv4.0.
-	 */
-	if ((m1->m_flags & M_NOMAP) == 0) {
-		cklen = (len > NFSRVCACHE_CHECKLEN) ? NFSRVCACHE_CHECKLEN :
-		    len;
-		*cksum = in_cksum(m1, cklen);
-	} else
-		*cksum = arc4random();
+	cklen = (len > NFSRVCACHE_CHECKLEN) ? NFSRVCACHE_CHECKLEN : len;
+	*cksum = in_cksum(m1, cklen);
 	return (len);
 }
 

Modified: projects/nfs-over-tls/sys/kern/uipc_ktls.c
==============================================================================
--- projects/nfs-over-tls/sys/kern/uipc_ktls.c	Sat May 23 23:10:03 2020	(r361427)
+++ projects/nfs-over-tls/sys/kern/uipc_ktls.c	Sat May 23 23:38:35 2020	(r361428)
@@ -2070,8 +2070,7 @@ ktls_work_thread(void *ctx)
 {
 	struct ktls_wq *wq = ctx;
 	struct socket *so, *son;
-	struct ktls_session *tls;
-	struct mbuf *m;
+	struct mbuf *m, *n;
 	STAILQ_HEAD(, mbuf) local_head;
 	STAILQ_HEAD(, socket) local_so_head;
 
@@ -2093,9 +2092,6 @@ ktls_work_thread(void *ctx)
 		STAILQ_CONCAT(&local_so_head, &wq->so_head);
 		mtx_unlock(&wq->mtx);
 
-		STAILQ_FOREACH_SAFE(p, &local_head, stailq, n) {
-			if (p->mbuf != NULL) {
-				ktls_encrypt(p);
 		STAILQ_FOREACH_SAFE(m, &local_head, m_epg_stailq, n) {
 			if (m->m_epg_flags & EPG_FLAG_2FREE) {
 				ktls_free(m->m_epg_tls);

Modified: projects/nfs-over-tls/sys/kern/uipc_sockbuf.c
==============================================================================
--- projects/nfs-over-tls/sys/kern/uipc_sockbuf.c	Sat May 23 23:10:03 2020	(r361427)
+++ projects/nfs-over-tls/sys/kern/uipc_sockbuf.c	Sat May 23 23:38:35 2020	(r361428)
@@ -1373,7 +1373,7 @@ sbcompress_ktls_rx(struct sockbuf *sb, struct mbuf *m,
 		    ("TLS RX mbuf %p is not MT_DATA", m));
 		KASSERT((m->m_flags & M_NOTREADY) != 0,
 		    ("TLS RX mbuf %p ready", m));
-		KASSERT((m->m_flags & M_NOMAP) == 0,
+		KASSERT((m->m_flags & M_EXTPG) == 0,
 		    ("TLS RX mbuf %p unmapped", m));
 
 		if (m->m_len == 0) {
@@ -1388,7 +1388,7 @@ sbcompress_ktls_rx(struct sockbuf *sb, struct mbuf *m,
 		if (n &&
 		    M_WRITABLE(n) &&
 		    ((sb->sb_flags & SB_NOCOALESCE) == 0) &&
-		    !(n->m_flags & (M_NOMAP)) &&
+		    !(n->m_flags & (M_EXTPG)) &&
 		    m->m_len <= MCLBYTES / 4 && /* XXX: Don't copy too much */
 		    m->m_len <= M_TRAILINGSPACE(n)) {
 			m_copydata(m, 0, m->m_len, mtodo(n, n->m_len));

Modified: projects/nfs-over-tls/sys/sys/socket.h
==============================================================================
--- projects/nfs-over-tls/sys/sys/socket.h	Sat May 23 23:10:03 2020	(r361427)
+++ projects/nfs-over-tls/sys/sys/socket.h	Sat May 23 23:38:35 2020	(r361428)
@@ -471,6 +471,7 @@ struct msghdr {
 #endif
 #ifdef _KERNEL
 #define	MSG_MORETOCOME	 0x00100000	/* additional data pending */
+#define	MSG_TLSAPPDATA	 0x00200000	/* only soreceive() app. data (TLS) */
 #endif
 
 /*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202005232338.04NNcaKw058662>