Skip to content

Commit

Permalink
Working on DHCPv4 options
Browse files Browse the repository at this point in the history
  • Loading branch information
ccie18643 committed Sep 9, 2024
1 parent 8d1b908 commit 6bf931d
Show file tree
Hide file tree
Showing 2 changed files with 210 additions and 54 deletions.
6 changes: 3 additions & 3 deletions pytcp/protocols/dhcp4/options/dhcp4_option__message_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+


DHCP4__OPTION__MESSAGE_TYPE__LEN = 4
DHCP4__OPTION__MESSAGE_TYPE__LEN = 3
DHCP4__OPTION__MESSAGE_TYPE__STRUCT = "! BB B"


Expand Down Expand Up @@ -124,7 +124,7 @@ def _validate_integrity(_bytes: bytes, /) -> None:
if (value := _bytes[1]) > len(_bytes):
raise Dhcp4IntegrityError(
"The DHCPv4 Message Type option length must be less than or equal "
"to the length of provided bytes ({len(_bytes)}). Got: {value!r}"
f"to the length of provided bytes ({len(_bytes)}). Got: {value!r}"
)

@override
Expand All @@ -146,4 +146,4 @@ def from_bytes(_bytes: bytes, /) -> Dhcp4OptionMessageType:

Dhcp4OptionMessageType._validate_integrity(_bytes)

return Dhcp4OptionMessageType(Dhcp4MessageType.from_int(_bytes[3]))
return Dhcp4OptionMessageType(Dhcp4MessageType.from_int(_bytes[2]))
Loading

0 comments on commit 6bf931d

Please sign in to comment.