Skip to content
This repository was archived by the owner on Feb 8, 2021. It is now read-only.

Commit 0f5bf4a

Browse files
authored
Merge pull request #667 from liwei/clear-tap-persist
qemu: clear persist flag on tap device
2 parents dcd6b33 + c3fbef2 commit 0f5bf4a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

hypervisor/qemu/network.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ func GetTapFd(device, bridge, options string) (int, error) {
4747
tapFile.Close()
4848
return -1, fmt.Errorf("create tap device failed\n")
4949
}
50+
_, _, errno = syscall.Syscall(syscall.SYS_IOCTL, tapFile.Fd(), uintptr(syscall.TUNSETPERSIST), 0)
51+
if errno != 0 {
52+
tapFile.Close()
53+
return -1, fmt.Errorf("clear tap device persist flag failed\n")
54+
}
5055

5156
err = network.UpAndAddToBridge(device, bridge, options)
5257
if err != nil {

0 commit comments

Comments
 (0)