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

Cannot use "any" as interface name. #1

Open
elico opened this issue Jul 17, 2020 · 3 comments
Open

Cannot use "any" as interface name. #1

elico opened this issue Jul 17, 2020 · 3 comments

Comments

@elico
Copy link

elico commented Jul 17, 2020

I have tried to use "any" interface to capture traffic but it's not working.
Any way to fix this?

@jonpulsifer
Copy link
Owner

👋 hey @elico sorry for the delay. Does any mean all in your case? How did you expect this to work?

dnsmon attempts to listen to a given interface, and any is usually not an interface name. If you don't specify an interface, it attempts to listen on the first one with an assigned address, ref the snippet below:

dnsmon-go/main.go

Lines 52 to 66 in 7c417cd

if iface == "" {
// find network interfaces
devices, err := pcap.FindAllDevs()
if err != nil {
log.Fatal(err)
}
// get the first device with an IP address
for _, device := range devices {
if len(device.Addresses) > 0 {
iface = device.Name
break
}
}
}

@elico
Copy link
Author

elico commented Dec 5, 2020

@j0npulsifer Indeed I have seen this piece of code.
I did assumed that it makes sense from an admin point of view to have a function which will open "simultaneously" all the interfaces available on the system.
I do not know how libpcap implements the "any" function which tcpdump -i any uses but, what do you thing about this idea?

@jonpulsifer
Copy link
Owner

I'll take a look at the tcpdump implementation, good idea!

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

No branches or pull requests

2 participants