aboutgitcodebugslistschat
path: root/tcp_conn.h
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2022-11-17 16:58:55 +1100
committerStefano Brivio <sbrivio@redhat.com>2022-11-25 01:35:32 +0100
commitca69c3f1964846b27f8333cd06f7594289cbf53b (patch)
treeea289d1244c82646134ee280b650b7dc73a509d2 /tcp_conn.h
parentb65d603e23d7f05c4974dcf22f3244d2ae987482 (diff)
downloadpasst-ca69c3f1964846b27f8333cd06f7594289cbf53b.tar
passt-ca69c3f1964846b27f8333cd06f7594289cbf53b.tar.gz
passt-ca69c3f1964846b27f8333cd06f7594289cbf53b.tar.bz2
passt-ca69c3f1964846b27f8333cd06f7594289cbf53b.tar.lz
passt-ca69c3f1964846b27f8333cd06f7594289cbf53b.tar.xz
passt-ca69c3f1964846b27f8333cd06f7594289cbf53b.tar.zst
passt-ca69c3f1964846b27f8333cd06f7594289cbf53b.zip
inany: Helper functions for handling addresses which could be IPv4 or IPv6
struct tcp_conn stores an address which could be IPv6 or IPv4 using a union. We can do this without an additional tag by encoding IPv4 addresses as IPv4-mapped IPv6 addresses. This approach is useful wider than the specific place in tcp_conn, so expose a new 'union inany_addr' like this from a new inany.h. Along with that create a number of helper functions to make working with these "inany" addresses easier. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'tcp_conn.h')
-rw-r--r--tcp_conn.h15
1 files changed, 2 insertions, 13 deletions
diff --git a/tcp_conn.h b/tcp_conn.h
index 4bffe9a..bf50e1c 100644
--- a/tcp_conn.h
+++ b/tcp_conn.h
@@ -35,10 +35,7 @@ extern const char *tcp_common_flag_str[];
* @ws_to_tap: Window scaling factor advertised to tap/guest
* @sndbuf: Sending buffer in kernel, rounded to 2 ^ SNDBUF_BITS
* @seq_dup_ack_approx: Last duplicate ACK number sent to tap
- * @a.a6: IPv6 remote address, can be IPv4-mapped
- * @a.a4.zero: Zero prefix for IPv4-mapped, see RFC 6890, Table 20
- * @a.a4.one: Ones prefix for IPv4-mapped
- * @a.a4.a: IPv4 address
+ * @addr: Remote address (IPv4 or IPv6)
* @tap_port: Guest-facing tap port
* @sock_port: Remote, socket-facing port
* @wnd_from_tap: Last window size from tap, unscaled (as received)
@@ -108,15 +105,7 @@ struct tcp_tap_conn {
uint8_t seq_dup_ack_approx;
- union {
- struct in6_addr a6;
- struct {
- uint8_t zero[10];
- uint8_t one[2];
- struct in_addr a;
- } a4;
- } a;
-
+ union inany_addr addr;
in_port_t tap_port;
in_port_t sock_port;