mirror of
https://passt.top/passt
synced 2025-07-28 12:18:00 +02:00
tcp: More type safety for tcp_flow_migrate_target_ext()
tcp_flow_migrate_target_ext() takes a raw union flow *, although it is TCP specific, and requires a FLOW_TYPE_TCP entry. Our usual convention is that such functions should take a struct tcp_tap_conn * instead. Convert it to do so. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
parent
5a07eb3ccc
commit
e56c8038fc
3 changed files with 5 additions and 6 deletions
2
flow.c
2
flow.c
|
@ -1106,7 +1106,7 @@ int flow_migrate_target(struct ctx *c, const struct migrate_stage *stage,
|
||||||
repair_flush(c);
|
repair_flush(c);
|
||||||
|
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
rc = tcp_flow_migrate_target_ext(c, flowtab + i, fd);
|
rc = tcp_flow_migrate_target_ext(c, &flowtab[i].tcp, fd);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
debug("Migration data failure at flow %u: %s, abort",
|
debug("Migration data failure at flow %u: %s, abort",
|
||||||
i, strerror_(-rc));
|
i, strerror_(-rc));
|
||||||
|
|
7
tcp.c
7
tcp.c
|
@ -3394,14 +3394,13 @@ int tcp_flow_migrate_target(struct ctx *c, int fd)
|
||||||
/**
|
/**
|
||||||
* tcp_flow_migrate_target_ext() - Receive extended data for flow, set, connect
|
* tcp_flow_migrate_target_ext() - Receive extended data for flow, set, connect
|
||||||
* @c: Execution context
|
* @c: Execution context
|
||||||
* @flow: Existing flow for this connection data
|
* @conn: Connection entry to complete with extra data
|
||||||
* @fd: Descriptor for state migration
|
* @fd: Descriptor for state migration
|
||||||
*
|
*
|
||||||
* Return: 0 on success, negative on fatal failure, but 0 on single flow failure
|
* Return: 0 on success, negative on fatal failure, but 0 on single flow failure
|
||||||
*/
|
*/
|
||||||
int tcp_flow_migrate_target_ext(struct ctx *c, union flow *flow, int fd)
|
int tcp_flow_migrate_target_ext(struct ctx *c, struct tcp_tap_conn *conn, int fd)
|
||||||
{
|
{
|
||||||
struct tcp_tap_conn *conn = &flow->tcp;
|
|
||||||
uint32_t peek_offset = conn->seq_to_tap - conn->seq_ack_from_tap;
|
uint32_t peek_offset = conn->seq_to_tap - conn->seq_ack_from_tap;
|
||||||
struct tcp_tap_transfer_ext t;
|
struct tcp_tap_transfer_ext t;
|
||||||
int s = conn->sock, rc;
|
int s = conn->sock, rc;
|
||||||
|
@ -3413,7 +3412,7 @@ int tcp_flow_migrate_target_ext(struct ctx *c, union flow *flow, int fd)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!t.tcpi_state) { /* Source wants us to skip this flow */
|
if (!t.tcpi_state) { /* Source wants us to skip this flow */
|
||||||
flow_err(flow, "Dropping as requested by source");
|
flow_err(conn, "Dropping as requested by source");
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -239,7 +239,7 @@ int tcp_flow_migrate_source_ext(int fd, int fidx,
|
||||||
const struct tcp_tap_conn *conn);
|
const struct tcp_tap_conn *conn);
|
||||||
|
|
||||||
int tcp_flow_migrate_target(struct ctx *c, int fd);
|
int tcp_flow_migrate_target(struct ctx *c, int fd);
|
||||||
int tcp_flow_migrate_target_ext(struct ctx *c, union flow *flow, int fd);
|
int tcp_flow_migrate_target_ext(struct ctx *c, struct tcp_tap_conn *conn, int fd);
|
||||||
|
|
||||||
bool tcp_flow_is_established(const struct tcp_tap_conn *conn);
|
bool tcp_flow_is_established(const struct tcp_tap_conn *conn);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue