1 ############## 2 % IGMPv3 tests 3 ############## 4 5 + Basic IGMPv3 tests 6 7 = Build IGMPv3 - Basic 8 9 a=Ether(src="00:01:02:03:04:05") 10 b=IP(src="1.2.3.4") 11 c=IGMPv3(mrcode=154)/IGMPv3mq() 12 x = a/b/c 13 x[IGMPv3].igmpize() 14 assert x.mrcode == 131 15 assert x[IP].dst == "224.0.0.1" 16 assert isinstance(IGMP(raw(x[IGMPv3])), IGMPv3) 17 18 = Dissect IGMPv3 - IGMPv3mq 19 20 x = Ether(b'\x14\x0cv\x8f\xfe(\x00\x01\x02\x03\x04\x05\x08\x00F\xc0\x00$\x00\x01\x00\x00\x01\x02\xe4h\xc0\xa8\x00\x01\xe0\x00\x00\x16\x94\x04\x00\x00\x11\x14\x0e\xe9\xe6\x00\x00\x02\x00\x00\x00\x00') 21 assert IGMPv3 in x 22 assert IGMPv3mq in x 23 assert x[IGMPv3mq].gaddr == "230.0.0.2" 24 assert x.summary() == "Ether / IP / IGMPv3: 192.168.0.1 > 224.0.0.22 Membership Query / IGMPv3mq" 25 assert isinstance(IGMP(raw(x[IGMPv3])), IGMPv3) 26 27 = Dissect IGMPv3 - IGMPv3mr 28 29 x = Ether(b'\x01\x00^\x00\x00\x16\xa8\xf9K\x00\x00\x01\x08\x00E\xc0\x00D\x00\x01\x00\x00\x01\x02\xd6\xdf\x01\x01\x01\x01\xe0\x00\x00\x16"\x00;\xa6\x00\x00\x00\x04\x01\x00\x00\x02\xe6\x00\x00\x00\xc0\xa8\x00\x01\xc0\xa8\x84\xf7\x01\x00\x00\x00\xe6\x00\x00\x01\x01\x00\x00\x00\xe6\x00\x00\x02\x01\x00\x00\x00\xe6\x00\x00\x03') 30 assert IGMPv3 in x 31 assert IGMPv3mr in x 32 assert len(x[IGMPv3mr].records) == 4 33 assert x[IGMPv3mr].records[0].srcaddrs == ["192.168.0.1", "192.168.132.247"] 34 assert x[IGMPv3mr].records[1].maddr == "230.0.0.1" 35 assert isinstance(IGMP(raw(x[IGMPv3])), IGMPv3) 36 37 = Dissect IGMPv3 - IGMPv3mra 38 39 x = Ether(b'\x14\x0cv\x8f\xfe(\x00\x01\x02\x03\x04\x05\x08\x00F\xc0\x00 \x00\x01\x00\x00\x01\x02\xe4l\xc0\xa8\x00\x01\x7f\x00\x00\x01\x94\x04\x00\x000\x14\xcf\xe6\x00\x03\x00\x02') 40 assert IGMPv3 in x 41 assert IGMPv3mra in x 42 assert x[IGMPv3mra].qryIntvl == 3 43 assert x[IGMPv3mra].robust == 2 44 assert isinstance(IGMP(raw(x[IGMPv3])), IGMPv3) 45 46 = IGMP vs IVMPv3 tests 47 48 assert isinstance(IGMPv3(raw(IGMP())), IGMP) 49 assert isinstance(IGMPv3(raw(IGMP(type=0x11))), IGMP) 50 assert isinstance(IGMP(raw(IGMPv3()/IGMPv3mra())), IGMPv3) 51 assert isinstance(IGMP(raw(IGMPv3()/IGMPv3mq())), IGMPv3) 52 53 = IGMPv3 - summaries 54 55 pkt = IGMPv3()/IGMPv3mr(records=[IGMPv3gr(maddr="127.0.0.1")]) 56 assert pkt.summary() == 'IGMPv3 Version 3 Membership Report / IGMPv3mr' 57