]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: call network_adjust_dhcp_server() from network_drop_invalid_addresses()
authorYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 7 Sep 2023 20:34:32 +0000 (05:34 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 8 Sep 2023 11:03:40 +0000 (20:03 +0900)
We need to find a suitable static address for the DHCP server.
So, all static addresses must be verified before network_adjust_dhcp_server()
is called. For safety, let's call it from network_drop_invalid_addresses().

No functional change, just refactoring and preparation for later
commits.

src/network/networkd-address.c
src/network/networkd-dhcp-server.c
src/network/networkd-network.c

index 048f288df88111641d4ce392c0f50b525628de55..990d24e9b1c751f0327c0c59f4d555982843e3a6 100644 (file)
@@ -2444,6 +2444,8 @@ int network_drop_invalid_addresses(Network *network) {
                 assert(r > 0);
         }
 
+        network_adjust_dhcp_server(network);
+
         return 0;
 }
 
index c1d9fbc17cf05301eac1c71cde1beb611fd0d761..3663a506f6a70db2b74d93392421edba4bbc11d5 100644 (file)
@@ -57,8 +57,7 @@ void network_adjust_dhcp_server(Network *network) {
                 bool have = false;
 
                 ORDERED_HASHMAP_FOREACH(address, network->addresses_by_section) {
-                        if (section_is_invalid(address->section))
-                                continue;
+                        assert(!section_is_invalid(address->section));
 
                         if (address->family != AF_INET)
                                 continue;
index 7feb178c80c12cfb600c3202350c34a29750d1f6..e0a8be6b544b0a79aa0689b1a93d539c8aa22c1a 100644 (file)
@@ -20,7 +20,6 @@
 #include "networkd-bridge-mdb.h"
 #include "networkd-dhcp-common.h"
 #include "networkd-dhcp-server-static-lease.h"
-#include "networkd-dhcp-server.h"
 #include "networkd-ipv6-proxy-ndp.h"
 #include "networkd-manager.h"
 #include "networkd-ndisc.h"
@@ -326,8 +325,6 @@ int network_verify(Network *network) {
                 return r; /* sr_iov_drop_invalid_sections() logs internally. */
         network_drop_invalid_static_leases(network);
 
-        network_adjust_dhcp_server(network);
-
         return 0;
 }