public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
blob 6155c7c23afb78d6ff2dd7a9243bce7005c3d82c 2307 bytes (raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
 
/* SPDX-License-Identifier: GPL-2.0-or-later
 * Copyright (c) 2021 Red Hat GmbH
 * Author: Stefano Brivio <sbrivio@redhat.com>
 */

#ifndef TCP_INTERNAL_H
#define TCP_INTERNAL_H

#define MAX_WS				8
#define MAX_WINDOW			(1 << (16 + (MAX_WS)))

#define SEQ_LE(a, b)			((b) - (a) < MAX_WINDOW)
#define SEQ_LT(a, b)			((b) - (a) - 1 < MAX_WINDOW)
#define SEQ_GE(a, b)			((a) - (b) < MAX_WINDOW)
#define SEQ_GT(a, b)			((a) - (b) - 1 < MAX_WINDOW)

#define FIN		(1 << 0)
#define SYN		(1 << 1)
#define RST		(1 << 2)
#define ACK		(1 << 4)

/* Flags for internal usage */
#define DUP_ACK		(1 << 5)
#define OPT_EOL		0
#define OPT_NOP		1
#define OPT_MSS		2
#define OPT_MSS_LEN	4
#define OPT_WS		3
#define OPT_WS_LEN	3
#define OPT_SACKP	4
#define OPT_SACK	5
#define OPT_TS		8

#define CONN_V4(conn)		(!!inany_v4(&(conn)->faddr))
#define CONN_V6(conn)		(!CONN_V4(conn))

extern char tcp_buf_discard [MAX_WINDOW];

void conn_flag_do(const struct ctx *c, struct tcp_tap_conn *conn,
		  unsigned long flag);
#define conn_flag(c, conn, flag)					\
	do {								\
		flow_trace(conn, "flag at %s:%i", __func__, __LINE__);	\
		conn_flag_do(c, conn, flag);				\
	} while (0)


void conn_event_do(const struct ctx *c, struct tcp_tap_conn *conn,
		   unsigned long event);
#define conn_event(c, conn, event)					\
	do {								\
		flow_trace(conn, "event at %s:%i", __func__, __LINE__);	\
		conn_event_do(c, conn, event);				\
	} while (0)

void tcp_rst_do(struct ctx *c, struct tcp_tap_conn *conn);
#define tcp_rst(c, conn)						\
	do {								\
		flow_dbg((conn), "TCP reset at %s:%i", __func__, __LINE__); \
		tcp_rst_do(c, conn);					\
	} while (0)

size_t tcp_fill_headers4(const struct ctx *c,
				const struct tcp_tap_conn *conn,
				struct tap_hdr *taph,
				struct iphdr *iph, struct tcphdr *th,
				size_t dlen, const uint16_t *check,
				uint32_t seq);
size_t tcp_fill_headers6(const struct ctx *c,
			 const struct tcp_tap_conn *conn,
			 struct tap_hdr *taph,
			 struct ipv6hdr *ip6h, struct tcphdr *th,
			 size_t dlen, uint32_t seq);
int tcp_update_seqack_wnd(const struct ctx *c, struct tcp_tap_conn *conn,
			  int force_seq, struct tcp_info *tinfo);
int tcp_fill_flag_header(struct ctx *c, struct tcp_tap_conn *conn, int flags,
			 struct tcphdr *th, char *data, size_t *optlen);

#endif /* TCP_INTERNAL_H */

debug log:

solving 6155c7c23afb ...
found 6155c7c23afb in https://archives.passt.top/passt-dev/20240529101909.1120078-5-lvivier@redhat.com/ ||
	https://archives.passt.top/passt-dev/20240528173152.1074623-5-lvivier@redhat.com/ ||
	https://archives.passt.top/passt-dev/20240527091030.772228-5-lvivier@redhat.com/

applying [1/1] https://archives.passt.top/passt-dev/20240529101909.1120078-5-lvivier@redhat.com/
diff --git a/tcp_internal.h b/tcp_internal.h
new file mode 100644
index 000000000000..6155c7c23afb

Checking patch tcp_internal.h...
Applied patch tcp_internal.h cleanly.

skipping https://archives.passt.top/passt-dev/20240528173152.1074623-5-lvivier@redhat.com/ for 6155c7c23afb
skipping https://archives.passt.top/passt-dev/20240527091030.772228-5-lvivier@redhat.com/ for 6155c7c23afb
index at:
100644 6155c7c23afb78d6ff2dd7a9243bce7005c3d82c	tcp_internal.h

Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).