]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/network/networkd-routing-policy-rule.h
Merge pull request #32664 from DaanDeMeyer/no-build
[thirdparty/systemd.git] / src / network / networkd-routing-policy-rule.h
CommitLineData
db9ecf05 1/* SPDX-License-Identifier: LGPL-2.1-or-later */
bce67bbe
SS
2#pragma once
3
bce67bbe 4#include <inttypes.h>
926062f0 5#include <linux/fib_rules.h>
bce67bbe
SS
6#include <stdbool.h>
7
a2106925 8#include "conf-parser.h"
ca183bf8 9#include "in-addr-util.h"
fcbf4cb7 10#include "networkd-util.h"
bce67bbe 11
bce67bbe 12typedef struct Link Link;
36e6e28b 13typedef struct Manager Manager;
0e5ef6be 14typedef struct Network Network;
bce67bbe 15
ca183bf8 16typedef struct RoutingPolicyRule {
6964cf45 17 Manager *manager;
bce67bbe 18 Network *network;
307fe3cd 19 ConfigSection *section;
eb72fa3a
YW
20 NetworkConfigSource source;
21 NetworkConfigState state;
bce67bbe 22
8b220643 23 bool invert_rule;
c4f7a347 24 bool priority_set;
4be1fc84 25 bool l3mdev; /* FRA_L3MDEV */
8b220643 26
bce67bbe 27 uint8_t tos;
d7d1d18f 28 uint8_t type;
1e5fd321
YW
29 uint8_t ipproto; /* FRA_IP_PROTO */
30 uint8_t protocol; /* FRA_PROTOCOL */
d7d1d18f
SS
31 uint8_t to_prefixlen;
32 uint8_t from_prefixlen;
bce67bbe
SS
33
34 uint32_t table;
35 uint32_t fwmark;
36 uint32_t fwmask;
37 uint32_t priority;
38
f6c6ff97
YW
39 AddressFamily address_family; /* Specified by Family= */
40 int family; /* Automatically determined by From= or To= */
bce67bbe 41
762e2659
SS
42 char *iif;
43 char *oif;
44
bce67bbe
SS
45 union in_addr_union to;
46 union in_addr_union from;
47
926062f0
SS
48 struct fib_rule_port_range sport;
49 struct fib_rule_port_range dport;
ea471a46 50 struct fib_rule_uid_range uid_range;
926062f0 51
53e1ba28 52 int suppress_prefixlen;
af493fb7 53 int32_t suppress_ifgroup;
ca183bf8 54} RoutingPolicyRule;
bce67bbe 55
96515305
YW
56const char *fr_act_type_full_to_string(int t) _const_;
57
b0815fa4 58RoutingPolicyRule *routing_policy_rule_free(RoutingPolicyRule *rule);
50a3682f 59
13ffa39f 60void network_drop_invalid_routing_policy_rules(Network *network);
bce67bbe 61
0e5ef6be 62int link_request_static_routing_policy_rules(Link *link);
c0ec4746 63
51a0dc4a 64int manager_rtnl_process_rule(sd_netlink *rtnl, sd_netlink_message *message, Manager *m);
0b81225e
YW
65int manager_drop_routing_policy_rules_internal(Manager *m, bool foreign, const Link *except);
66static inline int manager_drop_foreign_routing_policy_rules(Manager *m) {
67 return manager_drop_routing_policy_rules_internal(m, true, NULL);
68}
e09b7588 69static inline int link_drop_static_routing_policy_rules(Link *link) {
756f1f5f
YW
70 assert(link);
71 return manager_drop_routing_policy_rules_internal(link->manager, false, link);
0b81225e 72}
b4564f4e 73void link_foreignize_routing_policy_rules(Link *link);
51a0dc4a 74
eb72fa3a
YW
75DEFINE_NETWORK_CONFIG_STATE_FUNCTIONS(RoutingPolicyRule, routing_policy_rule);
76
a2106925
LP
77CONFIG_PARSER_PROTOTYPE(config_parse_routing_policy_rule_tos);
78CONFIG_PARSER_PROTOTYPE(config_parse_routing_policy_rule_table);
79CONFIG_PARSER_PROTOTYPE(config_parse_routing_policy_rule_fwmark_mask);
80CONFIG_PARSER_PROTOTYPE(config_parse_routing_policy_rule_prefix);
81CONFIG_PARSER_PROTOTYPE(config_parse_routing_policy_rule_priority);
82CONFIG_PARSER_PROTOTYPE(config_parse_routing_policy_rule_device);
4be1fc84 83CONFIG_PARSER_PROTOTYPE(config_parse_routing_policy_rule_l3mdev);
926062f0 84CONFIG_PARSER_PROTOTYPE(config_parse_routing_policy_rule_port_range);
97f9df9e 85CONFIG_PARSER_PROTOTYPE(config_parse_routing_policy_rule_ip_protocol);
8b220643 86CONFIG_PARSER_PROTOTYPE(config_parse_routing_policy_rule_invert);
f6c6ff97 87CONFIG_PARSER_PROTOTYPE(config_parse_routing_policy_rule_family);
ea471a46 88CONFIG_PARSER_PROTOTYPE(config_parse_routing_policy_rule_uid_range);
53e1ba28 89CONFIG_PARSER_PROTOTYPE(config_parse_routing_policy_rule_suppress_prefixlen);
af493fb7 90CONFIG_PARSER_PROTOTYPE(config_parse_routing_policy_rule_suppress_ifgroup);
d7d1d18f 91CONFIG_PARSER_PROTOTYPE(config_parse_routing_policy_rule_type);