[svn] Added (currently no-op) -4 and -6.

This commit is contained in:
hniksic 2003-11-11 13:48:35 -08:00
parent 1c35fe3c45
commit 244efb6e50
5 changed files with 29 additions and 10 deletions

View File

@ -1,3 +1,7 @@
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

View File

@ -81,13 +81,6 @@ extern int h_errno;
/* 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
/* Lists of addresses. This should eventually be extended to handle
IPv6. */
@ -537,7 +530,8 @@ lookup_host (const char *host, int silent)
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);
@ -550,6 +544,11 @@ lookup_host (const char *host, int silent)
}
al = address_list_from_addrinfo (res);
freeaddrinfo (res);
if (!al)
{
logprintf (LOG_VERBOSE, _("failed: No IPv4/IPv6 addresses.\n"));
return NULL;
}
}
#else
{
@ -619,7 +618,8 @@ lookup_host_passive (const char *host)
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);

View File

@ -167,6 +167,10 @@ static struct {
{ "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 },

View File

@ -194,6 +194,8 @@ struct cmdline_option option_data[] =
{ "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 },
@ -396,7 +398,7 @@ Logging and input file:\n"),
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_("\
@ -453,6 +455,10 @@ Download:\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_("\

View File

@ -199,6 +199,11 @@ struct options
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;