You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I hit a problem with packet out messages when they are used to output buffered packets. When you do this you send a packet out message with a buffer_id != -1 and no data. But you still try to unpack the empty data field.
Traceback (most recent call last):
File "ofp_sniffer.py", line 234, in <module>
main()
File "ofp_sniffer.py", line 222, in main
sniffer.run()
File "ofp_sniffer.py", line 90, in run
self.cap.loop(-1, self.process_packet)
File "ofp_sniffer.py", line 161, in process_packet
self.ofp_proxy.process_packet(pkt)
File "/opt/ofp_sniffer/apps/ofp_proxies.py", line 104, in process_packet
lldp = get_protocol(msg.ofp.data, lldp=True)
File "/opt/ofp_sniffer/libs/tcpiplib/process_data.py", line 165, in get_protocol
data = dissect_data(data)
File "/opt/ofp_sniffer/libs/tcpiplib/process_data.py", line 26, in dissect_data
eth.parse(packet[start:start + 14], 1)
File "/opt/ofp_sniffer/libs/tcpiplib/packet.py", line 73, in parse
ethernet = unpack('!6s6sH', eth_raw)
struct.error: unpack requires a buffer of 14 bytes
The length of eth_raw it seems is supposed to be enforced by slicing data---in line 26 in dissect_data, and in line 72 of parse---but this doesnt seem to actually work, the length is still 0:
>>> a = bytes('', 'utf-8')
>>> len(a)
0
>>> b = a[0:14]
>>> len(b)
0
I put together a really rudimentary patch, but it looks as though there are a few places this assumption is being made, it isnt crashing now but I get a lot of Error: unpack requires a buffer of 14 bytes popping up in my output. I figure it is probably better for me to hand this over to someone with a better idea of when and where this code is hit.
The text was updated successfully, but these errors were encountered:
Hi,
I hit a problem with packet out messages when they are used to output buffered packets. When you do this you send a packet out message with a buffer_id != -1 and no data. But you still try to unpack the empty data field.
The length of eth_raw it seems is supposed to be enforced by slicing data---in line 26 in dissect_data, and in line 72 of parse---but this doesnt seem to actually work, the length is still 0:
I put together a really rudimentary patch, but it looks as though there are a few places this assumption is being made, it isnt crashing now but I get a lot of
Error: unpack requires a buffer of 14 bytes
popping up in my output. I figure it is probably better for me to hand this over to someone with a better idea of when and where this code is hit.The text was updated successfully, but these errors were encountered: