summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/conf/network_conf.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
index 57e7cec6b9..cac12c4d47 100644
--- a/src/conf/network_conf.c
+++ b/src/conf/network_conf.c
@@ -3486,7 +3486,7 @@ virNetworkDefUpdateIPDHCPHost(virNetworkDefPtr def,
/* search for the entry with this (ip|mac|name),
* and update the IP+(mac|name) */
for (i = 0; i < ipdef->nhosts; i++) {
- if ((host.mac &&
+ if ((host.mac && ipdef->hosts[i].mac &&
!virMacAddrCompare(host.mac, ipdef->hosts[i].mac)) ||
(VIR_SOCKET_ADDR_VALID(&host.ip) &&
virSocketAddrEqual(&host.ip, &ipdef->hosts[i].ip)) ||
@@ -3521,7 +3521,7 @@ virNetworkDefUpdateIPDHCPHost(virNetworkDefPtr def,
/* log error if an entry with same name/address/ip already exists */
for (i = 0; i < ipdef->nhosts; i++) {
- if ((host.mac &&
+ if ((host.mac && ipdef->hosts[i].mac &&
!virMacAddrCompare(host.mac, ipdef->hosts[i].mac)) ||
(host.name &&
STREQ_NULLABLE(host.name, ipdef->hosts[i].name)) ||
@@ -3550,7 +3550,7 @@ virNetworkDefUpdateIPDHCPHost(virNetworkDefPtr def,
/* find matching entry - all specified attributes must match */
for (i = 0; i < ipdef->nhosts; i++) {
- if ((!host.mac ||
+ if ((!host.mac || !ipdef->hosts[i].mac ||
!virMacAddrCompare(host.mac, ipdef->hosts[i].mac)) &&
(!host.name ||
STREQ_NULLABLE(host.name, ipdef->hosts[i].name)) &&