[PATCH v2] Implement decoding of setsockopt(TCP_AO_ADD_KEY)

Dmitry V. Levin ldv at strace.io
Tue Mar 12 22:14:13 UTC 2024


On Sun, Mar 10, 2024 at 02:22:05PM +0100, наб wrote:
> Samples as run via tcp-ao-wrapper:
>   setsockopt(3, SOL_TCP, TCP_AO_ADD_KEY, {addr={sa_family=AF_INET6, sin6_port=htons(0), sin6_flowinfo=htonl(0), inet_pton(AF_INET6, "::", &sin6_addr), sin6_scope_id=0}, prefix=0, alg_name="hmac(sha1)", ifindex=0, set_current=0, set_rnext=0, sndid=200, rcvid=100, maclen=12, keyflags=0, key="\x42\xe9\xd2\xd3\xd1\xec\x9f\x55\x56\x9c\xd7\x89\x1a\x90\x53\xba\x59\x6d\x5f\x0a", keylen=20}, 288) = 0
>   setsockopt(3, SOL_TCP, TCP_AO_ADD_KEY, {addr={sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("127.0.0.1")}, prefix=32, alg_name="cmac(aes)", ifindex=0, set_current=0, set_rnext=0, sndid=200, rcvid=100, maclen=12, keyflags=0, key="\x7a\x66\x25\xc9\x80\xdb\x68\x95\xf5\xaf\x84\x1b\xd6\x50\x29\xe1", keylen=16}, 288) = -1 ENOPROTOOPT (Protocol not available)
> ---
> keylen included;
> I must've somehow missed PRINT_FIELD_U_CAST() yesterday,
> that's perfect for the two bitfields.
> 
>  NEWS                          |   1 +
>  src/net.c                     |  57 ++++++++++++++++++-
>  src/xlat/tcp_ao_keyf_flags.in |   3 +
>  tests/.gitignore              |   1 +
>  tests/gen_tests.in            |   1 +
>  tests/pure_executables.list   |   1 +
>  tests/tcp_ao.c                | 101 ++++++++++++++++++++++++++++++++++
>  7 files changed, 162 insertions(+), 3 deletions(-)
>  create mode 100644 src/xlat/tcp_ao_keyf_flags.in
>  create mode 100644 tests/tcp_ao.c

Applied, thanks!

[...]
> diff --git a/tests/tcp_ao.c b/tests/tcp_ao.c
> new file mode 100644
> index 0000000..df079bc
> --- /dev/null
> +++ b/tests/tcp_ao.c
> @@ -0,0 +1,101 @@
> +/*
> + * Check decoding of SO_LINGER socket option.

I amended this comment to mention TCP_AO_ADD_KEY instead of SO_LINGER.


-- 
ldv


More information about the Strace-devel mailing list