public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
blob bb8e3148a0b30c238c15e9b90b10927d9f81600e 1810 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
 
/* SPDX-License-Identifier: GPL-2.0-or-later
 * Copyright Red Hat
 * Author: David Gibson <david@gibson.dropbear.id.au>
 *
 * Tracking for logical "flows" of packets.
 */
#ifndef FLOW_H
#define FLOW_H

/**
 * struct demiflow - Describes a logical packet flow as seen from one "side"
 * @caddr:		Correspondent address (remote address from passt's PoV)
 * @faddr:		Forwarding address (local address from passt's PoV)
 * @cport:		Correspondent port
 * @fport:		Forwarding port
 */
struct demiflow {
	union inany_addr faddr;
	union inany_addr caddr;
	in_port_t fport, cport;
};

/** demiflow_from_af - Initialize a demiflow from addresses
 * @df:		demiflow to initialize
 * @af:		Address family for @faddr and @caddr
 * @faddr:	Forwarding address (pointer to in_addr or in6_addr)
 * @fport:	Forwarding port
 * @caddr:	Correspondent address (pointer to in_addr or in6_addr)
 * @cport:	Correspondent port
 */
static inline void demiflow_from_af(struct demiflow *df, int af,
				    const void *faddr, in_port_t fport,
				    const void *caddr, in_port_t cport)
{
	inany_from_af(&df->faddr, af, faddr);
	inany_from_af(&df->caddr, af, caddr);
	df->fport = fport;
	df->cport = cport;
}

/**
 * demiflow_eq() - Check if two demiflows are equal
 * @left, @right:	Demiflows to compare
 *
 * Return: true if equal, false otherwise
 */
static inline bool demiflow_eq(const struct demiflow *left,
			       const struct demiflow *right)
{
	return memcmp(left, right, sizeof(struct demiflow)) == 0;
}

/**
 * demiflow_hash() - Calculate hash value for a demiflow
 * @df:		Demiflow
 * @k:		Hash secret (128-bits as array of 2 64-bit words)
 *
 * Return: hash value
 */
static inline unsigned int demiflow_hash(const struct demiflow *df,
					 const uint64_t *k)
{
	return siphash_36b((uint8_t *)df, k);
}

#endif /* FLOW_H */

debug log:

solving bb8e314 ...
found bb8e314 in https://archives.passt.top/passt-dev/20230728094831.4097571-9-david@gibson.dropbear.id.au/
found f7c0981 in https://archives.passt.top/passt-dev/20230728094831.4097571-8-david@gibson.dropbear.id.au/

applying [1/2] https://archives.passt.top/passt-dev/20230728094831.4097571-8-david@gibson.dropbear.id.au/
diff --git a/flow.h b/flow.h
new file mode 100644
index 0000000..f7c0981


applying [2/2] https://archives.passt.top/passt-dev/20230728094831.4097571-9-david@gibson.dropbear.id.au/
diff --git a/flow.h b/flow.h
index f7c0981..bb8e314 100644

Checking patch flow.h...
Applied patch flow.h cleanly.
Checking patch flow.h...
Applied patch flow.h cleanly.

index at:
100644 bb8e3148a0b30c238c15e9b90b10927d9f81600e	flow.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).