diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2023-12-12 19:43:27 +0100 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2023-12-14 10:58:26 +0100 |
commit | 352eba2e49453a1b784ffbdb9509ba3f8a945b59 (patch) | |
tree | 6fb283e2831e4c28818e2bf29ab74caa07ba278b /src/network/networkd-nexthop.h | |
parent | network/nexthop: rename manager_get_nexthop_by_id() -> nexthop_get_by_id() (diff) | |
download | systemd-352eba2e49453a1b784ffbdb9509ba3f8a945b59.tar.xz systemd-352eba2e49453a1b784ffbdb9509ba3f8a945b59.zip |
network/nexthop: manage all nexthops by manager
The kernel manages nexthops by their IDs. Previously networkd manages
nexthops in three ways:
- by the corresponding link, if a nexthop has ifindex,
- by the manager, if a nexthop does not have ifindex,
- by the manager with their IDs.
This unifies the three managements of nexthops into one, and use the
same way as the kernel uses.
This is the one for nexthop already done by
aa9626ee3b96e0d2a9a816b5efd38fd7dc829def for neighbor.
Diffstat (limited to 'src/network/networkd-nexthop.h')
-rw-r--r-- | src/network/networkd-nexthop.h | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/network/networkd-nexthop.h b/src/network/networkd-nexthop.h index 6e5643015b..c1d39e6e8e 100644 --- a/src/network/networkd-nexthop.h +++ b/src/network/networkd-nexthop.h @@ -20,13 +20,12 @@ typedef struct Network Network; typedef struct NextHop { Network *network; Manager *manager; - Link *link; ConfigSection *section; NetworkConfigSource source; NetworkConfigState state; uint8_t protocol; - + int ifindex; uint32_t id; bool blackhole; int family; @@ -40,8 +39,13 @@ NextHop *nexthop_free(NextHop *nexthop); void network_drop_invalid_nexthops(Network *network); -int link_drop_managed_nexthops(Link *link); -int link_drop_foreign_nexthops(Link *link); +int link_drop_nexthops(Link *link, bool foreign); +static inline int link_drop_foreign_nexthops(Link *link) { + return link_drop_nexthops(link, /* foreign = */ true); +} +static inline int link_drop_managed_nexthops(Link *link) { + return link_drop_nexthops(link, /* foreign = */ false); +} void link_foreignize_nexthops(Link *link); int link_request_static_nexthops(Link *link, bool only_ipv4); |