diff options
| author | David Gibson <david@gibson.dropbear.id.au> | 2025-12-02 15:02:05 +1100 |
|---|---|---|
| committer | Stefano Brivio <sbrivio@redhat.com> | 2025-12-02 23:07:14 +0100 |
| commit | b0523f6b0629358024e95b5d01dc81512cfa8e10 (patch) | |
| tree | 0b388c33fbbe187b93bac45b5976a4cfa979090c /test/lib | |
| parent | 484dcfaa4057b43a262453de18b5e127a4920eb1 (diff) | |
| download | passt-b0523f6b0629358024e95b5d01dc81512cfa8e10.tar passt-b0523f6b0629358024e95b5d01dc81512cfa8e10.tar.gz passt-b0523f6b0629358024e95b5d01dc81512cfa8e10.tar.bz2 passt-b0523f6b0629358024e95b5d01dc81512cfa8e10.tar.lz passt-b0523f6b0629358024e95b5d01dc81512cfa8e10.tar.xz passt-b0523f6b0629358024e95b5d01dc81512cfa8e10.tar.zst passt-b0523f6b0629358024e95b5d01dc81512cfa8e10.zip | |
inany: Let length of sockaddr_inany be implicit from the family
sockaddr_inany can contain either an IPv4 or IPv6 socket address, so the
relevant length for bind() or connect() can vary. In pif_sockaddr() we
return that length, and in sock_l4_sa() we take it as an extra parameter.
However, sockaddr_inany always contains exactly a sockaddr_in or a
sockaddr_in6 each with a fixed size. Therefore we can derive the relevant
length from the family, and don't need to pass it around separately.
Make a tiny helper to get the relevant address length, and update all
interfaces to use that approach instead.
In the process, fix a buglet in tcp_flow_repair_bind(): we passed
sizeof(union sockaddr_inany) to bind() instead of the specific length for
the address family. Since the sizeof() is always longer than the specific
length, this is probably fine, but not theoretically correct.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'test/lib')
0 files changed, 0 insertions, 0 deletions
