flowprobe: fix L3 header offset calculation for tx flows 41/40041/2
authorAlexander Chernavin <achernavin@netgate.com>
Tue, 14 Nov 2023 11:33:46 +0000 (11:33 +0000)
committerDave Wallace <dwallacelf@gmail.com>
Fri, 1 Dec 2023 19:29:38 +0000 (19:29 +0000)
commita56e75fd71f8dfdc873ed6c14fecdfec563e3888
treebc407cfe0e3163b56cf3fdd0bf21ae2218901c31
parentda5ddd1714859bfffbb471569e87a7ddd72ac78b
flowprobe: fix L3 header offset calculation for tx flows

The recent TX flows generation fix introduced "l3_hdr_offset" which
represents the offset of the IP header in the buffer's data. The problem
is that it is erroneously defined as a 16-bit unsigned integer. If the
calculated offset is negative, "l3_hdr_offset" will get a value close to
UINT16_MAX. And the code will search the IP header somewhere beyond the
buffer's data. For example, this will occur in the case when an ICMP
error is being sent in response to a received packet.

With this fix, make "l3_hdr_offset" a signed integer.

Type: fix
Change-Id: I6f1283c7ba02656d0f592519b5863e68348c5583
Signed-off-by: Alexander Chernavin <achernavin@netgate.com>
(cherry picked from commit bae6b6d1f2a2e6623257afab21e05da2d795323a)
src/plugins/flowprobe/node.c