Skip to content

Commit 1e41e29

Browse files
authored
Merge pull request #287 from qzhuyan/fix/william/SSLKEYLOGFILE-tcp-crash-
Fix/william/sslkeylogfile tcp crash
2 parents 0e9ee35 + bb857ea commit 1e41e29

File tree

3 files changed

+15
-12
lines changed

3 files changed

+15
-12
lines changed

.github/workflows/build.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ jobs:
103103
brew install curl zip unzip gnu-sed kerl unixodbc freetds
104104
echo "/usr/local/bin" >> $GITHUB_PATH
105105
git config --global credential.helper store
106-
- uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
106+
- uses: actions/cache@v4
107107
id: cache
108108
with:
109109
path: ~/.kerl

.github/workflows/release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ jobs:
143143
brew install curl zip unzip gnu-sed kerl unixodbc freetds
144144
echo "/usr/local/bin" >> $GITHUB_PATH
145145
git config --global credential.helper store
146-
- uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
146+
- uses: actions/cache@v4
147147
id: cache
148148
with:
149149
path: ~/.kerl

src/emqtt_bench.erl

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,6 @@ connect(Parent, N, PubSub, Opts) ->
538538
Prometheus = lists:member(prometheus, Opts),
539539
GoSignalPid = proplists:get_value(publish_signal_pid, Opts),
540540
SendGoSignal = proplists:get_value(send_go_signal, Opts),
541-
IsQuic = is_quic(Opts),
542541
MRef = case is_pid(GoSignalPid) of
543542
true -> monitor(process, GoSignalPid);
544543
_ -> undefined
@@ -578,7 +577,7 @@ connect(Parent, N, PubSub, Opts) ->
578577
case ConnRet of
579578
{ok, _Props} ->
580579
inc_counter(Prometheus, connect_succ),
581-
(not IsQuic) andalso maybe_record_keylogfile(Client),
580+
_ = maybe_record_keylogfile(Client, Opts),
582581
Res =
583582
case PubSub of
584583
conn ->
@@ -995,10 +994,8 @@ ssl_opts([{sslversion, Vsn} | Opts], Acc) ->
995994
ssl_opts(Opts, [{versions, [Vsn]} | Acc]);
996995
ssl_opts([{ssl, IsSSL} | Opts], Acc) when is_boolean(IsSSL) ->
997996
ssl_opts(Opts, Acc);
998-
ssl_opts([{nst_dets_file, DetsFile}| Opts], Acc) ->
999-
ok = prepare_nst(DetsFile),
1000-
io:format("enable session_tickets~n"),
1001-
ssl_opts(Opts, [{session_tickets, manual}|Acc]);
997+
ssl_opts([{nst_dets_file, _DetsFile}| Opts], Acc) ->
998+
ssl_opts(Opts, [{session_tickets, manual} | Acc]);
1002999
ssl_opts([{ciphers, Ciphers}| Opts], Acc) ->
10031000
CipherList = [ssl:str_to_suite(X) || X <- string:tokens(Ciphers, ",")],
10041001
ssl_opts(Opts, [{ciphers, CipherList} | Acc]);
@@ -1552,6 +1549,10 @@ maybe_prefix_payload(Payload, ClientOpts) ->
15521549
is_quic(Opts) ->
15531550
proplists:get_value(quic, Opts) =/= false.
15541551

1552+
-spec is_tls(proplists:proplist()) -> boolean().
1553+
is_tls(Opts) ->
1554+
proplists:get_bool(ssl, Opts).
1555+
15551556
quic_opts_from_arg(Opts)->
15561557
case proplists:get_value(quic, Opts) of
15571558
V when is_boolean(V) ->
@@ -1584,11 +1585,13 @@ prepare_quicer(Opts) ->
15841585
end.
15851586

15861587
%% @doc write SSL keylog file, for Wireshark TLS decryption.
1587-
%% SSL only, doesn't work for other transport
1588+
%% SSL only, doesn't work for other transports
15881589
%% @end
1589-
-spec maybe_record_keylogfile(emqtt:client()) -> ok.
1590-
maybe_record_keylogfile(Client) when is_pid(Client) ->
1591-
do_write_keylogfile(persistent_term:get(sslkeylogfile, false), Client).
1590+
-spec maybe_record_keylogfile(emqtt:client(), proplists:proplist()) -> _.
1591+
maybe_record_keylogfile(Client, Opts) when is_pid(Client) ->
1592+
is_tls(Opts) andalso
1593+
not is_quic(Opts) andalso
1594+
do_write_keylogfile(persistent_term:get(sslkeylogfile, false), Client).
15921595
do_write_keylogfile(false, _Client) ->
15931596
ok;
15941597
do_write_keylogfile(Keylogpath, Client) ->

0 commit comments

Comments
 (0)