mirror of
https://github.com/yggdrasil-network/water.git
synced 2025-05-19 16:35:10 +03:00
fix test and revert non-test changes
This commit is contained in:
parent
4d58427608
commit
ab2cda57af
2 changed files with 2 additions and 19 deletions
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue