]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/network/networkd-route.h
Merge pull request #17185 from yuwata/ethtool-update
[thirdparty/systemd.git] / src / network / networkd-route.h
CommitLineData
53e1b683 1/* SPDX-License-Identifier: LGPL-2.1+ */
fc2f9534
LP
2#pragma once
3
e2263711
YW
4#include <inttypes.h>
5#include <stdbool.h>
6#include <stdio.h>
a2106925 7
e2263711 8#include "sd-netlink.h"
fc2f9534 9
e2263711
YW
10#include "conf-parser.h"
11#include "in-addr-util.h"
12#include "networkd-link.h"
fcbf4cb7 13#include "networkd-util.h"
fc2f9534 14
e2263711
YW
15typedef struct Manager Manager;
16typedef struct Network Network;
17
e2263711 18typedef struct Route {
fc2f9534 19 Network *network;
f4859fc7 20 NetworkConfigSection *section;
fc2f9534 21
1c8e710c 22 Link *link;
ad208fac 23 Manager *manager;
1c8e710c 24
fc2f9534 25 int family;
6dd53981 26 int gw_family;
f9bb3338 27 uint32_t gw_weight;
09f5dfad 28 int quickack;
633c7258 29 int fast_open_no_cookie;
9b88f20a 30 int ttl_propagate;
09f5dfad 31
fc2f9534
LP
32 unsigned char dst_prefixlen;
33 unsigned char src_prefixlen;
34 unsigned char scope;
fc2f9534 35 unsigned char protocol; /* RTPROT_* */
983226f3 36 unsigned char type; /* RTN_* */
bb7ae737 37 unsigned char tos;
86655331 38 uint32_t priority; /* note that ip(8) calls this 'metric' */
c953b24c 39 uint32_t table;
d6fceaf1 40 uint32_t mtu;
323d9329
SS
41 uint32_t initcwnd;
42 uint32_t initrwnd;
3b015d40
TG
43 unsigned char pref;
44 unsigned flags;
54901fd2 45 int gateway_onlink;
c27abcf4
YW
46
47 bool scope_set:1;
48 bool table_set:1;
49 bool priority_set:1;
50 bool protocol_set:1;
51 bool pref_set:1;
52 bool gateway_from_dhcp_or_ra:1;
fc2f9534 53
2ce40956
TG
54 union in_addr_union gw;
55 union in_addr_union dst;
56 union in_addr_union src;
57 union in_addr_union prefsrc;
6ff5cc6b 58 OrderedSet *multipath_routes;
fc2f9534 59
f833694d
TG
60 usec_t lifetime;
61 sd_event_source *expire;
e2263711 62} Route;
fc2f9534 63
501b09db
YW
64void route_hash_func(const Route *route, struct siphash *state);
65int route_compare_func(const Route *a, const Route *b);
c077a205 66extern const struct hash_ops route_hash_ops;
01aaa3df 67
ed9e361a 68int route_new(Route **ret);
169948e9 69Route *route_free(Route *route);
74154c2e
YW
70DEFINE_NETWORK_SECTION_FUNCTIONS(Route, route_free);
71
423c249c
YW
72int route_configure(const Route *route, Link *link, link_netlink_message_handler_t callback, Route **ret);
73int route_remove(const Route *route, Manager *manager, Link *link, link_netlink_message_handler_t callback);
fc2f9534 74
141318f7 75int link_set_routes(Link *link);
62f0ea5f 76int link_drop_routes(Link *link);
779804dd 77int link_drop_foreign_routes(Link *link);
423c249c 78int link_serialize_routes(const Link *link, FILE *f);
731ff05b 79int link_deserialize_routes(Link *link, const char *routes);
141318f7 80
423c249c
YW
81uint32_t link_get_dhcp_route_table(const Link *link);
82uint32_t link_get_ipv6_accept_ra_route_table(const Link *link);
ac49887e 83
4468f01b
YW
84int manager_rtnl_process_route(sd_netlink *rtnl, sd_netlink_message *message, Manager *m);
85
fa7cd711 86int network_add_ipv4ll_route(Network *network);
5d5003ab 87int network_add_default_route_on_device(Network *network);
13ffa39f 88void network_drop_invalid_routes(Network *network);
fa7cd711 89
a2106925
LP
90CONFIG_PARSER_PROTOTYPE(config_parse_gateway);
91CONFIG_PARSER_PROTOTYPE(config_parse_preferred_src);
92CONFIG_PARSER_PROTOTYPE(config_parse_destination);
93CONFIG_PARSER_PROTOTYPE(config_parse_route_priority);
94CONFIG_PARSER_PROTOTYPE(config_parse_route_scope);
95CONFIG_PARSER_PROTOTYPE(config_parse_route_table);
d96edb2c 96CONFIG_PARSER_PROTOTYPE(config_parse_route_boolean);
a2106925
LP
97CONFIG_PARSER_PROTOTYPE(config_parse_ipv6_route_preference);
98CONFIG_PARSER_PROTOTYPE(config_parse_route_protocol);
99CONFIG_PARSER_PROTOTYPE(config_parse_route_type);
100CONFIG_PARSER_PROTOTYPE(config_parse_tcp_window);
cea79e66 101CONFIG_PARSER_PROTOTYPE(config_parse_route_mtu);
6ff5cc6b 102CONFIG_PARSER_PROTOTYPE(config_parse_multipath_route);