Skip to content

Commit

Permalink
ktls: Use SOPT_SETCAP to fix KTLS socket options for CHERI kernels
Browse files Browse the repository at this point in the history
  • Loading branch information
bsdjhb committed Jul 3, 2024
1 parent 53bb98e commit 49048f4
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions sys/netinet/tcp_usrreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -2288,7 +2288,13 @@ tcp_default_ctloutput(struct tcpcb *tp, struct sockopt *sopt)
#ifdef KERN_TLS
case TCP_TXTLS_ENABLE:
INP_WUNLOCK(inp);
#if __has_feature(capabilities)
sopt->sopt_dir = SOPT_SETCAP;
#endif
error = copyin_tls_enable(sopt, &tls);
#if __has_feature(capabilities)
sopt->sopt_dir = SOPT_SET;
#endif
if (error)
break;
error = ktls_enable_tx(so, &tls);
Expand All @@ -2305,8 +2311,14 @@ tcp_default_ctloutput(struct tcpcb *tp, struct sockopt *sopt)
break;
case TCP_RXTLS_ENABLE:
INP_WUNLOCK(inp);
#if __has_feature(capabilities)
sopt->sopt_dir = SOPT_SETCAP;
#endif
error = sooptcopyin(sopt, &tls, sizeof(tls),
sizeof(tls));
#if __has_feature(capabilities)
sopt->sopt_dir = SOPT_SET;
#endif
if (error)
break;
error = ktls_enable_rx(so, &tls);
Expand Down

0 comments on commit 49048f4

Please sign in to comment.