From 3eb959c8fe04baa789e045b83a6aee0c12a50bd8 Mon Sep 17 00:00:00 2001 From: Chris Hellberg Date: Fri, 31 Dec 2021 04:37:56 +0000 Subject: [PATCH] fixed bug where IPv6 was always being set on the tunnel interface --- src/tun.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/tun.c b/src/tun.c index abe8076..0e658b5 100644 --- a/src/tun.c +++ b/src/tun.c @@ -650,18 +650,20 @@ tun_setip(const char *ip, const char *other_ip, int netbits, int forward_v6) # else display_ip = ip; # endif - fprintf(stderr, "Setting IPv6 of %s to ::%s\n", if_name, ip); + if (forward_v6) { + fprintf(stderr, "Setting IPv6 of %s to ::%s\n", if_name, ip); - snprintf(v6_cmdline, sizeof(cmdline), + snprintf(v6_cmdline, sizeof(cmdline), IFCONFIGPATH "ifconfig %s inet6 add ::%s/64", if_name, display_ip); - v6_r = system(v6_cmdline); + v6_r = system(v6_cmdline); - if (v6_r != 0) { - return v6_r; - } + if (v6_r != 0) { + return v6_r; + } + } snprintf(cmdline, sizeof(cmdline), IFCONFIGPATH "ifconfig %s %s %s netmask %s", if_name,