Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update inet6.py for Destination Option #4695

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion scapy/layers/inet6.py
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,20 @@ def answers(self, other):
elif other.nh == 43 and isinstance(other.payload, IPv6ExtHdrSegmentRouting): # noqa: E501
return self.payload.answers(other.payload.payload) # Buggy if self.payload is a IPv6ExtHdrRouting # noqa: E501
elif other.nh == 60 and isinstance(other.payload, IPv6ExtHdrDestOpt):
return self.payload.answers(other.payload.payload)
# Extension Headers can show weird behavious.
# Linux's sk_buff considers the IPv6 Payload
# to be either TCP, UDP or ICMP. It does not
# consider Extension Headers to be the payload.
# Following similar architecture, This small
# modification let's packet flow with Destination
# Option on both, request and response packets
# be captured as well.
if UDP in self and UDP in other:
return self[UDP].answers(other[UDP])
elif TCP in self and TCP in other:
return self[TCP].answers(other[TCP])
else:
return self.payload.answers(other.payload.payload) # Previous Implementation
elif self.nh == 60 and isinstance(self.payload, IPv6ExtHdrDestOpt): # BU in reply to BRR, for instance # noqa: E501
return self.payload.payload.answers(other.payload)
else:
Expand Down
Loading