diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2024-02-29 15:15:32 +1100 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2024-03-12 01:34:45 +0100 |
commit | 3af5e9fdba4cbff1389e507489578f81d21a5181 (patch) | |
tree | c06a9e3bb3ed2a9c72dc08d0d4c51121e4eb8efa /icmp_flow.h | |
parent | 383a6f67e50bbaf63427c9a2dddfd0c22a886160 (diff) | |
download | passt-3af5e9fdba4cbff1389e507489578f81d21a5181.tar passt-3af5e9fdba4cbff1389e507489578f81d21a5181.tar.gz passt-3af5e9fdba4cbff1389e507489578f81d21a5181.tar.bz2 passt-3af5e9fdba4cbff1389e507489578f81d21a5181.tar.lz passt-3af5e9fdba4cbff1389e507489578f81d21a5181.tar.xz passt-3af5e9fdba4cbff1389e507489578f81d21a5181.tar.zst passt-3af5e9fdba4cbff1389e507489578f81d21a5181.zip |
icmp: Store ping socket information in flow table
Currently icmp_id_map[][] stores information about ping sockets in a
bespoke structure. Move the same information into new types of flow
in the flow table. To match that change, replace the existing ICMP
timer with a flow-based timer for expiring ping sockets. This has the
advantage that we only need to scan the active flows, not all possible
ids.
We convert icmp_id_map[][] to point to the flow table entries, rather
than containing its own information. We do still use that array for
locating the right ping flows, rather than using a "flow native" form
of lookup for the time being.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
[sbrivio: Update id_sock description in comment to icmp_ping_new()]
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'icmp_flow.h')
-rw-r--r-- | icmp_flow.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/icmp_flow.h b/icmp_flow.h new file mode 100644 index 0000000..5a2eed9 --- /dev/null +++ b/icmp_flow.h @@ -0,0 +1,31 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later + * Copyright Red Hat + * Author: David Gibson <david@gibson.dropbear.id.au> + * + * ICMP flow tracking data structures + */ +#ifndef ICMP_FLOW_H +#define ICMP_FLOW_H + +/** + * struct icmp_ping_flow - Descriptor for a flow of ping requests/replies + * @f: Generic flow information + * @seq: Last sequence number sent to tap, host order, -1: not sent yet + * @sock: "ping" socket + * @ts: Last associated activity from tap, seconds + * @id: ICMP id for the flow as seen by the guest + */ +struct icmp_ping_flow { + /* Must be first element */ + struct flow_common f; + + int seq; + int sock; + time_t ts; + uint16_t id; +}; + +bool icmp_ping_timer(const struct ctx *c, union flow *flow, + const struct timespec *now); + +#endif /* ICMP_FLOW_H */ |