IgmpGroupRecordDatagram SourceAddress Field

Jan 27, 2012 at 1:48 PM

Hi,

Thank you for pcapDotNet it is life saver :).My question is that I get "Index was outside the bounds of the array." exception when I try to get SourceAddress field.

   at PcapDotNet.Packets.ByteArrayExtensions.ReadInt(Byte[] buffer, Int32 offset) in C:\Users\Boaz\TFS\tfs06.codeplex.com\PcapDotNet\PcapDotNet\src\PcapDotNet.Packets\ByteArrayExtensions.cs:line 830   at PcapDotNet.Packets.ByteArrayExtensions.ReadInt(Byte[] buffer, Int32 offset, Endianity endianity) in C:\Users\Boaz\TFS\tfs06.codeplex.com\PcapDotNet\PcapDotNet\src\PcapDotNet.Packets\ByteArrayExtensions.cs:line 257   at PcapDotNet.Packets.ByteArrayExtensions.ReadUInt(Byte[] buffer, Int32 offset, Endianity endianity) in C:\Users\Boaz\TFS\tfs06.codeplex.com\PcapDotNet\PcapDotNet\src\PcapDotNet.Packets\ByteArrayExtensions.cs:line 273   at PcapDotNet.Packets.ByteArrayExtensions.ReadIpV4Address(Byte[] buffer, Int32 offset, Endianity endianity) in C:\Users\Boaz\TFS\tfs06.codeplex.com\PcapDotNet\PcapDotNet\src\PcapDotNet.Packets\ByteArrayExtensions.cs:line 382   at PcapDotNet.Packets.Datagram.ReadIpV4Address(Int32 offset, Endianity endianity) in C:\Users\Boaz\TFS\tfs06.codeplex.com\PcapDotNet\PcapDotNet\src\PcapDotNet.Packets\Datagram.cs:line 272   at PcapDotNet.Packets.Igmp.IgmpGroupRecordDatagram.get_SourceAddresses() in C:\Users\Boaz\TFS\tfs06.codeplex.com\PcapDotNet\PcapDotNet\src\PcapDotNet.Packets\Igmp\IgmpGroupRecordDatagram.cs:line 99

I am using http://wiki.wireshark.org/SampleCaptures?action=AttachFile&do=view&target=IGMP+dataset.pcap pcap file. Since it could be my fault of being inexperienced. I give you my code too; For some packet I get this exception at if(rec.AuxiliaryData!=null)  and for some packet I get this exception at rec.SourceAddresses

foreach (PcapDotNet.Packets.Igmp.IgmpGroupRecordDatagram rec in dtg.GroupRecords)           

{               

if(rec.AuxiliaryData!=null)

                    memoExE_igmp_GroupRecords.Text +="Aux:"+ rec.AuxiliaryData+"\n " ;

                if (rec.AuxiliaryDataLength != null)

                    memoExE_igmp_GroupRecords.Text +="AuxDL:"+ rec.AuxiliaryDataLength + "\n";

                if(rec.MulticastAddress!=null)

                    memoExE_igmp_GroupRecords.Text +="MC Address:"+rec.MulticastAddress + "\n";

                if (rec.NumberOfSources != null)

                    memoExE_igmp_GroupRecords.Text +="NumOfSources:"+ rec.NumberOfSources + "\n ";

                if(rec.RecordType!=null)

                    memoExE_igmp_GroupRecords.Text +="RecType:"+ rec.RecordType + "\n ";

                foreach(PcapDotNet.Packets.IpV4.IpV4Address address in rec.SourceAddresses)

                    memoExE_igmp_GroupRecords.Text += address.ToString()+"\n";

}

 

Thank you for your time.

M. Emre Çolak

Coordinator
Jan 28, 2012 at 6:29 PM

Hi M. Emre Çolak,

 

From my understanding of IGMP, and as written in the documentation of IgmpDatagram, only version 3 has GroupRecords.

If you're trying to parse the pcap file you've pointed to, which contains no IGMP version 3, trying to read GroupRecords from it will definitely cause problems.

 

I hope this helps,

 

Boaz.

Jan 28, 2012 at 7:23 PM

Thank you Boaz.

I added versiyon control to my code and it seems fine. I should read more about your documentation :). Thank you for your help.

 

Have a nice life

M. Emre Çolak