Issues related to stale DNS (DHCP init races)
I see a some old bugs hanging out which I believe are duplicates, and I believe are related to what I'm seeing in 16.04. What I've been seeing is that autofs will start before DHCP has completed and provided the correct DNS entries. When autofs goes to read the master map from LDAP getaddrinfo fails because it has stale data for the name servers which was read in when glibc was loaded (ie, when autofs first started, that is before DHCP had completed). The correct fix to this problem is to refresh the DNS resolver information prior to getaddrinfo call. This can be accomplished with res_init(). In fact it looks like this fix was already applied to lookup_hesiod.c, unfortunately it should have carried forward to similar network modules such as ldap and nis. I've patched based on wily and have been testing it. I'm putting bugs I believe related and the patch below.
Bugs I'm pretty sure are related (I believe there are actually a few more):
https:/
https:/
autofs/modules# diff -rupN replicated.c.orig replicated.c
--- replicated.c.orig 2016-04-08 22:57:17.329867770 -0700
+++ replicated.c 2016-04-08 23:01:04.939919189 -0700
@@ -49,6 +49,8 @@
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <netinet/in.h>
+#include <arpa/nameser.h>
+#include <resolv.h>
#include <netdb.h>
#include "rpc_subs.h"
@@ -237,6 +239,7 @@ static unsigned int get_nfs_
double taken = 0;
int status, count = 0;
+ res_init();
if (host->addr)
debug(logopt, "called with host %s(%s) proto %d version 0x%x",
@@ -898,6 +901,7 @@ static int add_host_
int rr = 0, rr4 = 0, rr6 = 0;
int ret;
+ res_init();
if (!name) {
char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
error(
It's possible that I've just changed timing, but its working for me so far.
Question information
- Language:
- English Edit question
- Status:
- Answered
- For:
- Ubuntu autofs Edit question
- Assignee:
- No assignee Edit question
- Last query:
- Last reply:
Can you help with this problem?
Provide an answer of your own, or ask James Shimer for more information if necessary.