修复没有ipv6报错的问题

This commit is contained in:
bjdgyc 2021-07-16 18:12:08 +08:00
parent a8038f8fe9
commit 5ffea2339e
2 changed files with 8 additions and 6 deletions

View File

@ -65,15 +65,16 @@ func LinkTap(cSess *sessdata.ConnSession) error {
// arp on // arp on
cmdstr1 := fmt.Sprintf("ip link set dev %s up mtu %d multicast on", ifce.Name(), cSess.Mtu) 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) 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()) err = execCmd([]string{cmdstr1, cmdstr2})
cmdStrs := []string{cmdstr1, cmdstr2}
err = execCmd(cmdStrs)
if err != nil { if err != nil {
base.Error(err) base.Error(err)
_ = ifce.Close() _ = ifce.Close()
return err return err
} }
cmdstr3 := fmt.Sprintf("sysctl -w net.ipv6.conf.%s.disable_ipv6=1", ifce.Name())
execCmd([]string{cmdstr3})
go tapRead(ifce, cSess) go tapRead(ifce, cSess)
go tapWrite(ifce, cSess) go tapWrite(ifce, cSess)
return nil return nil

View File

@ -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) 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", cmdstr2 := fmt.Sprintf("ip addr add dev %s local %s peer %s/32",
ifce.Name(), base.Cfg.Ipv4Gateway, cSess.IpAddr) ifce.Name(), base.Cfg.Ipv4Gateway, cSess.IpAddr)
// cmdstr3 := fmt.Sprintf("sysctl -w net.ipv6.conf.%s.disable_ipv6=1", ifce.Name()) err = execCmd([]string{cmdstr1, cmdstr2})
cmdStrs := []string{cmdstr1, cmdstr2}
err = execCmd(cmdStrs)
if err != nil { if err != nil {
base.Error(err) base.Error(err)
_ = ifce.Close() _ = ifce.Close()
return err return err
} }
cmdstr3 := fmt.Sprintf("sysctl -w net.ipv6.conf.%s.disable_ipv6=1", ifce.Name())
execCmd([]string{cmdstr3})
go tunRead(ifce, cSess) go tunRead(ifce, cSess)
go tunWrite(ifce, cSess) go tunWrite(ifce, cSess)
return nil return nil