diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
index d6eafa3f57..c3c335135b 100644
--- a/src/conf/network_conf.c
+++ b/src/conf/network_conf.c
@@ -412,13 +412,13 @@ virNetworkDHCPLeaseTimeDefParseXML(virNetworkDHCPLeaseTimeDef **lease,
virNetworkDHCPLeaseTimeDef *new_lease = NULL;
g_autofree char *expirystr = NULL;
g_autofree char *unitstr = NULL;
- unsigned long expiry;
+ unsigned long long expiry;
int unit = VIR_NETWORK_DHCP_LEASETIME_UNIT_MINUTES;
if (!(expirystr = virXMLPropString(node, "expiry")))
return 0;
- if (virStrToLong_ul(expirystr, NULL, 10, &expiry) < 0) {
+ if (virStrToLong_ull(expirystr, NULL, 10, &expiry) < 0) {
virReportError(VIR_ERR_XML_ERROR,
_("failed to parse expiry value '%s'"), expirystr);
return -1;
@@ -2312,7 +2312,7 @@ virNetworkIPDefFormat(virBuffer *buf,
if (!lease->expiry) {
virBufferAddLit(buf, "\n");
} else {
- virBufferAsprintf(buf, "\n",
+ virBufferAsprintf(buf, "\n",
lease->expiry,
virNetworkDHCPLeaseTimeUnitTypeToString(lease->unit));
}
@@ -2344,7 +2344,7 @@ virNetworkIPDefFormat(virBuffer *buf,
if (!lease->expiry) {
virBufferAddLit(buf, "\n");
} else {
- virBufferAsprintf(buf, "\n",
+ virBufferAsprintf(buf, "\n",
lease->expiry,
virNetworkDHCPLeaseTimeUnitTypeToString(lease->unit));
}
diff --git a/src/conf/network_conf.h b/src/conf/network_conf.h
index a7e6b7a2a6..6199f3f588 100644
--- a/src/conf/network_conf.h
+++ b/src/conf/network_conf.h
@@ -105,7 +105,7 @@ VIR_ENUM_DECL(virNetworkForwardDriverName);
typedef struct _virNetworkDHCPLeaseTimeDef virNetworkDHCPLeaseTimeDef;
struct _virNetworkDHCPLeaseTimeDef {
- unsigned long expiry;
+ unsigned long long expiry;
virNetworkDHCPLeaseTimeUnitType unit;
};
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index ee3f9dab0a..a711b34c48 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -988,7 +988,7 @@ networkBuildDnsmasqLeaseTime(virNetworkDHCPLeaseTimeDef *lease)
} else {
unit = virNetworkDHCPLeaseTimeUnitTypeToString(lease->unit);
/* We get only first compatible char from string: 's', 'm' or 'h' */
- virBufferAsprintf(&buf, "%lu%c", lease->expiry, unit[0]);
+ virBufferAsprintf(&buf, "%llu%c", lease->expiry, unit[0]);
}
return virBufferContentAndReset(&buf);