Under load, the probability of a malformed packet becomes non-trivial. The oftraf tool needs to somehow handle these malformed packets, or else exceptions are thrown and the program execution stops.
A packet may be malformed at the transport layer, in which case exceptions such as the below are thrown:
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 763, in run
self.__target(*self.__args, **self.__kwargs)
File "oftraf.py", line 135, in of_sniff
if tcp.dport == int(ofport):
AttributeError: 'str' object has no attribute 'dport'
A packet may also be malformed at the application layer, in which case exceptions such as the below are thrown:
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 763, in run
self.__target(*self.__args, **self.__kwargs)
File "oftraf.py", line 151, in of_sniff
if not of13_types[of_type] in of13_counts:
KeyError: '\xe3'
With this commit, the packet processing stops when the packet is detected to be malformed. A relevant counter is also stepped. We can discuss whether we wish to print these new counters.
Under load, the probability of a malformed packet becomes non-trivial. The
oftraf
tool needs to somehow handle these malformed packets, or else exceptions are thrown and the program execution stops.A packet may be malformed at the transport layer, in which case exceptions such as the below are thrown:
A packet may also be malformed at the application layer, in which case exceptions such as the below are thrown:
With this commit, the packet processing stops when the packet is detected to be malformed. A relevant counter is also stepped. We can discuss whether we wish to print these new counters.