Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows 11 TUN only capture packet with Src 0.0.0.0 #106

Open
ulfaric opened this issue Nov 17, 2024 · 0 comments
Open

Windows 11 TUN only capture packet with Src 0.0.0.0 #106

ulfaric opened this issue Nov 17, 2024 · 0 comments

Comments

@ulfaric
Copy link

ulfaric commented Nov 17, 2024

Really need someone to help me figure this out, here is a test code:

package main

import (
"log"

"github.com/songgao/water"
"golang.org/x/net/ipv4"

)

func main() {

ifce, err := water.New(water.Config{
	DeviceType: water.TUN,
})
if err != nil {
	log.Fatal(err)
}

for {
	frame := make([]byte, 65535)
	n, err := ifce.Read(frame)
	if err != nil {
		log.Fatal(err)
	}
	frame = frame[:n]
	log.Printf("%s Received packet, length: %d", ifce.Name(), n)
	ipHeader, err := ipv4.ParseHeader(frame)
	if err != nil {
		log.Printf("Error parsing IP header: %v", err)
	} else {
		log.Printf("Received packet from %s to %s", ipHeader.Src, ipHeader.Dst)

	}
}

}

I used the OpenVPN TAP driver 9.27, installed by "devcon install OemVista.inf tap0901". The adapter seems working fine.

I have set the IP, default gateway etc for the adapter. But no matter what I do, the go program only sees packets with Src 0.0.0.0. I have compiled it and run it as admin, still the same...

Then I tried to turn off network isolation according to GPT by "netsh interface set interface <interface_name> admin=enabled". Still no help....

Tried TAP too, seems still can not say any non-broadcast packets...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant