tcp: Use the same sockets to listen for spliced and non-spliced connections
In pasta mode, tcp_sock_init[46]() create separate sockets to listen for spliced connections (these are bound to localhost) and non-spliced connections (these are bound to the host address). This introduces a subtle behavioural difference between pasta and passt: by default, pasta will listen only on a single host address, whereas passt will listen on all addresses (0.0.0.0 or ::). This also prevents us using some additional optimizations that only work with the unspecified (0.0.0.0 or ::) address. However, it turns out we don't need to do this. We can splice a connection if and only if it originates from the loopback address. Currently we ensure this by having the "spliced" listening sockets listening only on loopback. Instead, defer the decision about whether to splice a connection until after accept(), by checking if the connection was made from the loopback address. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:

committed by
Stefano Brivio

parent
356c6e0677
commit
d909fda1e8
@@ -10,8 +10,9 @@ struct tcp_splice_conn;
|
||||
|
||||
void tcp_sock_handler_splice(struct ctx *c, union epoll_ref ref,
|
||||
uint32_t events);
|
||||
void tcp_splice_conn_from_sock(struct ctx *c, union epoll_ref ref,
|
||||
struct tcp_splice_conn *conn, int s);
|
||||
bool tcp_splice_conn_from_sock(struct ctx *c, union epoll_ref ref,
|
||||
struct tcp_splice_conn *conn, int s,
|
||||
const struct sockaddr *sa);
|
||||
void tcp_splice_init(struct ctx *c);
|
||||
|
||||
#endif /* TCP_SPLICE_H */
|
||||
|
Reference in New Issue
Block a user