summaryrefslogtreecommitdiff
path: root/sbin/dhcpleased/engine.c
diff options
context:
space:
mode:
authorFlorian Obser <florian@cvs.openbsd.org>2021-07-25 12:35:59 +0000
committerFlorian Obser <florian@cvs.openbsd.org>2021-07-25 12:35:59 +0000
commita5acc4bd564aa0afbdce76d528ed7bca09e7407a (patch)
tree1aa95ae8b9eab337f1e6c5606a9e029b6f5af0e1 /sbin/dhcpleased/engine.c
parentb8093c9cc3c3cc3faa210c471c805d3b010ec97a (diff)
If the lease didn't contain renewal or rebinding options set the
defaults before validating the times to prevent excessive logging. Found the hard way & OK brynet
Diffstat (limited to 'sbin/dhcpleased/engine.c')
-rw-r--r--sbin/dhcpleased/engine.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/sbin/dhcpleased/engine.c b/sbin/dhcpleased/engine.c
index 20ed7c45da1..b89cf162155 100644
--- a/sbin/dhcpleased/engine.c
+++ b/sbin/dhcpleased/engine.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: engine.c,v 1.20 2021/07/23 11:56:01 florian Exp $ */
+/* $OpenBSD: engine.c,v 1.21 2021/07/25 12:35:58 florian Exp $ */
/*
* Copyright (c) 2017, 2021 Florian Obser <florian@openbsd.org>
@@ -1072,6 +1072,12 @@ parse_dhcp(struct dhcpleased_iface *iface, struct imsg_dhcp *dhcp)
return;
}
+ /* Defaults if we didn't receive renewal or rebinding time. */
+ if (renewal_time == 0)
+ renewal_time = lease_time / 2;
+ if (rebinding_time == 0)
+ rebinding_time = lease_time - (lease_time / 8);
+
/* RFC 2131 4.4.5 */
/* Ignore invalid T1/T2 options */
if (renewal_time >= rebinding_time) {
@@ -1086,6 +1092,7 @@ parse_dhcp(struct dhcpleased_iface *iface, struct imsg_dhcp *dhcp)
renewal_time = rebinding_time = 0;
}
+ /* Defaults if we received wrong renewal or rebinding time. */
if (renewal_time == 0)
renewal_time = lease_time / 2;
if (rebinding_time == 0)