diff --git a/btpd/main.c b/btpd/main.c index f735ec2..41ddb05 100644 --- a/btpd/main.c +++ b/btpd/main.c @@ -103,10 +103,11 @@ usage(void) "\n" "Options:\n" "-4\n" - "\tOnly use IPv4. Both IPv4 and IPv6 are enabled by default.\n" + "\tUse IPv4. If given in conjunction with -6, " + "both versions are used.\n" "\n" "-6\n" - "\tOnly use IPv6. Both IPv4 and IPv6 are enabled by default.\n" + "\tUse IPv6. By default IPv4 is used.\n" "\n" "--bw-in n\n" "\tLimit incoming BitTorrent traffic to n kB/s.\n" @@ -184,17 +185,17 @@ int main(int argc, char **argv) { char *dir = NULL, *log = NULL; - int daemonize = 1; + int daemonize = 1, opt4 = 0, opt6 = 0; for (;;) { switch (getopt_long(argc, argv, "46d:p:", longopts, NULL)) { case -1: goto args_done; - case '6': - net_ipv4 = 0; - break; case '4': - net_ipv6 = 0; + opt4 = 1; + break; + case '6': + opt6 = 1; break; case 'd': dir = optarg; @@ -247,8 +248,11 @@ args_done: argc -= optind; argv += optind; - if (!net_ipv4 && !net_ipv6) - btpd_err("You need to enable at least one ip version.\n"); + if (opt6) { + net_ipv6 = 1; + if (!opt4) + net_ipv4 = 0; + } if (argc > 0) usage(); diff --git a/btpd/opts.c b/btpd/opts.c index 398aa8a..31f7e25 100644 --- a/btpd/opts.c +++ b/btpd/opts.c @@ -16,4 +16,4 @@ int ipcprot = 0600; int empty_start = 0; const char *tr_ip_arg; int net_ipv4 = 1; -int net_ipv6 = 1; +int net_ipv6 = 0;