Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/uipc_socket.c
Show First 20 Lines • Show All 2,128 Lines • ▼ Show 20 Lines | dontblock: | ||||
if (m != NULL && m->m_type == MT_CONTROL) { | if (m != NULL && m->m_type == MT_CONTROL) { | ||||
struct mbuf *cm = NULL, *cmn; | struct mbuf *cm = NULL, *cmn; | ||||
struct mbuf **cme = &cm; | struct mbuf **cme = &cm; | ||||
#ifdef KERN_TLS | #ifdef KERN_TLS | ||||
struct cmsghdr *cmsg; | struct cmsghdr *cmsg; | ||||
struct tls_get_record tgr; | struct tls_get_record tgr; | ||||
/* | /* | ||||
* For MSG_TLSAPPDATA, check for a non-application data | * For MSG_TLSAPPDATA, check for an alert record. | ||||
* record. If found, return ENXIO without removing | * If found, return ENXIO without removing | ||||
* it from the receive queue. This allows a subsequent | * it from the receive queue. This allows a subsequent | ||||
* call without MSG_TLSAPPDATA to receive it. | * call without MSG_TLSAPPDATA to receive it. | ||||
* Note that, for TLS, there should only be a single | * Note that, for TLS, there should only be a single | ||||
* control mbuf with the TLS_GET_RECORD message in it. | * control mbuf with the TLS_GET_RECORD message in it. | ||||
*/ | */ | ||||
if (flags & MSG_TLSAPPDATA) { | if (flags & MSG_TLSAPPDATA) { | ||||
cmsg = mtod(m, struct cmsghdr *); | cmsg = mtod(m, struct cmsghdr *); | ||||
if (cmsg->cmsg_type == TLS_GET_RECORD && | if (cmsg->cmsg_type == TLS_GET_RECORD && | ||||
cmsg->cmsg_len == CMSG_LEN(sizeof(tgr))) { | cmsg->cmsg_len == CMSG_LEN(sizeof(tgr))) { | ||||
memcpy(&tgr, CMSG_DATA(cmsg), sizeof(tgr)); | memcpy(&tgr, CMSG_DATA(cmsg), sizeof(tgr)); | ||||
/* This will need to change for TLS 1.3. */ | if (tgr.tls_type == TLS_RLTYPE_ALERT) { | ||||
if (tgr.tls_type != TLS_RLTYPE_APP) { | |||||
SOCKBUF_UNLOCK(&so->so_rcv); | SOCKBUF_UNLOCK(&so->so_rcv); | ||||
error = ENXIO; | error = ENXIO; | ||||
goto release; | goto release; | ||||
} | } | ||||
} | } | ||||
} | } | ||||
#endif | #endif | ||||
▲ Show 20 Lines • Show All 2,388 Lines • Show Last 20 Lines |