]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/network/networkd-route.h
network: ignore requested ipv6 fdb entry when ipv6 is disabled by sysctl
[thirdparty/systemd.git] / src / network / networkd-route.h
1 /* SPDX-License-Identifier: LGPL-2.1+ */
2 #pragma once
3
4 #include "conf-parser.h"
5
6 typedef struct Route Route;
7 typedef struct NetworkConfigSection NetworkConfigSection;
8
9 #include "networkd-network.h"
10 #include "networkd-util.h"
11
12 struct Route {
13 Network *network;
14 NetworkConfigSection *section;
15
16 Link *link;
17
18 int family;
19 int quickack;
20 int fast_open_no_cookie;
21 int ttl_propagate;
22
23 unsigned char dst_prefixlen;
24 unsigned char src_prefixlen;
25 unsigned char scope;
26 unsigned char protocol; /* RTPROT_* */
27 unsigned char type; /* RTN_* */
28 unsigned char tos;
29 uint32_t priority; /* note that ip(8) calls this 'metric' */
30 uint32_t table;
31 uint32_t mtu;
32 uint32_t initcwnd;
33 uint32_t initrwnd;
34 unsigned char pref;
35 unsigned flags;
36 int gateway_onlink;
37
38 union in_addr_union gw;
39 union in_addr_union dst;
40 union in_addr_union src;
41 union in_addr_union prefsrc;
42
43 usec_t lifetime;
44 sd_event_source *expire;
45
46 LIST_FIELDS(Route, routes);
47 };
48
49 int route_new(Route **ret);
50 void route_free(Route *route);
51 int route_configure(Route *route, Link *link, link_netlink_message_handler_t callback);
52 int route_remove(Route *route, Link *link, link_netlink_message_handler_t callback);
53
54 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);
55 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);
56 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);
57 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);
58 bool route_equal(Route *r1, Route *r2);
59
60 int route_expire_handler(sd_event_source *s, uint64_t usec, void *userdata);
61 int route_section_verify(Route *route, Network *network);
62
63 DEFINE_NETWORK_SECTION_FUNCTIONS(Route, route_free);
64
65 int network_add_ipv4ll_route(Network *network);
66 int network_add_default_route_on_device(Network *network);
67
68 CONFIG_PARSER_PROTOTYPE(config_parse_gateway);
69 CONFIG_PARSER_PROTOTYPE(config_parse_preferred_src);
70 CONFIG_PARSER_PROTOTYPE(config_parse_destination);
71 CONFIG_PARSER_PROTOTYPE(config_parse_route_priority);
72 CONFIG_PARSER_PROTOTYPE(config_parse_route_scope);
73 CONFIG_PARSER_PROTOTYPE(config_parse_route_table);
74 CONFIG_PARSER_PROTOTYPE(config_parse_gateway_onlink);
75 CONFIG_PARSER_PROTOTYPE(config_parse_ipv6_route_preference);
76 CONFIG_PARSER_PROTOTYPE(config_parse_route_protocol);
77 CONFIG_PARSER_PROTOTYPE(config_parse_route_type);
78 CONFIG_PARSER_PROTOTYPE(config_parse_tcp_window);
79 CONFIG_PARSER_PROTOTYPE(config_parse_quickack);
80 CONFIG_PARSER_PROTOTYPE(config_parse_fast_open_no_cookie);
81 CONFIG_PARSER_PROTOTYPE(config_parse_route_ttl_propagate);
82 CONFIG_PARSER_PROTOTYPE(config_parse_route_mtu);