From d1765df9f9497d1adead9b3128237dc8745da4ad Mon Sep 17 00:00:00 2001 From: Rayson Zhu Date: Sun, 13 Nov 2016 23:32:43 -0600 Subject: [PATCH] support ipv6_first option in config file (#946) --- doc/shadowsocks-libev.asciidoc | 3 ++- src/jconf.c | 2 ++ src/jconf.h | 1 + src/server.c | 3 +++ 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/doc/shadowsocks-libev.asciidoc b/doc/shadowsocks-libev.asciidoc index 1231d4dd..21630714 100644 --- a/doc/shadowsocks-libev.asciidoc +++ b/doc/shadowsocks-libev.asciidoc @@ -160,12 +160,13 @@ The config file equivalent of command line options is listed as example below. | -s some.server.net -p 1234 (client) | "server": "some.server.net:1234" | -p 1234 -k "PasSworD" (server) | "port_password": {"1234":"PasSworD"} | -p 1234 | "server_port": "1234" -| -b 0.0.0.0 | "local_adress": "0.0.0.0" +| -b 0.0.0.0 | "local_address": "0.0.0.0" | -l 4321 | "local_port": "4321" | -k "PasSworD" | "password": "PasSworD" | -m "aes-256-cfb" | "method": "aes-256-cfb" | -t 60 | "timeout": 60 | --fast-open | "fast_open": true +| -6 | "ipv6_first": true | -A | "auth": true | -n "/etc/nofile" | "nofile": "/etc/nofile" | -d "8.8.8.8" | "nameserver": "8.8.8.8" diff --git a/src/jconf.c b/src/jconf.c index 50a64a8c..1c2f9c21 100644 --- a/src/jconf.c +++ b/src/jconf.c @@ -216,6 +216,8 @@ read_jconf(const char *file) conf.mtu = value->u.integer; } else if (strcmp(name, "mptcp") == 0) { conf.mptcp = value->u.boolean; + } else if (strcmp(name, "ipv6_first") == 0) { + conf.ipv6_first = value->u.boolean; } } } else { diff --git a/src/jconf.h b/src/jconf.h index c15d329e..fe345d48 100644 --- a/src/jconf.h +++ b/src/jconf.h @@ -63,6 +63,7 @@ typedef struct { int mode; int mtu; int mptcp; + int ipv6_first; } jconf_t; jconf_t *read_jconf(const char *file); diff --git a/src/server.c b/src/server.c index 18dd4cce..0569d68a 100644 --- a/src/server.c +++ b/src/server.c @@ -1715,6 +1715,9 @@ main(int argc, char **argv) if (conf->nameserver != NULL) { nameservers[nameserver_num++] = conf->nameserver; } + if (ipv6first == 0) { + ipv6first = conf->ipv6_first; + } } if (server_num == 0) {