python-openflow
python-openflow copied to clipboard
Crash when OFPT_ERROR comes with incomplete data
When an OFPT_FLOW_MOD is rejected through an OFPT_ERROR, some vendors add the OFPT_FLOW_MOD message as part of the data field in the OFPT_ERROR. Some vendors don't send anything and Brocade does a mix: send only part of the message. The python-openflow tries to extract the full flow-mod but crases because buffer is not big enough.
Error: FlowMod.buffer_id; unpack_from requires a buffer of at least 4 bytes; fmt = !I, buff = b'\x008 \xfe\x00\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00', offset = 56.
Libpcap provided in the link [1]. It would be good that, in situations such as this one, the python-openflow just ignored the data (or extract only the first 8 bytes (header)).
[1] https://dl.dropboxusercontent.com/u/38035109/of10-3.pcap