diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2022-10-03 05:39:56 +0200 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2022-10-03 17:25:14 +0200 |
commit | d4b7631468e0a28da1366d7f2d6f616b35acce70 (patch) | |
tree | d61f54b0ee05398f83da271ace0b6d720dd1a8a8 /src/network/networkd-route.c | |
parent | network: ndisc: ignore prefix option with link-local prefix (diff) | |
download | systemd-d4b7631468e0a28da1366d7f2d6f616b35acce70.tar.xz systemd-d4b7631468e0a28da1366d7f2d6f616b35acce70.zip |
network: introduce {address,route}_remove_and_drop()
Preparation for later commits.
Diffstat (limited to 'src/network/networkd-route.c')
-rw-r--r-- | src/network/networkd-route.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/network/networkd-route.c b/src/network/networkd-route.c index f1fba4ff42..2b17959ca2 100644 --- a/src/network/networkd-route.c +++ b/src/network/networkd-route.c @@ -781,6 +781,21 @@ int route_remove(Route *route) { return 0; } +int route_remove_and_drop(Route *route) { + if (!route) + return 0; + + route_cancel_request(route, NULL); + + if (route_exists(route)) + return route_remove(route); + + if (route->state == 0) + route_free(route); + + return 0; +} + static void manager_mark_routes(Manager *manager, bool foreign, const Link *except) { Route *route; Link *link; |