| 1 |
/* SPDX-License-Identifier: LGPL-2.1-or-later */ |
| 2 |
#pragma once |
| 3 |
|
| 4 |
#include "in-addr-util.h" |
| 5 |
#include "networkd-forward.h" |
| 6 |
|
| 7 |
typedef struct RouteNextHop { |
| 8 |
int family; /* used in RTA_VIA (IPv4 only) */ |
| 9 |
union in_addr_union gw; /* RTA_GATEWAY or RTA_VIA (IPv4 only) */ |
| 10 |
uint32_t weight; /* rtnh_hops */ |
| 11 |
int ifindex; /* RTA_OIF(u32) or rtnh_ifindex */ |
| 12 |
char *ifname; /* only used by Route object owned by Network object */ |
| 13 |
/* unsupported attributes: RTA_FLOW (IPv4 only), RTA_ENCAP_TYPE, RTA_ENCAP. */ |
| 14 |
} RouteNextHop; |
| 15 |
|
| 16 |
#define ROUTE_NEXTHOP_NULL ((const RouteNextHop) {}) |
| 17 |
|
| 18 |
void route_detach_from_nexthop(Route *route); |
| 19 |
void route_attach_to_nexthop(Route *route); |
| 20 |
|
| 21 |
RouteNextHop* route_nexthop_free(RouteNextHop *nh); |
| 22 |
DEFINE_TRIVIAL_CLEANUP_FUNC(RouteNextHop*, route_nexthop_free); |
| 23 |
|
| 24 |
void route_nexthops_done(Route *route); |
| 25 |
|
| 26 |
void route_nexthops_hash_func(const Route *route, struct siphash *state); |
| 27 |
int route_nexthops_compare_func(const Route *a, const Route *b); |
| 28 |
|
| 29 |
int route_nexthops_copy(const Route *src, const RouteNextHop *nh, Route *dest); |
| 30 |
bool route_nexthops_needs_adjust(const Route *route); |
| 31 |
int route_adjust_nexthops(Route *route, Link *link); |
| 32 |
|
| 33 |
int route_nexthop_get_link(Manager *manager, const RouteNextHop *nh, Link **ret); |
| 34 |
int route_nexthops_is_ready_to_configure(const Route *route, Manager *manager); |
| 35 |
|
| 36 |
int route_nexthops_to_string(const Route *route, char **ret); |
| 37 |
|
| 38 |
int route_nexthops_set_netlink_message(const Route *route, sd_netlink_message *message); |
| 39 |
int route_nexthops_read_netlink_message(Route *route, sd_netlink_message *message); |
| 40 |
|
| 41 |
int route_section_verify_nexthops(Route *route); |
| 42 |
|
| 43 |
CONFIG_PARSER_PROTOTYPE(config_parse_gateway); |
| 44 |
CONFIG_PARSER_PROTOTYPE(config_parse_route_nexthop); |
| 45 |
CONFIG_PARSER_PROTOTYPE(config_parse_multipath_route); |