{
iface->managed = 1;
iface->learn_routes = 1;
+ iface->dhcpv4_leasetime = 43200;
iface->ra_maxinterval = 600;
iface->ra_mininterval = iface->ra_maxinterval/3;
iface->ra_lifetime = -1;
goto err;
}
- if (time >= 60)
- return time;
+ if (time < 60)
+ time = 60;
- return 0;
+ return time;
err:
return -1;
if (time < 0)
goto err;
- if (time >= 60)
- lease->dhcpv4_leasetime = time;
+ lease->dhcpv4_leasetime = time;
}
list_add(&lease->head, &leases);
if (time < 0)
goto err;
- if (time >= 60)
- iface->dhcpv4_leasetime = time;
+ iface->dhcpv4_leasetime = time;
}
if ((c = tb[IFACE_ATTR_START])) {
return -1;
}
- if (lease->dhcpv4_leasetime >= 60)
- a->leasetime = lease->dhcpv4_leasetime;
+ a->leasetime = lease->dhcpv4_leasetime;
a->addr = ntohl(lease->ipaddr.s_addr);
memcpy(a->hwaddr, lease->mac.ether_addr_octet, sizeof(a->hwaddr));
free_dhcpv4_assignment(a);
}
-
- if (iface->dhcpv4_leasetime < 60)
- iface->dhcpv4_leasetime = 43200;
-
iface->dhcpv4_event.uloop.fd = sock;
iface->dhcpv4_event.handle_dgram = handle_dhcpv4;
odhcpd_register(&iface->dhcpv4_event);
assigned = dhcpv4_assign(iface, a, raddr);
}
- if (a->leasetime >= 60)
+ if (a->leasetime)
my_leasetime = a->leasetime;
else
my_leasetime = iface->dhcpv4_leasetime;
return -1;
}
- if (lease->dhcpv4_leasetime > 0)
- a->leasetime = lease->dhcpv4_leasetime;
+ a->leasetime = lease->dhcpv4_leasetime;
a->clid_len = duid_len;
a->length = 128;
} else {
if (a) {
uint32_t leasetime;
- if (a->leasetime > 0)
+ if (a->leasetime)
leasetime = a->leasetime;
else
leasetime = iface->dhcpv4_leasetime;
- if (leasetime == 0)
- leasetime = 3600;
- else if (leasetime < 60)
- leasetime = 60;
-
uint32_t pref = leasetime;
uint32_t valid = leasetime;