mirror of
https://github.com/systemd/systemd.git
synced 2025-03-22 06:50:18 +03:00
network: introduce network_verify_addresses()
This commit is contained in:
parent
9a0ad16b26
commit
32400c2ff0
@ -1685,7 +1685,7 @@ bool address_is_ready(const Address *a) {
|
||||
return !(a->flags & IFA_F_TENTATIVE);
|
||||
}
|
||||
|
||||
int address_section_verify(Address *address) {
|
||||
static int address_section_verify(Address *address) {
|
||||
if (section_is_invalid(address->section))
|
||||
return -EINVAL;
|
||||
|
||||
@ -1703,3 +1703,13 @@ int address_section_verify(Address *address) {
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void network_verify_addresses(Network *network) {
|
||||
Address *address, *address_next;
|
||||
|
||||
assert(network);
|
||||
|
||||
LIST_FOREACH_SAFE(addresses, address, address_next, network->static_addresses)
|
||||
if (address_section_verify(address) < 0)
|
||||
address_free(address);
|
||||
}
|
||||
|
@ -68,7 +68,6 @@ int address_configure(Address *address, Link *link, link_netlink_message_handler
|
||||
int address_remove(Address *address, Link *link, link_netlink_message_handler_t callback);
|
||||
bool address_equal(Address *a1, Address *a2);
|
||||
bool address_is_ready(const Address *a);
|
||||
int address_section_verify(Address *a);
|
||||
int configure_ipv4_duplicate_address_detection(Link *link, Address *address);
|
||||
|
||||
int generate_ipv6_eui_64_address(Link *link, struct in6_addr *ret);
|
||||
@ -81,6 +80,8 @@ int link_drop_foreign_addresses(Link *link);
|
||||
|
||||
int manager_rtnl_process_address(sd_netlink *nl, sd_netlink_message *message, Manager *m);
|
||||
|
||||
void network_verify_addresses(Network *network);
|
||||
|
||||
void address_hash_func(const Address *a, struct siphash *state);
|
||||
int address_compare_func(const Address *a1, const Address *a2);
|
||||
extern const struct hash_ops address_hash_ops;
|
||||
|
@ -155,7 +155,6 @@ static int network_resolve_stacked_netdevs(Network *network) {
|
||||
}
|
||||
|
||||
int network_verify(Network *network) {
|
||||
Address *address, *address_next;
|
||||
TrafficControl *tc;
|
||||
SRIOV *sr_iov;
|
||||
|
||||
@ -212,6 +211,8 @@ int network_verify(Network *network) {
|
||||
network->dhcp_server = false;
|
||||
}
|
||||
if (network->n_static_addresses > 0) {
|
||||
Address *address;
|
||||
|
||||
log_warning("%s: Cannot set addresses when Bond= is specified, ignoring addresses.",
|
||||
network->filename);
|
||||
while ((address = network->static_addresses))
|
||||
@ -291,10 +292,7 @@ int network_verify(Network *network) {
|
||||
network->ipv6_proxy_ndp_addresses = set_free_free(network->ipv6_proxy_ndp_addresses);
|
||||
}
|
||||
|
||||
LIST_FOREACH_SAFE(addresses, address, address_next, network->static_addresses)
|
||||
if (address_section_verify(address) < 0)
|
||||
address_free(address);
|
||||
|
||||
network_verify_addresses(network);
|
||||
network_verify_routes(network);
|
||||
network_verify_nexthops(network);
|
||||
network_verify_fdb_entries(network);
|
||||
|
Loading…
x
Reference in New Issue
Block a user