summaryrefslogtreecommitdiff
path: root/include/resolv.h
diff options
context:
space:
mode:
authorEric van Gyzen <vangyzen@FreeBSD.org>2015-10-14 14:26:44 +0000
committerEric van Gyzen <vangyzen@FreeBSD.org>2015-10-14 14:26:44 +0000
commit60b27ebb2532d5607f3b0ec7c4a3c4047a14db44 (patch)
tree898ee83d1d591faf4a93dd91b88fc597457060f4 /include/resolv.h
parent2bfd7091a5f9e4b757b2d8bb5c1bd89548a93c98 (diff)
downloadsrc-test2-60b27ebb2532d5607f3b0ec7c4a3c4047a14db44.tar.gz
src-test2-60b27ebb2532d5607f3b0ec7c4a3c4047a14db44.zip
resolver: automatically reload /etc/resolv.conf
On each resolver query, use stat(2) to see if the modification time of /etc/resolv.conf has changed. If so, reload the file and reinitialize the resolver library. However, only call stat(2) if at least two seconds have passed since the last call to stat(2), since calling it on every query could kill performance. This new behavior is enabled by default. Add a "reload-period" option to disable it or change the period of the test. Document this behavior and option in resolv.conf(5). Polish the man page just enough to appease igor. https://lists.freebsd.org/pipermail/freebsd-arch/2015-October/017342.html Reviewed by: kp, wblock Discussed with: jilles, imp, alfred MFC after: 1 month Relnotes: yes Sponsored by: Dell Inc. Differential Revision: https://reviews.freebsd.org/D3867
Notes
Notes: svn path=/head/; revision=289315
Diffstat (limited to 'include/resolv.h')
-rw-r--r--include/resolv.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/include/resolv.h b/include/resolv.h
index e3d4fd12a097..78da3748a20e 100644
--- a/include/resolv.h
+++ b/include/resolv.h
@@ -176,7 +176,8 @@ struct __res_state {
int res_h_errno; /*%< last one set for this context */
int _vcsock; /*%< PRIVATE: for res_send VC i/o */
u_int _flags; /*%< PRIVATE: see below */
- u_int _pad; /*%< make _u 64 bit aligned */
+ u_short reload_period; /*%< seconds between stat(resolv.conf)*/
+ u_short _pad; /*%< make _u 64 bit aligned */
union {
/* On an 32-bit arch this means 512b total. */
char pad[72 - 4*sizeof (int) - 3*sizeof (void *)];
@@ -188,6 +189,8 @@ struct __res_state {
} _ext;
} _u;
u_char *_rnd; /*%< PRIVATE: random state */
+ struct timespec conf_mtim; /*%< mod time of loaded resolv.conf */
+ time_t conf_stat; /*%< time of last stat(resolv.conf) */
};
typedef struct __res_state *res_state;