@@ -829,6 +829,11 @@ pub enum ControlMessageOwned {
829
829
#[ cfg_attr( docsrs, doc( cfg( feature = "net" ) ) ) ]
830
830
Ipv6RecvErr ( libc:: sock_extended_err, Option <sockaddr_in6>) ,
831
831
832
+ /// `SOL_TLS` messages of type `TLS_GET_RECORD_TYPE`, containing the TLS message content type,
833
+ /// normally one of change_cipher_spec(20), alert(21), handshake(22) (for TLS 1.3
834
+ /// resumption tickets), application_data(23)
835
+ TlsGetRecordType ( u8 ) ,
836
+
832
837
/// Catch-all variant for unimplemented cmsg types.
833
838
#[ doc( hidden) ]
834
839
Unknown ( UnknownCmsg ) ,
@@ -846,6 +851,12 @@ pub struct Timestamps {
846
851
pub hw_raw: TimeSpec ,
847
852
}
848
853
854
+ // Defined in `linux/tls.h`
855
+ #[ cfg( all( target_os = "linux" ) ) ]
856
+ const TLS_GET_RECORD_TYPE : c_int = 2 ;
857
+
858
+ const SOL_TLS : c_int = 282 ;
859
+
849
860
impl ControlMessageOwned {
850
861
/// Decodes a `ControlMessageOwned` from raw bytes.
851
862
///
@@ -988,6 +999,11 @@ impl ControlMessageOwned {
988
999
let dl = ptr:: read_unaligned( p as * const libc:: sockaddr_in6) ;
989
1000
ControlMessageOwned :: Ipv6OrigDstAddr ( dl)
990
1001
} ,
1002
+ #[ cfg( all( target_os = "linux" ) ) ]
1003
+ ( SOL_TLS , TLS_GET_RECORD_TYPE ) => {
1004
+ let content_type = ptr:: read_unaligned( p as * const u8 ) ;
1005
+ ControlMessageOwned :: TlsGetRecordType ( content_type)
1006
+ } ,
991
1007
( _, _) => {
992
1008
let sl = std:: slice:: from_raw_parts( p, len) ;
993
1009
let ucmsg = UnknownCmsg ( * header, Vec :: <u8 >:: from( sl) ) ;
0 commit comments