scroot / gopacket

Automatically exported from code.google.com/p/gopacket
BSD 3-Clause "New" or "Revised" License
0 stars 1 forks source link

SetBPFFilter fails with "no IPv4 address assigned" #44

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

Run the attached program, passing it the name of an interface that does not 
have an IPv4 address assigned:

What is the expected output? What do you see instead?

I see:

  SetBPFFilter: br1: no IPv4 address assigned

I would expect it to complete without error.

What version of the product are you using? On what operating system?

I'm using the current version of gopacket from git (commit a6efa31399883e135f).

Please provide any additional information below.

If one runs tcpdump using the -i option to listen on an interface without an 
assigned IPv4 address, it prints:

  tcpdump: WARNING: br1: no IPv4 address assigned

But then proceeds to work normally.

Note that the test program does complete without error under gopacket v1.1.8.  
I believe the issue was introduced in commit 7c2719.  I'd suggest that if the 
call to pcap_lookupnet fails,
it should fall back to using PCAP_NETMASK_UNKNOWN for maskp.

Original issue reported on code.google.com by dwr...@gmail.com on 16 Oct 2014 at 2:04

Attachments:

GoogleCodeExporter commented 9 years ago
That error seems like it shouldn't be blocking.  Switched it to best-effort in 
https://code.google.com/p/gopacket/source/detail?r=2749d42cd16aca6897dfa7d890625
36423a45b44.  Please let me know if things now work as expected.

Original comment by gconnell@google.com on 16 Oct 2014 at 4:16

GoogleCodeExporter commented 9 years ago
That fixes it for me.  Thanks for the quick response!

Original comment by dwr...@gmail.com on 17 Oct 2014 at 10:42