Skip to content
Snippets Groups Projects
Commit abb2a79a authored by NGUYEN Do Duc Anh's avatar NGUYEN Do Duc Anh
Browse files

fix incorrectly read option IP

parent 131ebca7
No related branches found
No related tags found
No related merge requests found
...@@ -29,8 +29,8 @@ class CustomIPOption(IPOption): ...@@ -29,8 +29,8 @@ class CustomIPOption(IPOption):
def read_entry(self, index): def read_entry(self, index):
if index < self.count: if index < self.count:
# Calculate the offset of the entry in the value field # Calculate the offset of the entry in the value field
offset = index * 12 # Each entry is 12 bytes (3 integers) offset = index * 6 # Each entry is 6 bytes (1 integer, 2 bytes)
entry_data = self.value[offset:offset + 12] entry_data = self.value[offset:offset + 6]
id_val, inter_val, cmd_val = struct.unpack('!IBB', entry_data) id_val, inter_val, cmd_val = struct.unpack('!IBB', entry_data)
return {"node_id": id_val, "inter_num": inter_val, "cmd": cmd_val} return {"node_id": id_val, "inter_num": inter_val, "cmd": cmd_val}
else: else:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment