+#ifndef NO_IPV6
+ /*
+ * If we were given ADDRTYPE_UNSPEC, we must also create an
+ * IPv4 listening socket and link it to this one.
+ */
+ if (address_family == AF_INET6 && orig_address_family == ADDRTYPE_UNSPEC) {
+ Actual_Socket other;
+
+ other = (Actual_Socket) sk_newlistener(srcaddr, port, plug,
+ local_host_only, ADDRTYPE_IPV4);
+
+ if (other) {
+ if (!other->error) {
+ other->parent = ret;
+ ret->child = other;
+ } else {
+ /* If we couldn't create a listening socket on IPv4 as well
+ * as IPv6, we must return an error overall. */
+ close(s);
+ sfree(ret);
+ return (Socket) other;
+ }
+ }
+ }
+#endif
+