kytos-ng / of_core

Kytos Main OpenFlow Network Application (NApp)
MIT License
0 stars 5 forks source link

Add sanity checks to of_slicer #24

Closed italovalcy closed 2 years ago

italovalcy commented 3 years ago

Fixes #23

Description of the change

of_core receives data from Kytos Async TCP server as raw_bytes (possibly aggregated) and transform them into individual OpenFlow messages. As part of this routine, of_slicer() is the one responsible for splitting the raw data into individual OpenFlow messages (set of bytes) to be later parsed into OpenFlow objects using python-openflow. of_slicer also takes into consideration that the received bytes can represent incomplete messages (due, for instance, to the socket read buffer), and it will return the list of individual packets and the remaining data. The slicing process does not validated some situations, which can lead to inconsistent messages, infinity loop at the server and memory exhaustion.

This PR will add some sanity checks to the slicing process, to avoid those errors.

Release notes