diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2024-07-18 15:26:27 +1000 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2024-07-19 18:32:32 +0200 |
commit | 8012f5ff55b64fcfcc8c9512492247153327d3c4 (patch) | |
tree | baebb17dc01d589d9e924e26969f85be6f0b70fc /flow.h | |
parent | ba74b1fea1ef661dc8cce1d32863c9784d2747a6 (diff) | |
download | passt-8012f5ff55b64fcfcc8c9512492247153327d3c4.tar passt-8012f5ff55b64fcfcc8c9512492247153327d3c4.tar.gz passt-8012f5ff55b64fcfcc8c9512492247153327d3c4.tar.bz2 passt-8012f5ff55b64fcfcc8c9512492247153327d3c4.tar.lz passt-8012f5ff55b64fcfcc8c9512492247153327d3c4.tar.xz passt-8012f5ff55b64fcfcc8c9512492247153327d3c4.tar.zst passt-8012f5ff55b64fcfcc8c9512492247153327d3c4.zip |
flow: Common address information for initiating side
Handling of each protocol needs some degree of tracking of the
addresses and ports at the end of each connection or flow. Sometimes
that's explicit (as in the guest visible addresses for TCP
connections), sometimes implicit (the bound and connected addresses of
sockets).
To allow more consistent handling across protocols we want to
uniformly track the address and port at each end of the connection.
Furthermore, because we allow port remapping, and we sometimes need to
apply NAT, the addresses and ports can be different as seen by the
guest/namespace and as by the host.
Introduce 'struct flowside' to keep track of address and port
information related to one side of a flow. Store two of these in the
common fields of a flow to track that information for both sides.
For now we only populate the initiating side, requiring that
information be completed when a flows enter INI. Later patches will
populate the target side.
For now this leaves some information redundantly recorded in both generic
and type specific fields. We'll fix that in later patches.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'flow.h')
-rw-r--r-- | flow.h | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -136,10 +136,25 @@ extern const uint8_t flow_proto[]; #define TGTSIDE 1 /* Target side index */ /** + * struct flowside - Address information for one side of a flow + * @eaddr: Endpoint address (remote address from passt's PoV) + * @faddr: Forwarding address (local address from passt's PoV) + * @eport: Endpoint port + * @fport: Forwarding port + */ +struct flowside { + union inany_addr faddr; + union inany_addr eaddr; + in_port_t fport; + in_port_t eport; +}; + +/** * struct flow_common - Common fields for packet flows * @state: State of the flow table entry * @type: Type of packet flow * @pif[]: Interface for each side of the flow + * @side[]: Information for each side of the flow */ struct flow_common { #ifdef __GNUC__ @@ -154,6 +169,7 @@ struct flow_common { "Not enough bits for type field"); #endif uint8_t pif[SIDES]; + struct flowside side[SIDES]; }; #define FLOW_INDEX_BITS 17 /* 128k - 1 */ |