]>
Commit | Line | Data |
---|---|---|
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 | 12 | typedef struct Link Link; |
36e6e28b | 13 | typedef struct Manager Manager; |
0e5ef6be | 14 | typedef struct Network Network; |
bce67bbe | 15 | |
ca183bf8 | 16 | typedef 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 |
56 | const char *fr_act_type_full_to_string(int t) _const_; |
57 | ||
b0815fa4 | 58 | RoutingPolicyRule *routing_policy_rule_free(RoutingPolicyRule *rule); |
50a3682f | 59 | |
13ffa39f | 60 | void network_drop_invalid_routing_policy_rules(Network *network); |
bce67bbe | 61 | |
0e5ef6be | 62 | int link_request_static_routing_policy_rules(Link *link); |
c0ec4746 | 63 | |
51a0dc4a | 64 | int manager_rtnl_process_rule(sd_netlink *rtnl, sd_netlink_message *message, Manager *m); |
0b81225e YW |
65 | int manager_drop_routing_policy_rules_internal(Manager *m, bool foreign, const Link *except); |
66 | static inline int manager_drop_foreign_routing_policy_rules(Manager *m) { | |
67 | return manager_drop_routing_policy_rules_internal(m, true, NULL); | |
68 | } | |
e09b7588 | 69 | static 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 | 73 | void link_foreignize_routing_policy_rules(Link *link); |
51a0dc4a | 74 | |
eb72fa3a YW |
75 | DEFINE_NETWORK_CONFIG_STATE_FUNCTIONS(RoutingPolicyRule, routing_policy_rule); |
76 | ||
a2106925 LP |
77 | CONFIG_PARSER_PROTOTYPE(config_parse_routing_policy_rule_tos); |
78 | CONFIG_PARSER_PROTOTYPE(config_parse_routing_policy_rule_table); | |
79 | CONFIG_PARSER_PROTOTYPE(config_parse_routing_policy_rule_fwmark_mask); | |
80 | CONFIG_PARSER_PROTOTYPE(config_parse_routing_policy_rule_prefix); | |
81 | CONFIG_PARSER_PROTOTYPE(config_parse_routing_policy_rule_priority); | |
82 | CONFIG_PARSER_PROTOTYPE(config_parse_routing_policy_rule_device); | |
4be1fc84 | 83 | CONFIG_PARSER_PROTOTYPE(config_parse_routing_policy_rule_l3mdev); |
926062f0 | 84 | CONFIG_PARSER_PROTOTYPE(config_parse_routing_policy_rule_port_range); |
97f9df9e | 85 | CONFIG_PARSER_PROTOTYPE(config_parse_routing_policy_rule_ip_protocol); |
8b220643 | 86 | CONFIG_PARSER_PROTOTYPE(config_parse_routing_policy_rule_invert); |
f6c6ff97 | 87 | CONFIG_PARSER_PROTOTYPE(config_parse_routing_policy_rule_family); |
ea471a46 | 88 | CONFIG_PARSER_PROTOTYPE(config_parse_routing_policy_rule_uid_range); |
53e1ba28 | 89 | CONFIG_PARSER_PROTOTYPE(config_parse_routing_policy_rule_suppress_prefixlen); |
af493fb7 | 90 | CONFIG_PARSER_PROTOTYPE(config_parse_routing_policy_rule_suppress_ifgroup); |
d7d1d18f | 91 | CONFIG_PARSER_PROTOTYPE(config_parse_routing_policy_rule_type); |