• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1##############
2% IGMPv3 tests
3##############
4
5+ Basic IGMPv3 tests
6
7= Build IGMPv3 - Basic
8
9a=Ether(src="00:01:02:03:04:05")
10b=IP(src="1.2.3.4")
11c=IGMPv3(mrcode=154)/IGMPv3mq()
12x = a/b/c
13x[IGMPv3].igmpize()
14assert x.mrcode == 131
15assert x[IP].dst == "224.0.0.1"
16assert isinstance(IGMP(raw(x[IGMPv3])), IGMPv3)
17
18= Build IGMPv3 - igmpize
19
20a=Ether(src="00:01:02:03:04:05")
21b=IP(src="1.2.3.4")
22c=IGMPv3()/IGMPv3mr(records = [IGMPv3gr(maddr = "232.1.1.10", srcaddrs = ["10.0.0.10"])])
23x = a/b/c
24ret = x[IGMPv3].igmpize()
25assert ret
26
27= Dissect IGMPv3 - IGMPv3mq
28
29x = 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')
30assert IGMPv3 in x
31assert IGMPv3mq in x
32assert x[IGMPv3mq].gaddr == "230.0.0.2"
33assert x.summary() == "Ether / IP / IGMPv3: 192.168.0.1 > 224.0.0.22 Membership Query / IGMPv3mq"
34assert isinstance(IGMP(raw(x[IGMPv3])), IGMPv3)
35
36= Dissect IGMPv3 - IGMPv3mr
37
38x = 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')
39assert IGMPv3 in x
40assert IGMPv3mr in x
41assert len(x[IGMPv3mr].records) == 4
42assert x[IGMPv3mr].records[0].srcaddrs == ["192.168.0.1", "192.168.132.247"]
43assert x[IGMPv3mr].records[1].maddr == "230.0.0.1"
44assert isinstance(IGMP(raw(x[IGMPv3])), IGMPv3)
45
46= Dissect IGMPv3 - IGMPv3mra
47
48x = 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')
49assert IGMPv3 in x
50assert IGMPv3mra in x
51assert x[IGMPv3mra].qryIntvl == 3
52assert x[IGMPv3mra].robust == 2
53assert isinstance(IGMP(raw(x[IGMPv3])), IGMPv3)
54
55= IGMP vs IVMPv3 tests
56
57assert isinstance(IGMPv3(raw(IGMP())), IGMP)
58assert isinstance(IGMPv3(raw(IGMP(type=0x11))), IGMP)
59assert isinstance(IGMP(raw(IGMPv3()/IGMPv3mra())), IGMPv3)
60assert isinstance(IGMP(raw(IGMPv3()/IGMPv3mq())), IGMPv3)
61
62= IGMPv3 - summaries
63
64pkt = IGMPv3()/IGMPv3mr(records=[IGMPv3gr(maddr="127.0.0.1")])
65assert pkt.summary() == 'IGMPv3 Version 3 Membership Report / IGMPv3mr'
66