+2003-11-11 Hrvoje Niksic <hniksic@xemacs.org>
+
+ * main.c: Added options --inet4-only and --inet6-only.
+
2003-11-11 Hrvoje Niksic <hniksic@xemacs.org>
* host.c (host_errstr): Use the more standard message "Unknown
/* Mapping between known hosts and to lists of their addresses. */
static struct hash_table *host_name_addresses_map;
-
-#ifdef ENABLE_IPV6
-/* The IP family to request when connecting to remote hosts. This
- should be moved to an entry in struct options when we implement the
- --inet4/--inet6 flags. */
-static int requested_family = AF_UNSPEC;
-#endif
\f
/* Lists of addresses. This should eventually be extended to handle
IPv6. */
xzero (hints);
hints.ai_socktype = SOCK_STREAM;
- hints.ai_family = requested_family;
+ hints.ai_family = AF_UNSPEC; /* #### should look at opt.ipv4_only
+ and opt.ipv6_only */
hints.ai_flags = 0;
err = getaddrinfo_with_timeout (host, NULL, &hints, &res, opt.dns_timeout);
}
al = address_list_from_addrinfo (res);
freeaddrinfo (res);
+ if (!al)
+ {
+ logprintf (LOG_VERBOSE, _("failed: No IPv4/IPv6 addresses.\n"));
+ return NULL;
+ }
}
#else
{
xzero (hints);
hints.ai_socktype = SOCK_STREAM;
- hints.ai_family = requested_family;
+ hints.ai_family = AF_UNSPEC; /* #### should look at opt.ipv4_only
+ and opt.ipv6_only */
hints.ai_flags = AI_PASSIVE;
err = getaddrinfo (host, NULL, &hints, &res);
{ "ignoretags", &opt.ignore_tags, cmd_vector },
{ "includedirectories", &opt.includes, cmd_directory_vector },
{ "input", &opt.input_filename, cmd_file },
+#ifdef ENABLE_IPV6
+ { "inet4only", &opt.ipv4_only, cmd_boolean },
+ { "inet6only", &opt.ipv6_only, cmd_boolean },
+#endif
{ "keepsessioncookies", &opt.keep_session_cookies, cmd_boolean },
{ "killlonger", &opt.kill_longer, cmd_boolean },
{ "limitrate", &opt.limit_rate, cmd_bytes },
{ "ignore-length", 0, OPT_BOOLEAN, "ignorelength", -1 },
{ "ignore-tags", 0, OPT_VALUE, "ignoretags", -1 },
{ "include-directories", 'I', OPT_VALUE, "includedirectories", -1 },
+ { "inet4-only", '4', OPT_BOOLEAN, "inet4only", -1 },
+ { "inet6-only", '6', OPT_BOOLEAN, "inet6only", -1 },
{ "input-file", 'i', OPT_VALUE, "input", -1 },
{ "keep-session-cookies", 0, OPT_BOOLEAN, "keepsessioncookies", -1 },
{ "level", 'l', OPT_VALUE, "reclevel", -1 },
N_("\
-v, --verbose be verbose (this is the default).\n"),
N_("\
- -nv, --non-verbose turn off verboseness, without being quiet.\n"),
+ -nv, --no-verbose turn off verboseness, without being quiet.\n"),
N_("\
-i, --input-file=FILE download URLs found in FILE.\n"),
N_("\
--dns-cache=off disable caching DNS lookups.\n"),
N_("\
--restrict-file-names=OS restrict chars in file names to ones OS allows.\n"),
+ N_("\
+ -4, --inet4-only connect only to IPv4 addresses.\n"),
+ N_("\
+ -6, --inet6-only connect only to IPv6 addresses.\n"),
"\n",
N_("\
int preserve_perm; /* whether remote permissions are used
or that what is set by umask. */
+
+#ifdef ENABLE_IPV6
+ int ipv4_only; /* IPv4 connections have been requested. */
+ int ipv6_only; /* IPv4 connections have been requested. */
+#endif
};
extern struct options opt;