mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-04-25 00:52:45 -04:00
selftests/net: Add trace events matching to tcp_ao
Setup trace points, add a new ftrace instance in order to not interfere with the rest of the system, filtering by net namespace cookies. Raise a new background thread that parses trace_pipe, matches them with the list of expected events. Wiring up trace events to selftests provides another insight if there is anything unexpected happining in the tcp-ao code (i.e. key rotation when it's not expected). Note: in real programs libtraceevent should be used instead of this manual labor of setting ftrace up and parsing. I'm not using it here as I don't want to have an .so library dependency that one would have to bring into VM or DUT (Device Under Test). Please, don't copy it over into any real world programs, that aren't tests. Signed-off-by: Dmitry Safonov <0x7f454c46@gmail.com> Link: https://patch.msgid.link/20240823-tcp-ao-selftests-upd-6-12-v4-8-05623636fe8c@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
committed by
Jakub Kicinski
parent
044e037051
commit
586d87021f
@@ -21,6 +21,32 @@ void randomize_buffer(void *buf, size_t buflen)
|
||||
}
|
||||
}
|
||||
|
||||
__printf(3, 4) int test_echo(const char *fname, bool append,
|
||||
const char *fmt, ...)
|
||||
{
|
||||
size_t len, written;
|
||||
va_list vargs;
|
||||
char *msg;
|
||||
FILE *f;
|
||||
|
||||
f = fopen(fname, append ? "a" : "w");
|
||||
if (!f)
|
||||
return -errno;
|
||||
|
||||
va_start(vargs, fmt);
|
||||
msg = test_snprintf(fmt, vargs);
|
||||
va_end(vargs);
|
||||
if (!msg) {
|
||||
fclose(f);
|
||||
return -1;
|
||||
}
|
||||
len = strlen(msg);
|
||||
written = fwrite(msg, 1, len, f);
|
||||
fclose(f);
|
||||
free(msg);
|
||||
return written == len ? 0 : -1;
|
||||
}
|
||||
|
||||
const struct sockaddr_in6 addr_any6 = {
|
||||
.sin6_family = AF_INET6,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user