]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/network/networkd-route.h
Merge pull request #10407 from yuwata/netlink-slot
[thirdparty/systemd.git] / src / network / networkd-route.h
CommitLineData
53e1b683 1/* SPDX-License-Identifier: LGPL-2.1+ */
fc2f9534
LP
2#pragma once
3
a2106925
LP
4#include "conf-parser.h"
5
fc2f9534 6typedef struct Route Route;
f4859fc7 7typedef struct NetworkConfigSection NetworkConfigSection;
fc2f9534 8
fc2f9534
LP
9#include "networkd-network.h"
10
11struct 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 45int route_new_static(Network *network, const char *filename, unsigned section_line, Route **ret);
ed9e361a 46int route_new(Route **ret);
fc2f9534
LP
47void route_free(Route *route);
48int route_configure(Route *route, Link *link, sd_netlink_message_handler_t callback);
91b5f997 49int route_remove(Route *route, Link *link, sd_netlink_message_handler_t callback);
fc2f9534 50
14d20d2b
SS
51int 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);
52int 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);
53int 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 54void 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
56int route_expire_handler(sd_event_source *s, uint64_t usec, void *userdata);
57
fc2f9534 58DEFINE_TRIVIAL_CLEANUP_FUNC(Route*, route_free);
fc2f9534 59
a2106925
LP
60CONFIG_PARSER_PROTOTYPE(config_parse_gateway);
61CONFIG_PARSER_PROTOTYPE(config_parse_preferred_src);
62CONFIG_PARSER_PROTOTYPE(config_parse_destination);
63CONFIG_PARSER_PROTOTYPE(config_parse_route_priority);
64CONFIG_PARSER_PROTOTYPE(config_parse_route_scope);
65CONFIG_PARSER_PROTOTYPE(config_parse_route_table);
66CONFIG_PARSER_PROTOTYPE(config_parse_gateway_onlink);
67CONFIG_PARSER_PROTOTYPE(config_parse_ipv6_route_preference);
68CONFIG_PARSER_PROTOTYPE(config_parse_route_protocol);
69CONFIG_PARSER_PROTOTYPE(config_parse_route_type);
70CONFIG_PARSER_PROTOTYPE(config_parse_tcp_window);
71CONFIG_PARSER_PROTOTYPE(config_parse_quickack);
cea79e66 72CONFIG_PARSER_PROTOTYPE(config_parse_route_mtu);