Skip to content

Commit b44466d

Browse files
author
zack-vii
committed
packet: fixed mac starting with 00:
1 parent e52e019 commit b44466d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

dhcppython/packet.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class DHCPPacket(object):
6565
magic_cookie: ClassVar[bytes] = b"\x63\x82\x53\x63"
6666
cookie_offset_start: ClassVar[int] = 236
6767
cookie_offset_end: ClassVar[int] = 240
68-
packet_fmt: ClassVar[str] = ">BBBBLHHLLLL16s64s128s"
68+
packet_fmt: ClassVar[str] = "!BBBBLHHLLLL16s64s128s"
6969
op_map: ClassVar[Dict[int, str]] = {1: "BOOTREQUEST", 2: "BOOTREPLY"}
7070
inverse_op_map: ClassVar[Dict[str, int]] = {v: k for k, v in op_map.items()}
7171
htype_map: ClassVar[Dict[int, str]] = {
@@ -125,7 +125,7 @@ def from_bytes(cls, packet: bytes):
125125
raise MalformedPacketError("Magic cookie missing")
126126
try:
127127
decoded_packet = [
128-
field.strip(b"\x00") if isinstance(field, bytes) else field
128+
field.rstrip(b"\x00") if isinstance(field, bytes) else field
129129
for field in struct.unpack(
130130
cls.packet_fmt, packet[: cls.cookie_offset_start]
131131
)

0 commit comments

Comments
 (0)