aboutgitcodebugslistschat
path: root/tcp_internal.h
diff options
context:
space:
mode:
Diffstat (limited to 'tcp_internal.h')
-rw-r--r--tcp_internal.h22
1 files changed, 16 insertions, 6 deletions
diff --git a/tcp_internal.h b/tcp_internal.h
index f55025c..d940885 100644
--- a/tcp_internal.h
+++ b/tcp_internal.h
@@ -6,6 +6,11 @@
#ifndef TCP_INTERNAL_H
#define TCP_INTERNAL_H
+#include <stdint.h>
+#include <netinet/tcp.h>
+
+#include "util.h"
+
#define MAX_WS 8
#define MAX_WINDOW (1 << (16 + (MAX_WS)))
@@ -38,6 +43,8 @@
/* Flags for internal usage */
#define DUP_ACK (1 << 5)
+#define KEEPALIVE (1 << 6)
+
#define OPT_EOL 0
#define OPT_NOP 1
#define OPT_MSS 2
@@ -57,12 +64,13 @@
#define CONN_V4(conn) (!!inany_v4(&TAPFLOW(conn)->oaddr))
#define CONN_V6(conn) (!CONN_V4(conn))
-/*
+/**
* enum tcp_iov_parts - I/O vector parts for one TCP frame
* @TCP_IOV_TAP tap backend specific header
* @TCP_IOV_ETH Ethernet header
* @TCP_IOV_IP IP (v4/v6) header
* @TCP_IOV_PAYLOAD IP payload (TCP header + data)
+ * @TCP_IOV_ETH_PAD Ethernet (802.3) padding to 60 bytes
* @TCP_NUM_IOVS the number of entries in the iovec array
*/
enum tcp_iov_parts {
@@ -70,6 +78,7 @@ enum tcp_iov_parts {
TCP_IOV_ETH = 1,
TCP_IOV_IP = 2,
TCP_IOV_PAYLOAD = 3,
+ TCP_IOV_ETH_PAD = 4,
TCP_NUM_IOVS
};
@@ -174,11 +183,12 @@ void tcp_rst_do(const struct ctx *c, struct tcp_tap_conn *conn);
struct tcp_info_linux;
-void tcp_fill_headers(const struct ctx *c, struct tcp_tap_conn *conn,
- struct tap_hdr *taph, struct ethhdr *eh,
- struct iphdr *ip4h, struct ipv6hdr *ip6h,
- struct tcphdr *th, struct iov_tail *payload,
- const uint16_t *ip4_check, uint32_t seq, bool no_tcp_csum);
+size_t tcp_fill_headers(const struct ctx *c, struct tcp_tap_conn *conn,
+ struct ethhdr *eh,
+ struct iphdr *ip4h, struct ipv6hdr *ip6h,
+ struct tcphdr *th, struct iov_tail *payload,
+ const uint16_t *ip4_check, uint32_t seq,
+ bool no_tcp_csum);
int tcp_update_seqack_wnd(const struct ctx *c, struct tcp_tap_conn *conn,
bool force_seq, struct tcp_info_linux *tinfo);