mirror of
https://github.com/systemd/systemd-stable.git
synced 2024-12-27 03:21:32 +03:00
network: introduce {address,route}_remove_and_drop()
Preparation for later commits.
This commit is contained in:
parent
a115c60e0d
commit
d4b7631468
@ -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;
|
||||
|
||||
|
@ -78,6 +78,7 @@ Address* address_free(Address *address);
|
||||
int address_get(Link *link, const Address *in, Address **ret);
|
||||
int address_configure_handler_internal(sd_netlink *rtnl, sd_netlink_message *m, Link *link, const char *error_msg);
|
||||
int address_remove(Address *address);
|
||||
int address_remove_and_drop(Address *address);
|
||||
int address_dup(const Address *src, Address **ret);
|
||||
bool address_is_ready(const Address *a);
|
||||
void address_set_broadcast(Address *a, Link *link);
|
||||
|
@ -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;
|
||||
|
@ -85,6 +85,7 @@ int route_dup(const Route *src, Route **ret);
|
||||
|
||||
int route_configure_handler_internal(sd_netlink *rtnl, sd_netlink_message *m, Link *link, const char *error_msg);
|
||||
int route_remove(Route *route);
|
||||
int route_remove_and_drop(Route *route);
|
||||
|
||||
int route_get(Manager *manager, Link *link, const Route *in, Route **ret);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user