mirror of https://github.com/secdev/scapy.git
Add regression tests for `Dest{MAC,IP,IPv6}Field`s
This commit is contained in:
parent
d1c18724b7
commit
c17426201d
|
@ -4495,3 +4495,25 @@ assert bpkt.chksum == 0xf0bc and bpkt.payload.chksum == 0xbb17
|
|||
pkt = IP(len=42, ihl=6, options=[IPOption_RR()]) / UDP() / ("A" * 10)
|
||||
bpkt = IP(str(pkt))
|
||||
assert bpkt.chksum == 0xf0bc and bpkt.payload.chksum == 0xbb17
|
||||
|
||||
= Layer binding
|
||||
|
||||
* Test DestMACField & DestIPField
|
||||
pkt = Ether(str(Ether()/IP()/UDP(dport=5353)/DNS()))
|
||||
assert isinstance(pkt, Ether) and pkt.dst == '01:00:5e:00:00:fb'
|
||||
pkt = pkt.payload
|
||||
assert isinstance(pkt, IP) and pkt.dst == '224.0.0.251'
|
||||
pkt = pkt.payload
|
||||
assert isinstance(pkt, UDP) and pkt.dport == 5353
|
||||
pkt = pkt.payload
|
||||
assert isinstance(pkt, DNS) and isinstance(pkt.payload, NoPayload)
|
||||
|
||||
* Same with IPv6
|
||||
pkt = Ether(str(Ether()/IPv6()/UDP(dport=5353)/DNS()))
|
||||
assert isinstance(pkt, Ether) and pkt.dst == '33:33:00:00:00:fb'
|
||||
pkt = pkt.payload
|
||||
assert isinstance(pkt, IPv6) and pkt.dst == 'ff02::fb'
|
||||
pkt = pkt.payload
|
||||
assert isinstance(pkt, UDP) and pkt.dport == 5353
|
||||
pkt = pkt.payload
|
||||
assert isinstance(pkt, DNS) and isinstance(pkt.payload, NoPayload)
|
||||
|
|
Loading…
Reference in New Issue