Click here to Skip to main content
15,867,453 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi, I am facing the issue when i want to pack the ethernet packet fields by using verilog_struct.pack() method.

Error I am pasting below:
Traceback (most recent call last):
File "pcap_extract.py", line 42, in
verilog_data = verilog_struct.pack(*ip_fields)
struct.error: pack expected 1 items for packing (got 2)



My code is:
from struct import *
fields = 
verilog_struct = struct.Struct(">6s6s")
for pkt in ins:
print(pkt.fields)
ip_fields = (pkt.src,pkt.dst)
verilog_data = verilog_struct.pack(*ip_fields)
fields.append(verilog_data)


Please let me know, where is the issue in my code?

What I have tried:

verilog_struct.pack() issue::Not able to pack the ethernet packet fileds
Posted
Updated 17-Feb-23 3:18am
v2
Comments
Richard MacCutchan 16-Feb-23 11:27am    
The message is clear; check the documentation to see what parameter the pack function expects.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900