20121029 Strip datalink suffix from IPv6 addresses returned by the system getaddrinfo() routine. Such suffixes mess up the default mynetworks value, host name/address verification and possibly more. This change obsoletes the 20101108 change that removes datalink suffixes in smtpd/smtpd_peer.c, qmqpd/qmqpd_peer.c. File: util/myaddrinfo.c. *** ./src/util/myaddrinfo.c- Tue Feb 1 15:04:28 2011 --- ./src/util/myaddrinfo.c Mon Oct 29 15:42:36 2012 *************** *** 78,83 **** --- 78,84 ---- /* into printable form. The result buffers should be large /* enough to hold the printable address or port including the /* null terminator. + /* This function strips off the IPv6 datalink suffix. /* /* sockaddr_to_hostname() converts a binary network address /* into a hostname or service. The result buffer should be *************** *** 202,207 **** --- 203,209 ---- #include #include #include + #include /* Application-specific. */ *************** *** 607,622 **** } return (0); #else /* * Native getnameinfo(3) version. */ ! return (getnameinfo(sa, salen, ! hostaddr ? hostaddr->buf : (char *) 0, ! hostaddr ? sizeof(hostaddr->buf) : 0, ! portnum ? portnum->buf : (char *) 0, ! portnum ? sizeof(portnum->buf) : 0, ! NI_NUMERICHOST | NI_NUMERICSERV)); #endif } --- 609,628 ---- } return (0); #else + int ret; /* * Native getnameinfo(3) version. */ ! ret = getnameinfo(sa, salen, ! hostaddr ? hostaddr->buf : (char *) 0, ! hostaddr ? sizeof(hostaddr->buf) : 0, ! portnum ? portnum->buf : (char *) 0, ! portnum ? sizeof(portnum->buf) : 0, ! NI_NUMERICHOST | NI_NUMERICSERV); ! if (ret == 0 && sa->sa_family == AF_INET6) ! (void) split_at(hostaddr->buf, '%'); ! return (ret); #endif } *** ./src/util/Makefile.in- Sun Sep 23 19:28:54 2012 --- ./src/util/Makefile.in Mon Oct 29 15:44:12 2012 *************** *** 1526,1531 **** --- 1526,1532 ---- myaddrinfo.o: myaddrinfo.h myaddrinfo.o: mymalloc.h myaddrinfo.o: sock_addr.h + myaddrinfo.o: split_at.h myaddrinfo.o: stringops.h myaddrinfo.o: sys_defs.h myaddrinfo.o: valid_hostname.h