]>
Commit | Line | Data |
---|---|---|
db9ecf05 | 1 | /* SPDX-License-Identifier: LGPL-2.1-or-later |
c16c7808 SS |
2 | * Copyright © 2019 VMware, Inc. |
3 | */ | |
4 | ||
5 | #pragma once | |
6 | ||
75156ccb | 7 | #include <inttypes.h> |
c16c7808 | 8 | |
75156ccb | 9 | #include "sd-netlink.h" |
c16c7808 | 10 | |
75156ccb | 11 | #include "conf-parser.h" |
228c3e21 | 12 | #include "hashmap.h" |
75156ccb | 13 | #include "in-addr-util.h" |
c16c7808 SS |
14 | #include "networkd-util.h" |
15 | ||
75156ccb YW |
16 | typedef struct Link Link; |
17 | typedef struct Manager Manager; | |
18 | typedef struct Network Network; | |
76c5a0f2 | 19 | typedef struct Request Request; |
75156ccb YW |
20 | |
21 | typedef struct NextHop { | |
c16c7808 | 22 | Network *network; |
30f10837 | 23 | Manager *manager; |
c16c7808 | 24 | Link *link; |
307fe3cd | 25 | ConfigSection *section; |
89fa0133 YW |
26 | NetworkConfigSource source; |
27 | NetworkConfigState state; | |
c16c7808 | 28 | |
0e9d129c | 29 | uint8_t protocol; |
c16c7808 | 30 | |
c16c7808 | 31 | uint32_t id; |
30f10837 | 32 | bool blackhole; |
8c112218 | 33 | int family; |
c16c7808 | 34 | union in_addr_union gw; |
17f8d8f9 YW |
35 | uint8_t flags; |
36 | int onlink; /* Only used in conf parser and nexthop_section_verify(). */ | |
228c3e21 | 37 | Hashmap *group; |
75156ccb | 38 | } NextHop; |
c16c7808 | 39 | |
75156ccb | 40 | NextHop *nexthop_free(NextHop *nexthop); |
0992f9fb | 41 | |
5f331591 YW |
42 | void nexthop_hash_func(const NextHop *nexthop, struct siphash *state); |
43 | int nexthop_compare_func(const NextHop *a, const NextHop *b); | |
44 | ||
13ffa39f | 45 | void network_drop_invalid_nexthops(Network *network); |
c16c7808 | 46 | |
25b82b6e YW |
47 | int link_drop_nexthops(Link *link); |
48 | int link_drop_foreign_nexthops(Link *link); | |
b4564f4e | 49 | void link_foreignize_nexthops(Link *link); |
c133770a | 50 | |
76c5a0f2 YW |
51 | int link_request_static_nexthops(Link *link, bool only_ipv4); |
52 | int request_process_nexthop(Request *req); | |
53 | ||
324e3422 | 54 | int manager_get_nexthop_by_id(Manager *manager, uint32_t id, NextHop **ret); |
454c87b5 YW |
55 | int manager_rtnl_process_nexthop(sd_netlink *rtnl, sd_netlink_message *message, Manager *m); |
56 | ||
89fa0133 YW |
57 | DEFINE_NETWORK_CONFIG_STATE_FUNCTIONS(NextHop, nexthop); |
58 | ||
c16c7808 SS |
59 | CONFIG_PARSER_PROTOTYPE(config_parse_nexthop_id); |
60 | CONFIG_PARSER_PROTOTYPE(config_parse_nexthop_gateway); | |
f1923efc | 61 | CONFIG_PARSER_PROTOTYPE(config_parse_nexthop_family); |
2ddd52d1 | 62 | CONFIG_PARSER_PROTOTYPE(config_parse_nexthop_onlink); |
30f10837 | 63 | CONFIG_PARSER_PROTOTYPE(config_parse_nexthop_blackhole); |
228c3e21 | 64 | CONFIG_PARSER_PROTOTYPE(config_parse_nexthop_group); |