1 /* SPDX-License-Identifier: LGPL-2.1-or-later
2 * Copyright © 2019 VMware, Inc.
9 #include "sd-netlink.h"
11 #include "conf-parser.h"
13 #include "in-addr-util.h"
14 #include "networkd-util.h"
16 typedef struct Link Link
;
17 typedef struct Manager Manager
;
18 typedef struct Network Network
;
20 typedef struct NextHop
{
23 ConfigSection
*section
;
24 NetworkConfigSource source
;
25 NetworkConfigState state
;
32 union in_addr_union gw
;
34 int onlink
; /* Only used in conf parser and nexthop_section_verify(). */
38 NextHop
*nexthop_free(NextHop
*nexthop
);
40 int network_drop_invalid_nexthops(Network
*network
);
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);
46 static inline int link_drop_managed_nexthops(Link
*link
) {
47 return link_drop_nexthops(link
, /* foreign = */ false);
49 void link_foreignize_nexthops(Link
*link
);
51 int link_request_static_nexthops(Link
*link
, bool only_ipv4
);
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
);
56 DEFINE_NETWORK_CONFIG_STATE_FUNCTIONS(NextHop
, nexthop
);
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
);