]>
Commit | Line | Data |
---|---|---|
53e1b683 | 1 | /* SPDX-License-Identifier: LGPL-2.1+ */ |
fc2f9534 LP |
2 | #pragma once |
3 | ||
a2106925 LP |
4 | #include "conf-parser.h" |
5 | ||
fc2f9534 | 6 | typedef struct Route Route; |
f4859fc7 | 7 | typedef struct NetworkConfigSection NetworkConfigSection; |
fc2f9534 | 8 | |
fc2f9534 LP |
9 | #include "networkd-network.h" |
10 | ||
11 | struct Route { | |
12 | Network *network; | |
f4859fc7 | 13 | NetworkConfigSection *section; |
fc2f9534 | 14 | |
1c8e710c TG |
15 | Link *link; |
16 | ||
fc2f9534 | 17 | int family; |
09f5dfad SS |
18 | int quickack; |
19 | ||
fc2f9534 LP |
20 | unsigned char dst_prefixlen; |
21 | unsigned char src_prefixlen; | |
22 | unsigned char scope; | |
fc2f9534 | 23 | unsigned char protocol; /* RTPROT_* */ |
983226f3 | 24 | unsigned char type; /* RTN_* */ |
bb7ae737 | 25 | unsigned char tos; |
86655331 | 26 | uint32_t priority; /* note that ip(8) calls this 'metric' */ |
c953b24c | 27 | uint32_t table; |
d6fceaf1 | 28 | uint32_t mtu; |
323d9329 SS |
29 | uint32_t initcwnd; |
30 | uint32_t initrwnd; | |
3b015d40 TG |
31 | unsigned char pref; |
32 | unsigned flags; | |
fc2f9534 | 33 | |
2ce40956 TG |
34 | union in_addr_union gw; |
35 | union in_addr_union dst; | |
36 | union in_addr_union src; | |
37 | union in_addr_union prefsrc; | |
fc2f9534 | 38 | |
f833694d TG |
39 | usec_t lifetime; |
40 | sd_event_source *expire; | |
41 | ||
fc2f9534 LP |
42 | LIST_FIELDS(Route, routes); |
43 | }; | |
44 | ||
f4859fc7 | 45 | int route_new_static(Network *network, const char *filename, unsigned section_line, Route **ret); |
ed9e361a | 46 | int route_new(Route **ret); |
fc2f9534 LP |
47 | void route_free(Route *route); |
48 | int route_configure(Route *route, Link *link, sd_netlink_message_handler_t callback); | |
91b5f997 | 49 | int route_remove(Route *route, Link *link, sd_netlink_message_handler_t callback); |
fc2f9534 | 50 | |
14d20d2b SS |
51 | int route_get(Link *link, int family, const union in_addr_union *dst, unsigned char dst_prefixlen, unsigned char tos, uint32_t priority, uint32_t table, Route **ret); |
52 | int route_add(Link *link, int family, const union in_addr_union *dst, unsigned char dst_prefixlen, unsigned char tos, uint32_t priority, uint32_t table, Route **ret); | |
53 | int route_add_foreign(Link *link, int family, const union in_addr_union *dst, unsigned char dst_prefixlen, unsigned char tos, uint32_t priority, uint32_t table, Route **ret); | |
bbd15900 | 54 | void route_update(Route *route, const union in_addr_union *src, unsigned char src_prefixlen, const union in_addr_union *gw, const union in_addr_union *prefsrc, unsigned char scope, unsigned char protocol, unsigned char type); |
1c8e710c | 55 | |
f833694d TG |
56 | int route_expire_handler(sd_event_source *s, uint64_t usec, void *userdata); |
57 | ||
fc2f9534 | 58 | DEFINE_TRIVIAL_CLEANUP_FUNC(Route*, route_free); |
fc2f9534 | 59 | |
a2106925 LP |
60 | CONFIG_PARSER_PROTOTYPE(config_parse_gateway); |
61 | CONFIG_PARSER_PROTOTYPE(config_parse_preferred_src); | |
62 | CONFIG_PARSER_PROTOTYPE(config_parse_destination); | |
63 | CONFIG_PARSER_PROTOTYPE(config_parse_route_priority); | |
64 | CONFIG_PARSER_PROTOTYPE(config_parse_route_scope); | |
65 | CONFIG_PARSER_PROTOTYPE(config_parse_route_table); | |
66 | CONFIG_PARSER_PROTOTYPE(config_parse_gateway_onlink); | |
67 | CONFIG_PARSER_PROTOTYPE(config_parse_ipv6_route_preference); | |
68 | CONFIG_PARSER_PROTOTYPE(config_parse_route_protocol); | |
69 | CONFIG_PARSER_PROTOTYPE(config_parse_route_type); | |
70 | CONFIG_PARSER_PROTOTYPE(config_parse_tcp_window); | |
71 | CONFIG_PARSER_PROTOTYPE(config_parse_quickack); | |
cea79e66 | 72 | CONFIG_PARSER_PROTOTYPE(config_parse_route_mtu); |