X-Git-Url: https://git.decadent.org.uk/gitweb/?p=nfs-utils.git;a=blobdiff_plain;f=utils%2Fstatd%2Fsm-notify.c;h=1f490b0e6b7832baadf963f10c5839c846f4e1e9;hp=2d146687f706dca0a8cc70dc38ebd80405ddcdac;hb=7869a76207d3f4b3bd4ab57b4a7a8807ac2ff0c6;hpb=900df0e7c0b9006d72d8459b30dc2cd69ce495a5 diff --git a/utils/statd/sm-notify.c b/utils/statd/sm-notify.c index 2d14668..1f490b0 100644 --- a/utils/statd/sm-notify.c +++ b/utils/statd/sm-notify.c @@ -34,8 +34,9 @@ #include "nsm.h" #include "nfsrpc.h" -#ifndef HAVE_DECL_AI_ADDRCONFIG -#define AI_ADDRCONFIG 0 +/* glibc before 2.3.4 */ +#ifndef AI_NUMERICSERV +#define AI_NUMERICSERV 0 #endif #define NSM_TIMEOUT 2 @@ -78,7 +79,6 @@ smn_lookup(const char *name) { struct addrinfo *ai = NULL; struct addrinfo hint = { - .ai_flags = AI_ADDRCONFIG, .ai_family = (nsm_family == AF_INET ? AF_INET: AF_UNSPEC), .ai_protocol = (int)IPPROTO_UDP, }; @@ -253,6 +253,7 @@ smn_bind_address(const char *srcaddr, const char *srcport) if (srcaddr == NULL) hint.ai_flags |= AI_PASSIVE; + /* Do not allow "node" and "service" parameters both to be NULL */ if (srcport == NULL) error = getaddrinfo(srcaddr, "", &hint, &ai); else @@ -634,15 +635,28 @@ recv_rpcbind_reply(struct sockaddr *sap, struct nsm_host *host, XDR *xdr) } /* - * Successful NOTIFY call. Server returns void, so nothing - * we need to do here. + * Successful NOTIFY call. Server returns void. + * + * Try sending another SM_NOTIFY with an unqualified "my_name" + * argument. Reuse the port number. If "my_name" is already + * unqualified, we're done. */ static void recv_notify_reply(struct nsm_host *host) { - xlog(D_GENERAL, "Host %s notified successfully", host->name); + char *dot = strchr(host->my_name, '.'); - smn_forget_host(host); + if (dot != NULL) { + *dot = '\0'; + host->send_next = time(NULL); + host->xid = 0; + if (host->timeout >= NSM_MAX_TIMEOUT / 4) + host->timeout = NSM_MAX_TIMEOUT / 4; + insert_host(host); + } else { + xlog(D_GENERAL, "Host %s notified successfully", host->name); + smn_forget_host(host); + } } /*