[PATCH] Implement decoding of setsockopt(TCP_AO_ADD_KEY)

Dmitry V. Levin ldv at strace.io
Sun Mar 10 07:54:56 UTC 2024


On Sun, Mar 10, 2024 at 02:21:50AM +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"}, 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"}, 288) = -1 ENOPROTOOPT (Protocol not available)
> ---
> This folds key/keylen into key="{hexdump of length keylen}";
> should keylen be included explicitly?

Yes, I'd suggest printing struct tcp_ao_add.keylen as well.

> set_current and set_rnext are bitfield bools,
> hence explicit PRINTF (you can't sizeof(bitfield));
> this feels kinda stinky as well.

If there is going to be more printing of bit fields,
it would make sense adding a printer for it.


-- 
ldv


More information about the Strace-devel mailing list