-
Notifications
You must be signed in to change notification settings - Fork 863
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reduce frequency of the decryption failure log #2602
Reduce frequency of the decryption failure log #2602
Conversation
Testing./srt-xtransmit generate "srt://127.0.0.1:4200?bind=:4201&passphrase=abcdefghijk&cryptomode=2" --sendrate 1Mbps --duration 60s --enable-metrics
(route and corrupt packets, branch develop/corrupt-packet)
./srt-xtransmit.exe route -i udp://127.0.0.1:4201?bind=:4200 -o udp://127.0.0.1:5200 --bidir --corruptfreq 5s
./srt-xtransmit receive "srt://:5200?passphrase=abcdefghijk&cryptomode=2" --enable-metrics -v |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I personally think it would be better to have a general mechanism of periodic log suppression, and I think some of such ones are already in use. My idea is to use a variable that remembers the time when the log was printed and a bit set that marks the message being printed. The bit set will be assigned to a particular type of message that should be printed often. The first message printer that catches the time counter to exceed the required suppression period, clears all the flags, which should be set always after the particular type of message has been printed. In order to avoid locking, the time counter and flag set should be affined to a particular thread.
73a8cdb
to
10221d7
Compare
It would be nice to have a general mechanism of periodic log suppression. A proper approach would require improving the logging facility. A simpler way is to add the general mechanism can be added using the introduced |
Current Behavior
If SRT fails to decrypt a packet, one error message is printed from
CCryptoControl::decrypt(..)
:and one warning is reported from
CUDT::handleSocketPacketReception(..)
:Thus two warnings are printed per single decryption failure. In case of an attack in AES-GCM mode, a lot of data packets may be corrupted, and decryption is expected to fail. That would result in too many warning messages.
The Proposal
This PR introduces a new variable
m_tsLogSlowDown
to reduce the frequency of some potentially frequent warnings. Currently, only decryption failure warning uses this mechanism.By default, the following warning will be shown not more often than once per 1 s:
The frequency can be set via the
SRT_LOG_SLOWDOWN_FREQ_MS
definition (available in CMake).TODO