]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/shared/firewall-util.h
Merge pull request #17549 from yuwata/tiny-fixes
[thirdparty/systemd.git] / src / shared / firewall-util.h
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 #pragma once
3
4 #include <stdbool.h>
5 #include <stdint.h>
6
7 #include "in-addr-util.h"
8
9 #if HAVE_LIBIPTC
10
11 int fw_add_masquerade(
12 bool add,
13 int af,
14 int protocol,
15 const union in_addr_union *source,
16 unsigned source_prefixlen,
17 const char *out_interface,
18 const union in_addr_union *destination,
19 unsigned destination_prefixlen);
20
21 int fw_add_local_dnat(
22 bool add,
23 int af,
24 int protocol,
25 const char *in_interface,
26 const union in_addr_union *source,
27 unsigned source_prefixlen,
28 const union in_addr_union *destination,
29 unsigned destination_prefixlen,
30 uint16_t local_port,
31 const union in_addr_union *remote,
32 uint16_t remote_port,
33 const union in_addr_union *previous_remote);
34
35 #else
36
37 static inline int fw_add_masquerade(
38 bool add,
39 int af,
40 int protocol,
41 const union in_addr_union *source,
42 unsigned source_prefixlen,
43 const char *out_interface,
44 const union in_addr_union *destination,
45 unsigned destination_prefixlen) {
46 return -EOPNOTSUPP;
47 }
48
49 static inline int fw_add_local_dnat(
50 bool add,
51 int af,
52 int protocol,
53 const char *in_interface,
54 const union in_addr_union *source,
55 unsigned source_prefixlen,
56 const union in_addr_union *destination,
57 unsigned destination_prefixlen,
58 uint16_t local_port,
59 const union in_addr_union *remote,
60 uint16_t remote_port,
61 const union in_addr_union *previous_remote) {
62 return -EOPNOTSUPP;
63 }
64
65 #endif