1 autofs-5.0.4 - ipv6 name and address support
3 From: Ian Kent <raven@themaw.net>
5 For ipv6 we need to convert all ipv4 specific function calls to ipv6
6 compatible function calls and update the rpc code to deal with ipv6
7 addresses. The host proximity calculation also needes to be updated.
9 I'm sure this isn't completely correct yet and it will need more work
10 as I become more familiar with how ipv6 and subneting with it is used.
11 The changes so far function correctly for the current autofs
12 connectathon test suite maps so I hope there aren't any regressions
13 with current map configurations.
16 include/replicated.h | 2
17 include/rpc_subs.h | 4
18 lib/rpc_subs.c | 484 ++++++++++++++++++++++++++++++++------------------
19 modules/cyrus-sasl.c | 17 +-
20 modules/replicated.c | 235 +++++++++++++++++-------
21 5 files changed, 499 insertions(+), 243 deletions(-)
24 diff --git a/include/replicated.h b/include/replicated.h
25 index 88cd08a..e0133ff 100644
26 --- a/include/replicated.h
27 +++ b/include/replicated.h
33 + struct sockaddr *addr;
37 diff --git a/include/rpc_subs.h b/include/rpc_subs.h
38 index e20a89d..87fd568 100644
39 --- a/include/rpc_subs.h
40 +++ b/include/rpc_subs.h
46 + struct sockaddr *addr;
49 unsigned long program;
50 @@ -63,7 +63,7 @@ int rpc_udp_getclient(struct conn_info *, unsigned int, unsigned int);
51 void rpc_destroy_udp_client(struct conn_info *);
52 int rpc_tcp_getclient(struct conn_info *, unsigned int, unsigned int);
53 void rpc_destroy_tcp_client(struct conn_info *);
54 -int rpc_portmap_getclient(struct conn_info *, const char *, const char *, size_t, const char *, unsigned int);
55 +int rpc_portmap_getclient(struct conn_info *, const char *, struct sockaddr *, size_t, const char *, unsigned int);
56 unsigned short rpc_portmap_getport(struct conn_info *, struct pmap *);
57 int rpc_ping_proto(struct conn_info *);
58 int rpc_ping(const char *, long, long, unsigned int);
59 diff --git a/lib/rpc_subs.c b/lib/rpc_subs.c
60 index 7b347a7..a822f1f 100644
69 #include <rpc/types.h>
71 #include <rpc/pmap_prot.h>
73 #include <sys/socket.h>
78 inline void dump_core(void);
81 - * Create a UDP RPC client
83 -static CLIENT *create_udp_client(struct conn_info *info)
84 +static CLIENT *rpc_clntudp_create(struct sockaddr *addr, struct conn_info *info, int *fd)
86 - int fd, ret, ghn_errno;
88 - struct sockaddr_in laddr, raddr;
90 - struct hostent *php = &hp;
91 - struct hostent *result;
92 - char buf[HOST_ENT_BUF_SIZE];
95 - if (info->proto->p_proto != IPPROTO_UDP)
99 - if (!clnt_control(info->client, CLGET_FD, (char *) &fd)) {
101 - clnt_destroy(info->client);
102 - info->client = NULL;
104 - clnt_control(info->client, CLSET_FD_NCLOSE, NULL);
105 - clnt_destroy(info->client);
109 - memset(&laddr, 0, sizeof(laddr));
110 - memset(&raddr, 0, sizeof(raddr));
112 - raddr.sin_family = AF_INET;
114 - memcpy(&raddr.sin_addr.s_addr, info->addr, info->addr_len);
118 - if (inet_aton(info->host, &raddr.sin_addr))
121 - memset(&hp, 0, sizeof(struct hostent));
123 - ret = gethostbyname_r(info->host, php,
124 - buf, HOST_ENT_BUF_SIZE, &result, &ghn_errno);
125 - if (ret || !result) {
126 - int err = ghn_errno == -1 ? errno : ghn_errno;
127 - char *estr = strerror_r(err, buf, HOST_ENT_BUF_SIZE);
128 - logerr("hostname lookup failed: %s", estr);
131 - memcpy(&raddr.sin_addr.s_addr, php->h_addr, php->h_length);
134 - raddr.sin_port = htons(info->port);
136 - if (!info->client) {
138 - * bind to any unused port. If we left this up to the rpc
139 - * layer, it would bind to a reserved port, which has been shown
140 - * to exhaust the reserved port range in some situations.
142 - fd = open_sock(PF_INET, SOCK_DGRAM, IPPROTO_UDP);
146 - laddr.sin_family = AF_INET;
147 - laddr.sin_port = 0;
148 - laddr.sin_addr.s_addr = htonl(INADDR_ANY);
150 - len = sizeof(struct sockaddr_in);
151 - if (bind(fd, (struct sockaddr *)&laddr, len) < 0) {
158 - client = clntudp_bufcreate(&raddr,
159 - info->program, info->version,
160 - info->timeout, &fd,
161 - info->send_sz, info->recv_sz);
162 + struct sockaddr_in *in4_raddr;
163 + struct sockaddr_in6 *in6_raddr;
164 + CLIENT *client = NULL;
166 + switch (addr->sa_family) {
168 + in4_raddr = (struct sockaddr_in *) addr;
169 + in4_raddr->sin_port = htons(info->port);
170 + client = clntudp_bufcreate(in4_raddr,
171 + info->program, info->version,
173 + info->send_sz, info->recv_sz);
177 - info->client = NULL;
182 + /* Quiet compile warning */
185 + in6_raddr = (struct sockaddr_in6 *) addr;
186 + in6_raddr->sin6_port = htons(info->port);
187 + client = clntudp6_bufcreate(in6_raddr,
188 + info->program, info->version,
190 + info->send_sz, info->recv_sz);
194 - /* Close socket fd on destroy, as is default for rpcowned fds */
195 - if (!clnt_control(client, CLSET_FD_CLOSE, NULL)) {
196 - clnt_destroy(client);
197 - info->client = NULL;
211 -int rpc_udp_getclient(struct conn_info *info,
212 - unsigned int program, unsigned int version)
213 +static CLIENT *rpc_clnttcp_create(struct sockaddr *addr, struct conn_info *info, int *fd)
215 - struct protoent *pe_proto;
217 + struct sockaddr_in *in4_raddr;
218 + struct sockaddr_in6 *in6_raddr;
219 + CLIENT *client = NULL;
221 + switch (addr->sa_family) {
223 + in4_raddr = (struct sockaddr_in *) addr;
224 + in4_raddr->sin_port = htons(info->port);
225 + client = clnttcp_create(in4_raddr,
226 + info->program, info->version, fd,
227 + info->send_sz, info->recv_sz);
230 - if (!info->client) {
231 - pe_proto = getprotobyname("udp");
236 + /* Quiet compile warning */
239 + in6_raddr = (struct sockaddr_in6 *) addr;
240 + in6_raddr->sin6_port = htons(info->port);
241 + client = clnttcp6_create(in6_raddr,
242 + info->program, info->version, fd,
243 + info->send_sz, info->recv_sz);
247 - info->proto = pe_proto;
248 - info->send_sz = UDPMSGSIZE;
249 - info->recv_sz = UDPMSGSIZE;
254 - info->program = program;
255 - info->version = version;
257 - client = create_udp_client(info);
262 - info->client = client;
267 -void rpc_destroy_udp_client(struct conn_info *info)
272 - clnt_destroy(info->client);
273 - info->client = NULL;
279 @@ -201,12 +133,11 @@ void rpc_destroy_udp_client(struct conn_info *info)
280 * The input struct timeval always has tv_nsec set to zero,
281 * we only ever use tv_sec for timeouts.
283 -static int connect_nb(int fd, struct sockaddr_in *addr, struct timeval *tout)
284 +static int connect_nb(int fd, struct sockaddr *addr, socklen_t len, struct timeval *tout)
286 struct pollfd pfd[1];
287 int timeout = tout->tv_sec;
291 flags = fcntl(fd, F_GETFL, 0);
293 @@ -221,8 +152,7 @@ static int connect_nb(int fd, struct sockaddr_in *addr, struct timeval *tout)
294 * we set ret = -errno to capture it in case we decide to
297 - len = sizeof(struct sockaddr);
298 - ret = connect(fd, (struct sockaddr *)addr, len);
299 + ret = connect(fd, addr, len);
300 if (ret < 0 && errno != EINPROGRESS) {
303 @@ -277,26 +207,241 @@ done:
307 +static CLIENT *rpc_do_create_client(struct sockaddr *addr, struct conn_info *info, int *fd)
309 + CLIENT *client = NULL;
310 + struct sockaddr *laddr;
311 + struct sockaddr_in in4_laddr;
312 + struct sockaddr_in6 in6_laddr;
316 + proto = info->proto->p_proto;
317 + if (proto == IPPROTO_UDP)
320 + type = SOCK_STREAM;
323 + * bind to any unused port. If we left this up to the rpc
324 + * layer, it would bind to a reserved port, which has been shown
325 + * to exhaust the reserved port range in some situations.
327 + switch (addr->sa_family) {
329 + in4_laddr.sin_family = AF_INET;
330 + in4_laddr.sin_port = htons(0);
331 + in4_laddr.sin_addr.s_addr = htonl(INADDR_ANY);
332 + slen = sizeof(struct sockaddr_in);
333 + laddr = (struct sockaddr *) &in4_laddr;
338 + /* Quiet compiler */
339 + in6_laddr.sin6_family = AF_INET6;
342 + in6_laddr.sin6_family = AF_INET6;
343 + in6_laddr.sin6_port = htons(0);
344 + in6_laddr.sin6_addr = in6addr_any;
345 + slen = sizeof(struct sockaddr_in6);
346 + laddr = (struct sockaddr *) &in6_laddr;
353 + if (!info->client) {
354 + *fd = open_sock(addr->sa_family, type, proto);
358 + if (bind(*fd, laddr, slen) < 0) {
364 + switch (info->proto->p_proto) {
366 + if (!info->client) {
367 + *fd = open_sock(addr->sa_family, type, proto);
371 + if (bind(*fd, laddr, slen) < 0) {
376 + client = rpc_clntudp_create(addr, info, fd);
380 + if (!info->client) {
381 + *fd = open_sock(addr->sa_family, type, proto);
385 + if (connect_nb(*fd, laddr, slen, &info->timeout) < 0) {
390 + client = rpc_clnttcp_create(addr, info, fd);
401 + * Create a UDP RPC client
403 +static CLIENT *create_udp_client(struct conn_info *info)
405 + CLIENT *client = NULL;
406 + struct addrinfo *ai, *haddr;
407 + struct addrinfo hints;
410 + if (info->proto->p_proto != IPPROTO_UDP)
415 + if (info->client) {
416 + if (!clnt_control(info->client, CLGET_FD, (char *) &fd)) {
418 + clnt_destroy(info->client);
419 + info->client = NULL;
421 + clnt_control(info->client, CLSET_FD_NCLOSE, NULL);
422 + clnt_destroy(info->client);
427 + client = rpc_do_create_client(info->addr, info, &fd);
431 + if (!info->client) {
437 + memset(&hints, 0, sizeof(hints));
438 + hints.ai_flags = AI_ADDRCONFIG;
439 + hints.ai_family = AF_UNSPEC;
440 + hints.ai_socktype = SOCK_DGRAM;
442 + ret = getaddrinfo(info->host, NULL, &hints, &ai);
445 + "hostname lookup failed: %s", gai_strerror(ret));
451 + client = rpc_do_create_client(haddr->ai_addr, info, &fd);
455 + if (!info->client) {
460 + haddr = haddr->ai_next;
466 + info->client = NULL;
470 + /* Close socket fd on destroy, as is default for rpcowned fds */
471 + if (!clnt_control(client, CLSET_FD_CLOSE, NULL)) {
472 + clnt_destroy(client);
473 + info->client = NULL;
485 +int rpc_udp_getclient(struct conn_info *info,
486 + unsigned int program, unsigned int version)
488 + struct protoent *pe_proto;
491 + if (!info->client) {
492 + pe_proto = getprotobyname("udp");
496 + info->proto = pe_proto;
497 + info->send_sz = UDPMSGSIZE;
498 + info->recv_sz = UDPMSGSIZE;
501 + info->program = program;
502 + info->version = version;
504 + client = create_udp_client(info);
509 + info->client = client;
514 +void rpc_destroy_udp_client(struct conn_info *info)
519 + clnt_destroy(info->client);
520 + info->client = NULL;
525 * Create a TCP RPC client using non-blocking connect
527 static CLIENT *create_tcp_client(struct conn_info *info)
531 - struct sockaddr_in addr;
533 - struct hostent *php = &hp;
534 - struct hostent *result;
535 - char buf[HOST_ENT_BUF_SIZE];
537 + CLIENT *client = NULL;
538 + struct addrinfo *ai, *haddr;
539 + struct addrinfo hints;
542 if (info->proto->p_proto != IPPROTO_TCP)
548 if (!clnt_control(info->client, CLGET_FD, (char *) &fd)) {
551 clnt_destroy(info->client);
554 @@ -305,51 +450,50 @@ static CLIENT *create_tcp_client(struct conn_info *info)
558 - memset(&addr, 0, sizeof(addr));
560 - addr.sin_family = AF_INET;
562 - memcpy(&addr.sin_addr.s_addr, info->addr, info->addr_len);
565 + client = rpc_do_create_client(info->addr, info, &fd);
569 - if (inet_aton(info->host, &addr.sin_addr))
571 + if (!info->client) {
577 - memset(&hp, 0, sizeof(struct hostent));
578 + memset(&hints, 0, sizeof(hints));
579 + hints.ai_flags = AI_ADDRCONFIG;
580 + hints.ai_family = AF_UNSPEC;
581 + hints.ai_socktype = SOCK_STREAM;
583 - ret = gethostbyname_r(info->host, php,
584 - buf, HOST_ENT_BUF_SIZE, &result, &ghn_errno);
585 - if (ret || !result) {
586 - int err = ghn_errno == -1 ? errno : ghn_errno;
587 - char *estr = strerror_r(err, buf, HOST_ENT_BUF_SIZE);
588 - logerr("hostname lookup failed: %s", estr);
589 + ret = getaddrinfo(info->host, NULL, &hints, &ai);
592 + "hostname lookup failed: %s", gai_strerror(ret));
595 - memcpy(&addr.sin_addr.s_addr, php->h_addr, php->h_length);
598 - addr.sin_port = htons(info->port);
601 + client = rpc_do_create_client(haddr->ai_addr, info, &fd);
605 - if (!info->client) {
606 - fd = open_sock(PF_INET, SOCK_STREAM, info->proto->p_proto);
609 + if (!info->client) {
614 - ret = connect_nb(fd, &addr, &info->timeout);
617 + haddr = haddr->ai_next;
620 - client = clnttcp_create(&addr,
621 - info->program, info->version, &fd,
622 - info->send_sz, info->recv_sz);
631 /* Close socket fd on destroy, as is default for rpcowned fds */
632 if (!clnt_control(client, CLSET_FD_CLOSE, NULL)) {
633 clnt_destroy(client);
634 @@ -420,7 +564,7 @@ void rpc_destroy_tcp_client(struct conn_info *info)
637 int rpc_portmap_getclient(struct conn_info *info,
638 - const char *host, const char *addr, size_t addr_len,
639 + const char *host, struct sockaddr *addr, size_t addr_len,
640 const char *proto, unsigned int option)
642 struct protoent *pe_proto;
643 diff --git a/modules/cyrus-sasl.c b/modules/cyrus-sasl.c
644 index 286af15..ec2ab0c 100644
645 --- a/modules/cyrus-sasl.c
646 +++ b/modules/cyrus-sasl.c
647 @@ -732,16 +732,25 @@ sasl_bind_mech(unsigned logopt, LDAP *ldap, struct lookup_context *ctxt, const c
648 debug(logopt, "Attempting sasl bind with mechanism %s", mech);
650 result = ldap_get_option(ldap, LDAP_OPT_HOST_NAME, &host);
651 - if (result != LDAP_SUCCESS || !host) {
652 + if (result != LDAP_OPT_SUCCESS || !host) {
653 debug(logopt, "failed to get hostname for connection");
657 - if ((tmp = strchr(host, ':')))
659 + if ((tmp = strrchr(host, ':'))) {
660 + if (*(tmp - 1) != ']') {
671 /* Create a new authentication context for the service. */
672 - result = sasl_client_new("ldap", host, NULL, NULL, NULL, 0, &conn);
673 + result = sasl_client_new("ldap", tmp, NULL, NULL, NULL, 0, &conn);
674 if (result != SASL_OK) {
675 error(logopt, "sasl_client_new failed with error %d",
677 diff --git a/modules/replicated.c b/modules/replicated.c
678 index 835af97..9e85c00 100644
679 --- a/modules/replicated.c
680 +++ b/modules/replicated.c
683 #include <sys/errno.h>
684 #include <sys/types.h>
685 -#include <netinet/in.h>
687 #include <sys/ioctl.h>
688 #include <sys/socket.h>
689 #include <arpa/inet.h>
690 @@ -75,6 +75,20 @@ static int volatile ifc_last_len = 0;
691 #define max(x, y) (x >= y ? x : y)
692 #define mmax(x, y, z) (max(x, y) == x ? max(x, z) : max(y, z))
694 +unsigned int ipv6_mask_cmp(uint32_t *host, uint32_t *iface, uint32_t *mask)
696 + unsigned int ret = 1;
699 + for (i = 0; i < 4; i++) {
700 + if ((host[i] & mask[i]) != (iface[i] & mask[i])) {
708 void seed_random(void)
711 @@ -136,20 +150,49 @@ static int alloc_ifreq(struct ifconf *ifc, int sock)
715 -static unsigned int get_proximity(const char *host_addr, int addr_len)
716 +static unsigned int get_proximity(struct sockaddr *host_addr)
718 - struct sockaddr_in *msk_addr, *if_addr;
719 + struct sockaddr_in *addr, *msk_addr, *if_addr;
720 + struct sockaddr_in6 *addr6, *msk6_addr, *if6_addr;
721 struct in_addr *hst_addr;
722 - char tmp[20], buf[MAX_ERR_BUF], *ptr;
723 + struct in6_addr *hst6_addr;
725 + char buf[MAX_ERR_BUF], *ptr;
727 struct ifreq *ifr, nmptr;
729 - uint32_t mask, ha, ia;
730 + uint32_t mask, ha, ia, *mask6, *ha6, *ia6;
740 + switch (host_addr->sa_family) {
742 + addr = (struct sockaddr_in *) host_addr;
743 + hst_addr = (struct in_addr *) &addr->sin_addr;
744 + ha = ntohl((uint32_t) hst_addr->s_addr);
745 + addr_len = sizeof(hst_addr);
748 - memcpy(tmp, host_addr, addr_len);
749 - hst_addr = (struct in_addr *) tmp;
752 + return PROXIMITY_ERROR;
754 + addr6 = (struct sockaddr_in6 *) host_addr;
755 + hst6_addr = (struct in6_addr *) &addr6->sin6_addr;
756 + ha6 = &hst6_addr->s6_addr32[0];
757 + addr_len = sizeof(hst6_addr);
761 - ha = ntohl((uint32_t) hst_addr->s_addr);
763 + return PROXIMITY_ERROR;
766 sock = open_sock(AF_INET, SOCK_DGRAM, 0);
768 @@ -174,6 +217,10 @@ static unsigned int get_proximity(const char *host_addr, int addr_len)
770 switch (ifr->ifr_addr.sa_family) {
773 + if (host_addr->sa_family == AF_INET6)
776 if_addr = (struct sockaddr_in *) &ifr->ifr_addr;
777 ret = memcmp(&if_addr->sin_addr, hst_addr, addr_len);
779 @@ -183,6 +230,20 @@ static unsigned int get_proximity(const char *host_addr, int addr_len)
785 + if (host_addr->sa_family == AF_INET)
788 + if6_addr = (struct sockaddr_in6 *) &ifr->ifr_addr;
789 + ret = memcmp(&if6_addr->sin6_addr, hst6_addr, addr_len);
793 + return PROXIMITY_LOCAL;
800 @@ -197,23 +258,27 @@ static unsigned int get_proximity(const char *host_addr, int addr_len)
801 while (ptr < (char *) ifc.ifc_req + ifc.ifc_len) {
802 ifr = (struct ifreq *) ptr;
805 + ret = ioctl(sock, SIOCGIFNETMASK, &nmptr);
807 + char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
808 + logerr("ioctl: %s", estr);
811 + return PROXIMITY_ERROR;
814 switch (ifr->ifr_addr.sa_family) {
817 + if (host_addr->sa_family == AF_INET6)
820 if_addr = (struct sockaddr_in *) &ifr->ifr_addr;
821 ia = ntohl((uint32_t) if_addr->sin_addr.s_addr);
823 /* Is the address within a localiy attached subnet */
826 - ret = ioctl(sock, SIOCGIFNETMASK, &nmptr);
828 - char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
829 - logerr("ioctl: %s", estr);
832 - return PROXIMITY_ERROR;
835 msk_addr = (struct sockaddr_in *) &nmptr.ifr_netmask;
836 mask = ntohl((uint32_t) msk_addr->sin_addr.s_addr);
838 @@ -247,6 +312,29 @@ static unsigned int get_proximity(const char *host_addr, int addr_len)
844 + if (host_addr->sa_family == AF_INET)
847 + if6_addr = (struct sockaddr_in6 *) &ifr->ifr_addr;
848 + ia6 = &if6_addr->sin6_addr.s6_addr32[0];
850 + /* Is the address within the network of the interface */
852 + msk6_addr = (struct sockaddr_in6 *) &nmptr.ifr_netmask;
853 + mask6 = &msk6_addr->sin6_addr.s6_addr32[0];
855 + if (ipv6_mask_cmp(ha6, ia6, mask6)) {
858 + return PROXIMITY_SUBNET;
861 + /* How do we define "local network" in ipv6? */
868 @@ -262,11 +350,12 @@ static unsigned int get_proximity(const char *host_addr, int addr_len)
871 static struct host *new_host(const char *name,
872 - const char *addr, size_t addr_len,
873 + struct sockaddr *addr, size_t addr_len,
874 unsigned int proximity, unsigned int weight)
878 + struct sockaddr *tmp2;
883 @@ -950,65 +1039,78 @@ int prune_host_list(unsigned logopt, struct host **list,
887 -static int add_host_addrs(struct host **list, const char *host, unsigned int weight)
888 +static int add_new_host(struct host **list,
889 + const char *host, unsigned int weight,
890 + struct addrinfo *host_addr)
893 - struct hostent *phe = &he;
894 - struct hostent *result;
895 - struct sockaddr_in saddr;
896 - char buf[MAX_IFC_BUF], **haddr;
897 - int ghn_errno, ret;
902 - saddr.sin_family = AF_INET;
903 - if (inet_aton(host, &saddr.sin_addr)) {
904 - const char *thost = (const char *) &saddr.sin_addr;
906 - prx = get_proximity(thost, sizeof(saddr.sin_addr));
907 - if (prx == PROXIMITY_ERROR)
910 - if (!(new = new_host(host, thost, sizeof(saddr.sin_addr), prx, weight)))
913 - if (!add_host(list, new))
918 + prx = get_proximity(host_addr->ai_addr);
919 + if (prx == PROXIMITY_ERROR)
922 - memset(buf, 0, MAX_IFC_BUF);
923 - memset(&he, 0, sizeof(struct hostent));
924 + addr_len = sizeof(struct sockaddr);
925 + new = new_host(host, host_addr->ai_addr, addr_len, prx, weight);
929 - ret = gethostbyname_r(host, phe,
930 - buf, MAX_IFC_BUF, &result, &ghn_errno);
931 - if (ret || !result) {
932 - if (ghn_errno == -1)
933 - logmsg("host %s: lookup failure %d", host, errno);
935 - logmsg("host %s: lookup failure %d", host, ghn_errno);
936 + if (!add_host(list, new)) {
941 - for (haddr = phe->h_addr_list; *haddr; haddr++) {
946 - prx = get_proximity(*haddr, phe->h_length);
947 - if (prx == PROXIMITY_ERROR)
949 +static int add_host_addrs(struct host **list, const char *host, unsigned int weight)
951 + struct addrinfo hints, *ni, *this;
954 - memcpy(&tt, *haddr, sizeof(struct in_addr));
955 - if (!(new = new_host(host, *haddr, phe->h_length, prx, weight)))
957 + memset(&hints, 0, sizeof(hints));
958 + hints.ai_flags = AI_NUMERICHOST;
959 + hints.ai_family = AF_UNSPEC;
960 + hints.ai_socktype = SOCK_DGRAM;
962 - if (!add_host(list, new)) {
966 + ret = getaddrinfo(host, NULL, &hints, &ni);
972 + ret = add_new_host(list, host, weight, this);
975 + this = this->ai_next;
981 + memset(&hints, 0, sizeof(hints));
982 + hints.ai_flags = AI_ADDRCONFIG;
983 + hints.ai_family = AF_UNSPEC;
984 + hints.ai_socktype = SOCK_DGRAM;
986 + ret = getaddrinfo(host, NULL, &hints, &ni);
988 + error(LOGOPT_ANY, "hostname lookup failed: %s",
989 + gai_strerror(ret));
996 + ret = add_new_host(list, host, weight, this);
999 + this = this->ai_next;
1006 static int add_path(struct host *hosts, const char *path, int len)
1007 @@ -1057,7 +1159,8 @@ static int add_local_path(struct host **hosts, const char *path)
1009 new->proximity = PROXIMITY_LOCAL;
1010 new->version = NFS_VERS_MASK;
1011 - new->name = new->addr = NULL;
1014 new->weight = new->cost = 0;
1016 add_host(hosts, new);