]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/network/networkd-nexthop.h
network/nexthop: drop conflicting [NextHop] sections
[thirdparty/systemd.git] / src / network / networkd-nexthop.h
1 /* SPDX-License-Identifier: LGPL-2.1-or-later
2 * Copyright © 2019 VMware, Inc.
3 */
4
5 #pragma once
6
7 #include <inttypes.h>
8
9 #include "sd-netlink.h"
10
11 #include "conf-parser.h"
12 #include "hashmap.h"
13 #include "in-addr-util.h"
14 #include "networkd-util.h"
15
16 typedef struct Link Link;
17 typedef struct Manager Manager;
18 typedef struct Network Network;
19
20 typedef struct NextHop {
21 Network *network;
22 Manager *manager;
23 ConfigSection *section;
24 NetworkConfigSource source;
25 NetworkConfigState state;
26
27 uint8_t protocol;
28 int ifindex;
29 uint32_t id;
30 bool blackhole;
31 int family;
32 union in_addr_union gw;
33 uint8_t flags;
34 int onlink; /* Only used in conf parser and nexthop_section_verify(). */
35 Hashmap *group;
36 } NextHop;
37
38 NextHop *nexthop_free(NextHop *nexthop);
39
40 int network_drop_invalid_nexthops(Network *network);
41
42 int link_drop_nexthops(Link *link, bool foreign);
43 static inline int link_drop_foreign_nexthops(Link *link) {
44 return link_drop_nexthops(link, /* foreign = */ true);
45 }
46 static inline int link_drop_managed_nexthops(Link *link) {
47 return link_drop_nexthops(link, /* foreign = */ false);
48 }
49 void link_foreignize_nexthops(Link *link);
50
51 int link_request_static_nexthops(Link *link, bool only_ipv4);
52
53 int nexthop_get_by_id(Manager *manager, uint32_t id, NextHop **ret);
54 int manager_rtnl_process_nexthop(sd_netlink *rtnl, sd_netlink_message *message, Manager *m);
55
56 DEFINE_NETWORK_CONFIG_STATE_FUNCTIONS(NextHop, nexthop);
57
58 CONFIG_PARSER_PROTOTYPE(config_parse_nexthop_id);
59 CONFIG_PARSER_PROTOTYPE(config_parse_nexthop_gateway);
60 CONFIG_PARSER_PROTOTYPE(config_parse_nexthop_family);
61 CONFIG_PARSER_PROTOTYPE(config_parse_nexthop_onlink);
62 CONFIG_PARSER_PROTOTYPE(config_parse_nexthop_blackhole);
63 CONFIG_PARSER_PROTOTYPE(config_parse_nexthop_group);