mirror of
https://github.com/fumiama/water.git
synced 2026-06-08 04:00:26 +08:00
fix test and revert non-test changes
This commit is contained in:
@@ -31,7 +31,7 @@ func ioctl(fd uintptr, request uintptr, argp uintptr) error {
|
||||
}
|
||||
|
||||
func newTAP(config Config) (ifce *Interface, err error) {
|
||||
file, err := openTun()
|
||||
file, err := os.OpenFile("/dev/net/tun", os.O_RDWR, 0)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -55,7 +55,7 @@ func newTAP(config Config) (ifce *Interface, err error) {
|
||||
}
|
||||
|
||||
func newTUN(config Config) (ifce *Interface, err error) {
|
||||
file, err := openTun()
|
||||
file, err := os.OpenFile("/dev/net/tun", os.O_RDWR, 0)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -107,16 +107,5 @@ func setDeviceOptions(fd uintptr, config Config) (err error) {
|
||||
if config.Persist {
|
||||
value = 1
|
||||
}
|
||||
|
||||
return ioctl(fd, syscall.TUNSETPERSIST, uintptr(value))
|
||||
}
|
||||
|
||||
func openTun() (*os.File, error) {
|
||||
tunFile := "/dev/net/tun"
|
||||
bfile, err := os.OpenFile(tunFile, os.O_RDWR, 0)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return os.NewFile(bfile.Fd(), tunFile), nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user