Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F133111978
D25923.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D25923.id.diff
View Options
Index: head/sys/kern/uipc_socket.c
===================================================================
--- head/sys/kern/uipc_socket.c
+++ head/sys/kern/uipc_socket.c
@@ -2056,6 +2056,32 @@
if (m != NULL && m->m_type == MT_CONTROL) {
struct mbuf *cm = NULL, *cmn;
struct mbuf **cme = &cm;
+#ifdef KERN_TLS
+ struct cmsghdr *cmsg;
+ struct tls_get_record tgr;
+
+ /*
+ * For MSG_TLSAPPDATA, check for a non-application data
+ * record. If found, return ENXIO without removing
+ * it from the receive queue. This allows a subsequent
+ * call without MSG_TLSAPPDATA to receive it.
+ * Note that, for TLS, there should only be a single
+ * control mbuf with the TLS_GET_RECORD message in it.
+ */
+ if (flags & MSG_TLSAPPDATA) {
+ cmsg = mtod(m, struct cmsghdr *);
+ if (cmsg->cmsg_type == TLS_GET_RECORD &&
+ cmsg->cmsg_len == CMSG_LEN(sizeof(tgr))) {
+ memcpy(&tgr, CMSG_DATA(cmsg), sizeof(tgr));
+ /* This will need to change for TLS 1.3. */
+ if (tgr.tls_type != TLS_RLTYPE_APP) {
+ SOCKBUF_UNLOCK(&so->so_rcv);
+ error = ENXIO;
+ goto release;
+ }
+ }
+ }
+#endif
do {
if (flags & MSG_PEEK) {
Index: head/sys/sys/socket.h
===================================================================
--- head/sys/sys/socket.h
+++ head/sys/sys/socket.h
@@ -468,6 +468,7 @@
#endif
#ifdef _KERNEL
#define MSG_MORETOCOME 0x00100000 /* additional data pending */
+#define MSG_TLSAPPDATA 0x00200000 /* only soreceive() app. data (TLS) */
#endif
/*
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Oct 24, 2:04 AM (11 h, 16 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
24098077
Default Alt Text
D25923.id.diff (1 KB)
Attached To
Mode
D25923: add a MSG_TLSAPPDATA flag that tells sorecieve() to return ENXIO for TLS non-application data records
Attached
Detach File
Event Timeline
Log In to Comment