mirror of
https://github.com/systemd/systemd.git
synced 2025-03-28 02:50:16 +03:00
network: rename link_drop_managed_xyz() -> link_drop_static_xyz()
As networkd does not configure nexthops, neighbors, or routing policy rules dynamically, this only changes link_drop_managed_addresses(). Previously it also removed dynamic addresses, but with this commit, now it only removes static addresses. Note, link_drop_managed_routes() has removed only static routes, so this commit only changes its name. Note. as commented in the code, the dynamic addresses will be removed on lease expiration or stopping client, and link_drop_managed_xyz() are called on reconfiguration or so, and at that time, all dynamic addressing clients are stopped or restarted, so this should not effective behavior change.
This commit is contained in:
parent
a86763c70b
commit
e09b758876
@ -1383,15 +1383,16 @@ int link_drop_foreign_addresses(Link *link) {
|
||||
return r;
|
||||
}
|
||||
|
||||
int link_drop_managed_addresses(Link *link) {
|
||||
int link_drop_static_addresses(Link *link) {
|
||||
Address *address;
|
||||
int r = 0;
|
||||
|
||||
assert(link);
|
||||
|
||||
SET_FOREACH(address, link->addresses) {
|
||||
/* Do not touch addresses managed by kernel or other tools. */
|
||||
if (address->source == NETWORK_CONFIG_SOURCE_FOREIGN)
|
||||
/* Remove only static addresses here. Dynamic addresses will be removed e.g. on lease
|
||||
* expiration or stopping the DHCP client. */
|
||||
if (address->source != NETWORK_CONFIG_SOURCE_STATIC)
|
||||
continue;
|
||||
|
||||
/* Ignore addresses not assigned yet or already removing. */
|
||||
|
@ -103,7 +103,7 @@ bool link_check_addresses_ready(Link *link, NetworkConfigSource source);
|
||||
|
||||
DEFINE_SECTION_CLEANUP_FUNCTIONS(Address, address_unref);
|
||||
|
||||
int link_drop_managed_addresses(Link *link);
|
||||
int link_drop_static_addresses(Link *link);
|
||||
int link_drop_foreign_addresses(Link *link);
|
||||
int link_drop_ipv6ll_addresses(Link *link);
|
||||
void link_foreignize_addresses(Link *link);
|
||||
|
@ -1115,12 +1115,11 @@ static int link_drop_managed_config(Link *link) {
|
||||
assert(link);
|
||||
assert(link->manager);
|
||||
|
||||
r = link_drop_managed_routes(link);
|
||||
|
||||
RET_GATHER(r, link_drop_managed_nexthops(link));
|
||||
RET_GATHER(r, link_drop_managed_addresses(link));
|
||||
RET_GATHER(r, link_drop_managed_neighbors(link));
|
||||
RET_GATHER(r, link_drop_managed_routing_policy_rules(link));
|
||||
r = link_drop_static_routes(link);
|
||||
RET_GATHER(r, link_drop_static_nexthops(link));
|
||||
RET_GATHER(r, link_drop_static_addresses(link));
|
||||
RET_GATHER(r, link_drop_static_neighbors(link));
|
||||
RET_GATHER(r, link_drop_static_routing_policy_rules(link));
|
||||
|
||||
return r;
|
||||
}
|
||||
|
@ -502,7 +502,7 @@ int link_drop_foreign_neighbors(Link *link) {
|
||||
return r;
|
||||
}
|
||||
|
||||
int link_drop_managed_neighbors(Link *link) {
|
||||
int link_drop_static_neighbors(Link *link) {
|
||||
Neighbor *neighbor;
|
||||
int r = 0;
|
||||
|
||||
@ -510,7 +510,7 @@ int link_drop_managed_neighbors(Link *link) {
|
||||
|
||||
SET_FOREACH(neighbor, link->neighbors) {
|
||||
/* Do not touch nexthops managed by kernel or other tools. */
|
||||
if (neighbor->source == NETWORK_CONFIG_SOURCE_FOREIGN)
|
||||
if (neighbor->source != NETWORK_CONFIG_SOURCE_STATIC)
|
||||
continue;
|
||||
|
||||
/* Ignore neighbors not assigned yet or already removing. */
|
||||
|
@ -36,7 +36,7 @@ int neighbor_remove(Neighbor *neighbor, Link *link);
|
||||
|
||||
int network_drop_invalid_neighbors(Network *network);
|
||||
|
||||
int link_drop_managed_neighbors(Link *link);
|
||||
int link_drop_static_neighbors(Link *link);
|
||||
int link_drop_foreign_neighbors(Link *link);
|
||||
void link_foreignize_neighbors(Link *link);
|
||||
|
||||
|
@ -869,7 +869,7 @@ static void link_mark_nexthops(Link *link, bool foreign) {
|
||||
continue;
|
||||
|
||||
/* When 'foreign' is true, mark only foreign nexthops, and vice versa. */
|
||||
if (foreign != (nexthop->source == NETWORK_CONFIG_SOURCE_FOREIGN))
|
||||
if (nexthop->source != (foreign ? NETWORK_CONFIG_SOURCE_FOREIGN : NETWORK_CONFIG_SOURCE_STATIC))
|
||||
continue;
|
||||
|
||||
/* Ignore nexthops not assigned yet or already removed. */
|
||||
|
@ -57,7 +57,7 @@ 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) {
|
||||
static inline int link_drop_static_nexthops(Link *link) {
|
||||
return link_drop_nexthops(link, /* foreign = */ false);
|
||||
}
|
||||
void link_foreignize_nexthops(Link *link);
|
||||
|
@ -98,7 +98,7 @@ int route_remove_and_cancel(Route *route, Manager *manager);
|
||||
int route_get(Manager *manager, const Route *route, Route **ret);
|
||||
|
||||
int link_drop_routes(Link *link, bool foreign);
|
||||
static inline int link_drop_managed_routes(Link *link) {
|
||||
static inline int link_drop_static_routes(Link *link) {
|
||||
return link_drop_routes(link, false);
|
||||
}
|
||||
static inline int link_drop_foreign_routes(Link *link) {
|
||||
|
@ -654,7 +654,7 @@ static void manager_mark_routing_policy_rules(Manager *m, bool foreign, const Li
|
||||
continue;
|
||||
|
||||
/* When 'foreign' is true, mark only foreign rules, and vice versa. */
|
||||
if (foreign != (rule->source == NETWORK_CONFIG_SOURCE_FOREIGN))
|
||||
if (rule->source != (foreign ? NETWORK_CONFIG_SOURCE_FOREIGN : NETWORK_CONFIG_SOURCE_STATIC))
|
||||
continue;
|
||||
|
||||
/* Ignore rules not assigned yet or already removing. */
|
||||
|
@ -66,7 +66,7 @@ int manager_drop_routing_policy_rules_internal(Manager *m, bool foreign, const L
|
||||
static inline int manager_drop_foreign_routing_policy_rules(Manager *m) {
|
||||
return manager_drop_routing_policy_rules_internal(m, true, NULL);
|
||||
}
|
||||
static inline int link_drop_managed_routing_policy_rules(Link *link) {
|
||||
static inline int link_drop_static_routing_policy_rules(Link *link) {
|
||||
assert(link);
|
||||
return manager_drop_routing_policy_rules_internal(link->manager, false, link);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user