Skip to content

Commit

Permalink
Merged in gvaladon/scapy-issues/Patch for PR#82 (pull request phaetho…
Browse files Browse the repository at this point in the history
…n#137)

Patch for the issue from pull request phaethon#82
  • Loading branch information
p-l- committed Oct 6, 2015
2 parents 7f68cf9 + d2c8ebe commit 6b0ce72
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
9 changes: 1 addition & 8 deletions scapy/layers/dhcp6.py
Original file line number Diff line number Diff line change
Expand Up @@ -894,13 +894,6 @@ class DHCP6OptRelayAgentERO(_DHCP6OptGuessPayload): # RFC4994
# INFORMATION REQUEST
# - relay : RELAY-FORW (toward server)

class _DHCP6GuessPayload(Packet):
def guess_payload_class(self, payload):
if len(payload) > 1 :
print ord(payload[0])
return get_cls(dhcp6opts.get(ord(payload[0]),"DHCP6OptUnknown"), conf.raw_layer)
return conf.raw_layer

#####################################################################
## DHCPv6 messages sent between Clients and Servers (types 1 to 11)
# Comme specifie en section 15.1 de la RFC 3315, les valeurs de
Expand Down Expand Up @@ -1137,7 +1130,7 @@ class DHCP6_InfoRequest(DHCP6):
# address or other multicast addresses, it sets the Hop Limit field to
# 32.

class DHCP6_RelayForward(_DHCP6GuessPayload,Packet):
class DHCP6_RelayForward(_DHCP6OptGuessPayload,Packet):
name = "DHCPv6 Relay Forward Message (Relay Agent/Server Message)"
fields_desc = [ ByteEnumField("msgtype", 12, dhcp6types),
ByteField("hopcount", None),
Expand Down
5 changes: 5 additions & 0 deletions test/regression.uts
Original file line number Diff line number Diff line change
Expand Up @@ -3737,6 +3737,11 @@ str(DHCP6_RelayForward()) == '\x0c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x
a=DHCP6_RelayForward('\x0c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
a.msgtype == 12 and a.hopcount == 0 and a.linkaddr == "::" and a.peeraddr == "::"

= DHCP6_RelayForward - Dissection with options
a = DHCP6_RelayForward('\x0c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\t\x00\x04\x00\x01\x00\x00')
a.msgtype == 12 and DHCP6OptRelayMsg in a and DHCP6OptClientId in a


#####################################################################
+ Test DHCP6 Messages - DHCP6_RelayReply

Expand Down

0 comments on commit 6b0ce72

Please sign in to comment.