public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
f852be390c9ed12d0798486fc7f7bfe02ae4077c blob 1683 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
 
/* SPDX-License-Identifier: GPL-2.0-or-later
 * Copyright Red Hat
 * Author: Stefano Brivio <sbrivio@redhat.com>
 * Author: David Gibson <david@gibson.dropbear.id.au>
 *
 * Forwarding rule definitions shared between passt/pasta and pesto
 */

#ifndef FWD_RULE_H
#define FWD_RULE_H

#include <stdint.h>
#include <net/if.h>
#include <netinet/in.h>

#include "ip.h"
#include "inany.h"
#include "bitmap.h"

/**
 * struct fwd_rule - Forwarding rule governing a range of ports
 * @addr:	Address to forward from
 * @ifname:	Interface to forward from
 * @first:	First port number to forward
 * @last:	Last port number to forward
 * @to:		Target port for @first, port n goes to @to + (n - @first)
 * @proto:	Protocol to forward
 * @flags:	Flag mask
 * 	FWD_DUAL_STACK_ANY - match any IPv4 or IPv6 address (@addr should be ::)
 *	FWD_WEAK - Don't give an error if binds fail for some forwards
 *	FWD_SCAN - Only forward if the matching port in the target is listening
 */
struct fwd_rule {
	union inany_addr addr;
	char ifname[IFNAMSIZ];
	in_port_t first;
	in_port_t last;
	in_port_t to;
	uint8_t proto;
#define FWD_DUAL_STACK_ANY	BIT(0)
#define FWD_WEAK		BIT(1)
#define FWD_SCAN		BIT(2)
	uint8_t flags;
};

#define FWD_RULE_STRLEN					    \
	(IPPROTO_STRLEN - 1				    \
	 + INANY_ADDRSTRLEN - 1				    \
	 + IFNAMSIZ - 1					    \
	 + 4 * (UINT16_STRLEN - 1)			    \
	 + sizeof(" []%:-  =>  - (best effort) (auto-scan)"))

const union inany_addr *fwd_rule_addr(const struct fwd_rule *rule);
void fwd_rules_info(const struct fwd_rule *rules, size_t count);
void fwd_rule_conflict_check(const struct fwd_rule *new,
			     const struct fwd_rule *rules, size_t count);

#endif /* FWD_RULE_H */
debug log:

solving f852be39 ...
found f852be39 in https://archives.passt.top/passt-dev/20260407031630.2457081-11-david@gibson.dropbear.id.au/
found e92efb6d in https://archives.passt.top/passt-dev/20260407031630.2457081-8-david@gibson.dropbear.id.au/
found ae0e1d61 in https://passt.top/passt
preparing index
index prepared:
100644 ae0e1d611758780f5d71a2003038ff05cec7989d	fwd_rule.h

applying [1/2] https://archives.passt.top/passt-dev/20260407031630.2457081-8-david@gibson.dropbear.id.au/
diff --git a/fwd_rule.h b/fwd_rule.h
index ae0e1d61..e92efb6d 100644


applying [2/2] https://archives.passt.top/passt-dev/20260407031630.2457081-11-david@gibson.dropbear.id.au/
diff --git a/fwd_rule.h b/fwd_rule.h
index e92efb6d..f852be39 100644

Checking patch fwd_rule.h...
Applied patch fwd_rule.h cleanly.
Checking patch fwd_rule.h...
Applied patch fwd_rule.h cleanly.

index at:
100644 f852be390c9ed12d0798486fc7f7bfe02ae4077c	fwd_rule.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).