TCP: Reassemble TCP PDU segments for complete NFS message processing
Subsystems (2)
PATCH 1/1 TCP: Reassemble TCP PDU segments for complete NFS message processing
Previously, nfstest was unable to process NFS messages split across multiple TCP segments, resulting in missed NFS operations and numerous test failures.
For example:
4 0.000816 192.168.122.198 → 192.168.122.199 NFS 110 V4 NULL Call
5 0.001073 192.168.122.199 → 192.168.122.198 TCP 66 2049 → 775 [ACK]
Seq=1 Ack=45 Win=65152 Len=0 TSval=3032720633 TSecr=443583529 6 0.001155 192.168.122.199 → 192.168.122.198 TCP 70 2049 → 775 [PSH, ACK] Seq=1 Ack=45 Win=65152 Len=4 TSval=3032720634 TSecr=443583529 [TCP segment of a reassembled PDU]
7 0.001155 192.168.122.199 → 192.168.122.198 NFS 90 V4 NULL Reply (Call In 4)
This patch introduces functionality to reassemble TCP segments, allowing nfstest to accurately decode complete NFS messages, similar to Wireshark's "TCP Segment of a Reassembled PDU.
Signed-off-by Chen Hanxiao <[email protected]>
--- packet/pktt.py | 6 +++ packet/transport/tcp.py | 104 +++++++++++++++++++++++++++++++++++++++- packet/unpack.py | 6 +++ 3 files changed, 115 insertions(+), 1 deletion(-)
packet/pktt.py +6 -0
@@ -368,6 +368,10 @@ class Pktt(BaseObj): # IPv4 fragments used in reassembly self._ipv4_fragments = {} + # IPv4 PDU fragments + self._tcp_pdu_map = {} + self._tcp_pdu_pkt = {} + # RDMA reassembly object self._rdma_info = RDMAinfo()
@@ -419,6 +423,8 @@ class Pktt(BaseObj): del self._tcp_stream_map del self._rpc_xid_map del self._rdma_info + del self._tcp_pdu_map + del self._tcp_pdu_pkt def __del__(self): """Destructor
packet/transport/tcp.py +103 -1
128 lines not on this page · raw message
packet/unpack.py +6 -0
@@ -194,6 +194,12 @@ class Unpack(object): self._state.append([sid, self._offset]) return sid + def replace_data(self, data): + """replace current working buffer""" + self._data = data + self._offset = 0 + self._state = [] + def restore_state(self, sid): """Restore state given by the state id""" max = len(self._state)
Signature · 1 line
2.47.1