diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2024-02-28 22:25:04 +1100 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2024-02-29 09:47:31 +0100 |
commit | f6e6e8ad40eed1cbd48122c67a2ca8fd3a293992 (patch) | |
tree | 953a8861a7a69d957d1810c565afdf5ead533ef1 /tcp_splice.c | |
parent | 0cf6b2d89dbe6f26bb9cba470a5fda84ea1caae7 (diff) | |
download | passt-f6e6e8ad40eed1cbd48122c67a2ca8fd3a293992.tar passt-f6e6e8ad40eed1cbd48122c67a2ca8fd3a293992.tar.gz passt-f6e6e8ad40eed1cbd48122c67a2ca8fd3a293992.tar.bz2 passt-f6e6e8ad40eed1cbd48122c67a2ca8fd3a293992.tar.lz passt-f6e6e8ad40eed1cbd48122c67a2ca8fd3a293992.tar.xz passt-f6e6e8ad40eed1cbd48122c67a2ca8fd3a293992.tar.zst passt-f6e6e8ad40eed1cbd48122c67a2ca8fd3a293992.zip |
inany: Introduce union sockaddr_inany
There are a number of places where we want to handle either a
sockaddr_in or a sockaddr_in6. In some of those we use a void *,
which works ok and matches some standard library interfaces, but
doesn't give a signature level hint that we're dealing with only
sockaddr_in or sockaddr_in6, not (say) sockaddr_un or another type of
socket address. Other places we use a sockaddr_storage, which also
works, but has the same problem in addition to allocating more on the
stack than we need to.
Introduce union sockaddr_inany to explictly handle this case: it has
variants for sockaddr_in and sockaddr_in6. Use it in a number of
places where it's easy to do so.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'tcp_splice.c')
-rw-r--r-- | tcp_splice.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tcp_splice.c b/tcp_splice.c index cdc09a4..beb2fcb 100644 --- a/tcp_splice.c +++ b/tcp_splice.c @@ -447,7 +447,7 @@ static int tcp_splice_new(const struct ctx *c, struct tcp_splice_conn *conn, bool tcp_splice_conn_from_sock(const struct ctx *c, union tcp_listen_epoll_ref ref, struct tcp_splice_conn *conn, int s, - const struct sockaddr *sa) + const union sockaddr_inany *sa) { union inany_addr aany; in_port_t port; |