summaryrefslogtreecommitdiff
path: root/sbin/dhclient/dhclient.c
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2020-11-19 22:30:20 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2020-11-19 22:30:20 +0000
commit4059ea3ac6d70e7e8ba8ac65c77f903379fb82ce (patch)
treea4a74c05e3c19b6c65cc8fde7c4836c143165fdc /sbin/dhclient/dhclient.c
parentb61f39293714507d682e028d3ac31ccb3fa2c8a9 (diff)
Avoid spurious resolv.conf updates when
1) The RTM_PROPOSAL telling unwind(8) about DNS servers is seen. 2) The interface is in the process of getting a new or renewed lease. 3) The default route is not UP. Edge cases discovered while debugging urtwn(4) link bouncing.
Diffstat (limited to 'sbin/dhclient/dhclient.c')
-rw-r--r--sbin/dhclient/dhclient.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c
index 315a04cc3de..47955e4d593 100644
--- a/sbin/dhclient/dhclient.c
+++ b/sbin/dhclient/dhclient.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dhclient.c,v 1.681 2020/11/18 18:42:54 krw Exp $ */
+/* $OpenBSD: dhclient.c,v 1.682 2020/11/19 22:30:19 krw Exp $ */
/*
* Copyright 2004 Henning Brauer <henning@openbsd.org>
@@ -374,7 +374,8 @@ rtm_dispatch(struct interface_info *ifi, struct rt_msghdr *rtm)
release_lease(ifi); /* OK even if we sent it. */
ifi->state = S_PREBOOT;
quit = TERMINATE;
- }
+ } else
+ return; /* Ignore tell_unwind() proposals. */
break;
case RTM_DESYNC:
@@ -448,7 +449,8 @@ rtm_dispatch(struct interface_info *ifi, struct rt_msghdr *rtm)
*/
if (quit == 0 && ifi->active != NULL &&
(ifi->flags & IFI_AUTOCONF) != 0 &&
- (ifi->flags & IFI_IN_CHARGE) != 0)
+ (ifi->flags & IFI_IN_CHARGE) != 0 &&
+ ifi->state == S_BOUND)
write_resolv_conf();
}