Skip to content

Commit 6b0ce72

Browse files
committed
Merged in gvaladon/scapy-issues/Patch for PR#82 (pull request phaethon#137)
Patch for the issue from pull request phaethon#82
2 parents 7f68cf9 + d2c8ebe commit 6b0ce72

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

scapy/layers/dhcp6.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -894,13 +894,6 @@ class DHCP6OptRelayAgentERO(_DHCP6OptGuessPayload): # RFC4994
894894
# INFORMATION REQUEST
895895
# - relay : RELAY-FORW (toward server)
896896

897-
class _DHCP6GuessPayload(Packet):
898-
def guess_payload_class(self, payload):
899-
if len(payload) > 1 :
900-
print ord(payload[0])
901-
return get_cls(dhcp6opts.get(ord(payload[0]),"DHCP6OptUnknown"), conf.raw_layer)
902-
return conf.raw_layer
903-
904897
#####################################################################
905898
## DHCPv6 messages sent between Clients and Servers (types 1 to 11)
906899
# Comme specifie en section 15.1 de la RFC 3315, les valeurs de
@@ -1137,7 +1130,7 @@ class DHCP6_InfoRequest(DHCP6):
11371130
# address or other multicast addresses, it sets the Hop Limit field to
11381131
# 32.
11391132

1140-
class DHCP6_RelayForward(_DHCP6GuessPayload,Packet):
1133+
class DHCP6_RelayForward(_DHCP6OptGuessPayload,Packet):
11411134
name = "DHCPv6 Relay Forward Message (Relay Agent/Server Message)"
11421135
fields_desc = [ ByteEnumField("msgtype", 12, dhcp6types),
11431136
ByteField("hopcount", None),

test/regression.uts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3737,6 +3737,11 @@ str(DHCP6_RelayForward()) == '\x0c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x
37373737
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')
37383738
a.msgtype == 12 and a.hopcount == 0 and a.linkaddr == "::" and a.peeraddr == "::"
37393739

3740+
= DHCP6_RelayForward - Dissection with options
3741+
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')
3742+
a.msgtype == 12 and DHCP6OptRelayMsg in a and DHCP6OptClientId in a
3743+
3744+
37403745
#####################################################################
37413746
+ Test DHCP6 Messages - DHCP6_RelayReply
37423747

0 commit comments

Comments
 (0)