Help with Communicator Filter?

Jul 29, 2014 at 2:27 PM
I am sending out a broadcast packet, but whenever I put in the filter to only receive packets that are of greater length than a certain number, I always get the response of only packets that are 100, no matter what. Here is a snippet of my code:
            Using filter As BerkeleyPacketFilter = Communicator.CreateFilter("len>=300")
                ' Set the filter
                Communicator.SetFilter(filter)
            End Using


            ' send broadcast packet
            Communicator.SendPacket(BuildEthernetPacket(ReqInfoPkt, "ff:ff:ff:ff:ff:ff"))

 ' receive packets 
            While result = PacketCommunicatorReceiveResult.Ok And packetlist.Count < 500 And _
                Not result = PacketCommunicatorReceiveResult.Timeout

                result = Communicator.ReceivePacket(packet)
                packetlist.Add(packet)
            End While
It's in vb.net. Here's the debugging, and you can see in the screen shot that the packets are all the same length. What am I doing wrong?

http://postimg.org/image/b7d2vtrg5/

Thanks!
Coordinator
Jul 31, 2014 at 7:04 PM
Hi sparkysword,

Can you provide the code part in which you create the communicator?
Also, please provide a pcap file of the packets without filtering and with.

Boaz.
Jul 31, 2014 at 8:30 PM
Sure, here it is:
 ' Open the output device
            Dim Communicator As PacketCommunicator = selectedOutputDevice.Open(100, PacketDeviceOpenAttributes.None, 300)

           Using filter As BerkeleyPacketFilter = Communicator.CreateFilter("len>=300")
                ' Set the filter
                Communicator.SetFilter(filter)
            End Using

            ' send broadcast packet
            Communicator.SendPacket(BuildEthernetPacket(ReqInfoPkt, "ff:ff:ff:ff:ff:ff"))

            ' receive packets 
            While result = PacketCommunicatorReceiveResult.Ok And packetlist.Count < 500 And _
                Not result = PacketCommunicatorReceiveResult.Timeout

                result = Communicator.ReceivePacket(packet)
                packetlist.Add(packet)
            End While
It has the same result when promiscuous and none.


When you say pcap file, what format do you mean? Like print out the packets I receive into a word file?

Here's a screen shot of it without any filters, and you can see that I do indeed get non 100 length packets. http://postimg.org/image/4whz9d82l/
Coordinator
Aug 1, 2014 at 9:20 AM
Edited Aug 1, 2014 at 9:21 AM
As mentioned in stackoverflow, this is probably due to the fact you set the snapshot length to 100 when you open the device and create a communicator.
You should probably set it to 65536.