fixed bug where IPv6 was always being set on the tunnel interface

This commit is contained in:
Chris Hellberg 2021-12-31 04:37:56 +00:00
parent 061fac44d2
commit 3eb959c8fe

View File

@ -650,17 +650,19 @@ tun_setip(const char *ip, const char *other_ip, int netbits, int forward_v6)
# else # else
display_ip = ip; display_ip = ip;
# endif # 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", IFCONFIGPATH "ifconfig %s inet6 add ::%s/64",
if_name, if_name,
display_ip); display_ip);
v6_r = system(v6_cmdline); v6_r = system(v6_cmdline);
if (v6_r != 0) { if (v6_r != 0) {
return v6_r; return v6_r;
}
} }
snprintf(cmdline, sizeof(cmdline), snprintf(cmdline, sizeof(cmdline),
IFCONFIGPATH "ifconfig %s %s %s netmask %s", IFCONFIGPATH "ifconfig %s %s %s netmask %s",