summaryrefslogtreecommitdiffstats
path: root/src/network/networkd-address.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2022-10-03 05:39:56 +0200
committerYu Watanabe <watanabe.yu+github@gmail.com>2022-10-03 17:25:14 +0200
commitd4b7631468e0a28da1366d7f2d6f616b35acce70 (patch)
treed61f54b0ee05398f83da271ace0b6d720dd1a8a8 /src/network/networkd-address.c
parentnetwork: ndisc: ignore prefix option with link-local prefix (diff)
downloadsystemd-d4b7631468e0a28da1366d7f2d6f616b35acce70.tar.xz
systemd-d4b7631468e0a28da1366d7f2d6f616b35acce70.zip
network: introduce {address,route}_remove_and_drop()
Preparation for later commits.
Diffstat (limited to 'src/network/networkd-address.c')
-rw-r--r--src/network/networkd-address.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/network/networkd-address.c b/src/network/networkd-address.c
index bb1eedc6f1..60d3c6286e 100644
--- a/src/network/networkd-address.c
+++ b/src/network/networkd-address.c
@@ -765,6 +765,18 @@ int address_remove(Address *address) {
return 0;
}
+int address_remove_and_drop(Address *address) {
+ if (!address)
+ return 0;
+
+ address_cancel_request(address);
+
+ if (address_exists(address))
+ return address_remove(address);
+
+ return address_drop(address);
+}
+
bool link_address_is_dynamic(const Link *link, const Address *address) {
Route *route;