f6e6e8ad40
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>
20 lines
561 B
C
20 lines
561 B
C
/* SPDX-License-Identifier: GPL-2.0-or-later
|
|
* Copyright (c) 2022 Red Hat GmbH
|
|
* Author: Stefano Brivio <sbrivio@redhat.com>
|
|
*/
|
|
|
|
#ifndef TCP_SPLICE_H
|
|
#define TCP_SPLICE_H
|
|
|
|
struct tcp_splice_conn;
|
|
union sockaddr_inany;
|
|
|
|
void tcp_splice_sock_handler(struct ctx *c, union epoll_ref ref,
|
|
uint32_t events);
|
|
bool tcp_splice_conn_from_sock(const struct ctx *c,
|
|
union tcp_listen_epoll_ref ref,
|
|
struct tcp_splice_conn *conn, int s,
|
|
const union sockaddr_inany *sa);
|
|
void tcp_splice_init(struct ctx *c);
|
|
|
|
#endif /* TCP_SPLICE_H */
|