aboutgitcodebugslistschat
path: root/pif.h
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2024-07-18 15:26:28 +1000
committerStefano Brivio <sbrivio@redhat.com>2024-07-19 18:32:37 +0200
commit4e2d36e83fb1ff86c2e7f6d0832827d59f829934 (patch)
tree3057970692f0a3924a12bc27bfbf758db6204030 /pif.h
parent8012f5ff55b64fcfcc8c9512492247153327d3c4 (diff)
downloadpasst-4e2d36e83fb1ff86c2e7f6d0832827d59f829934.tar
passt-4e2d36e83fb1ff86c2e7f6d0832827d59f829934.tar.gz
passt-4e2d36e83fb1ff86c2e7f6d0832827d59f829934.tar.bz2
passt-4e2d36e83fb1ff86c2e7f6d0832827d59f829934.tar.lz
passt-4e2d36e83fb1ff86c2e7f6d0832827d59f829934.tar.xz
passt-4e2d36e83fb1ff86c2e7f6d0832827d59f829934.tar.zst
passt-4e2d36e83fb1ff86c2e7f6d0832827d59f829934.zip
flow: Common address information for target side
Require the address and port information for the target (non initiating) side to be populated when a flow enters TGT state. Implement that for TCP and ICMP. For now this leaves some information redundantly recorded in both generic and type specific fields. We'll fix that in later patches. For TCP we now use the information from the flow to construct the destination socket address in both tcp_conn_from_tap() and tcp_splice_connect(). Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'pif.h')
-rw-r--r--pif.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/pif.h b/pif.h
index ca85b34..8777bb5 100644
--- a/pif.h
+++ b/pif.h
@@ -7,6 +7,9 @@
#ifndef PIF_H
#define PIF_H
+union inany_addr;
+union sockaddr_inany;
+
/**
* enum pif_type - Type of passt/pasta interface ("pif")
*
@@ -43,4 +46,18 @@ static inline const char *pif_name(uint8_t pif)
return pif_type(pif);
}
+/**
+ * pif_is_socket() - Is interface implemented via L4 sockets?
+ * @pif: pif to check
+ *
+ * Return: true of @pif is an L4 socket based interface, otherwise false
+ */
+static inline bool pif_is_socket(uint8_t pif)
+{
+ return pif == PIF_HOST || pif == PIF_SPLICE;
+}
+
+void pif_sockaddr(const struct ctx *c, union sockaddr_inany *sa, socklen_t *sl,
+ uint8_t pif, const union inany_addr *addr, in_port_t port);
+
#endif /* PIF_H */