From 5ffea2339e075b3ff164379e8f3c540ee3b126f4 Mon Sep 17 00:00:00 2001 From: bjdgyc Date: Fri, 16 Jul 2021 18:12:08 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=B2=A1=E6=9C=89ipv6?= =?UTF-8?q?=E6=8A=A5=E9=94=99=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/handler/link_tap.go | 7 ++++--- server/handler/link_tun.go | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/server/handler/link_tap.go b/server/handler/link_tap.go index fe3ed13..a9ff4b0 100644 --- a/server/handler/link_tap.go +++ b/server/handler/link_tap.go @@ -65,15 +65,16 @@ func LinkTap(cSess *sessdata.ConnSession) error { // arp on cmdstr1 := fmt.Sprintf("ip link set dev %s up mtu %d multicast on", ifce.Name(), cSess.Mtu) cmdstr2 := fmt.Sprintf("ip link set dev %s master %s", ifce.Name(), bridgeName) - // cmdstr3 := fmt.Sprintf("sysctl -w net.ipv6.conf.%s.disable_ipv6=1", ifce.Name()) - cmdStrs := []string{cmdstr1, cmdstr2} - err = execCmd(cmdStrs) + err = execCmd([]string{cmdstr1, cmdstr2}) if err != nil { base.Error(err) _ = ifce.Close() return err } + cmdstr3 := fmt.Sprintf("sysctl -w net.ipv6.conf.%s.disable_ipv6=1", ifce.Name()) + execCmd([]string{cmdstr3}) + go tapRead(ifce, cSess) go tapWrite(ifce, cSess) return nil diff --git a/server/handler/link_tun.go b/server/handler/link_tun.go index 822c92a..3d0e456 100644 --- a/server/handler/link_tun.go +++ b/server/handler/link_tun.go @@ -46,15 +46,16 @@ func LinkTun(cSess *sessdata.ConnSession) error { cmdstr1 := fmt.Sprintf("ip link set dev %s up mtu %d multicast off", ifce.Name(), cSess.Mtu) cmdstr2 := fmt.Sprintf("ip addr add dev %s local %s peer %s/32", ifce.Name(), base.Cfg.Ipv4Gateway, cSess.IpAddr) - // cmdstr3 := fmt.Sprintf("sysctl -w net.ipv6.conf.%s.disable_ipv6=1", ifce.Name()) - cmdStrs := []string{cmdstr1, cmdstr2} - err = execCmd(cmdStrs) + err = execCmd([]string{cmdstr1, cmdstr2}) if err != nil { base.Error(err) _ = ifce.Close() return err } + cmdstr3 := fmt.Sprintf("sysctl -w net.ipv6.conf.%s.disable_ipv6=1", ifce.Name()) + execCmd([]string{cmdstr3}) + go tunRead(ifce, cSess) go tunWrite(ifce, cSess) return nil