]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/network/networkd-route.h
Merge pull request #8417 from brauner/2018-03-09/add_bind_mount_fallback_to_private_d...
[thirdparty/systemd.git] / src / network / networkd-route.h
CommitLineData
53e1b683 1/* SPDX-License-Identifier: LGPL-2.1+ */
fc2f9534
LP
2#pragma once
3
4/***
5 This file is part of systemd.
6
7 Copyright 2013 Tom Gundersen <teg@jklm.no>
fc2f9534
LP
8***/
9
10typedef struct Route Route;
f4859fc7 11typedef struct NetworkConfigSection NetworkConfigSection;
fc2f9534 12
fc2f9534
LP
13#include "networkd-network.h"
14
15struct Route {
16 Network *network;
f4859fc7 17 NetworkConfigSection *section;
fc2f9534 18
1c8e710c
TG
19 Link *link;
20
fc2f9534 21 int family;
09f5dfad
SS
22 int quickack;
23
fc2f9534
LP
24 unsigned char dst_prefixlen;
25 unsigned char src_prefixlen;
26 unsigned char scope;
fc2f9534 27 unsigned char protocol; /* RTPROT_* */
983226f3 28 unsigned char type; /* RTN_* */
bb7ae737 29 unsigned char tos;
86655331 30 uint32_t priority; /* note that ip(8) calls this 'metric' */
c953b24c 31 uint32_t table;
d6fceaf1 32 uint32_t mtu;
323d9329
SS
33 uint32_t initcwnd;
34 uint32_t initrwnd;
3b015d40
TG
35 unsigned char pref;
36 unsigned flags;
fc2f9534 37
2ce40956
TG
38 union in_addr_union gw;
39 union in_addr_union dst;
40 union in_addr_union src;
41 union in_addr_union prefsrc;
fc2f9534 42
f833694d
TG
43 usec_t lifetime;
44 sd_event_source *expire;
45
fc2f9534
LP
46 LIST_FIELDS(Route, routes);
47};
48
f4859fc7 49int route_new_static(Network *network, const char *filename, unsigned section_line, Route **ret);
ed9e361a 50int route_new(Route **ret);
fc2f9534
LP
51void route_free(Route *route);
52int route_configure(Route *route, Link *link, sd_netlink_message_handler_t callback);
91b5f997 53int route_remove(Route *route, Link *link, sd_netlink_message_handler_t callback);
fc2f9534 54
14d20d2b
SS
55int 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);
56int 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);
57int 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 58void 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 59
f833694d
TG
60int route_expire_handler(sd_event_source *s, uint64_t usec, void *userdata);
61
fc2f9534
LP
62DEFINE_TRIVIAL_CLEANUP_FUNC(Route*, route_free);
63#define _cleanup_route_free_ _cleanup_(route_freep)
64
65int config_parse_gateway(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
0d07e595 66int config_parse_preferred_src(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
fc2f9534
LP
67int config_parse_destination(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
68int config_parse_route_priority(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
69int config_parse_route_scope(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
c953b24c 70int config_parse_route_table(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
28959f7d 71int config_parse_gateway_onlink(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
b5bf6f64 72int config_parse_ipv6_route_preference(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
c83ecc04 73int config_parse_route_protocol(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
983226f3 74int config_parse_route_type(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
323d9329 75int config_parse_tcp_window(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
09f5dfad 76int config_parse_quickack(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);