Skip to content
Snippets Groups Projects
Commit c1742620 authored by Pierre LALET's avatar Pierre LALET
Browse files

Add regression tests for `Dest{MAC,IP,IPv6}Field`s

parent d1c18724
No related branches found
No related tags found
No related merge requests found
...@@ -4495,3 +4495,25 @@ assert bpkt.chksum == 0xf0bc and bpkt.payload.chksum == 0xbb17 ...@@ -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) pkt = IP(len=42, ihl=6, options=[IPOption_RR()]) / UDP() / ("A" * 10)
bpkt = IP(str(pkt)) bpkt = IP(str(pkt))
assert bpkt.chksum == 0xf0bc and bpkt.payload.chksum == 0xbb17 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)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment