Skip to content

Commit

Permalink
Merge pull request #200 from PaulosV/wg_fix_payload_len_fail
Browse files Browse the repository at this point in the history
process/wg: do not check if transport data length is divisible by 16
  • Loading branch information
hynekkar authored Jan 24, 2024
2 parents 84b4f7d + e0dbd6f commit 47a2ded
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
Binary file modified pcaps/wg.pcap
Binary file not shown.
3 changes: 1 addition & 2 deletions process/wg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,7 @@ bool WGPlugin::parse_wg(const char *data, unsigned int payload_len, bool source_
break;

case WG_PACKETTYPE_TRANSPORT_DATA:
// Each packet of transport data is zero-padded to the multiple of 16 bytes in length.
if (payload_len < WG_PACKETLEN_MIN_TRANSPORT_DATA || (payload_len % 16) != 0) {
if (payload_len < WG_PACKETLEN_MIN_TRANSPORT_DATA) {
return false;
}

Expand Down
14 changes: 10 additions & 4 deletions tests/functional/reference/wg
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
147.32.110.1,147.32.110.220,92,0,0,2022-01-20T16:24:15.335506,2022-01-20T16:24:15.335506,54:52:00:53:6e:e8,28:d2:44:7c:a9:59,1,0,256,0,53,52368,0,17,0,0,1
147.32.110.220,147.32.111.101,900,420,0,2021-04-10T16:00:15.001728,2021-04-10T16:00:33.714026,28:d2:44:7c:a9:59,d8:58:d7:00:bc:82,7,3,4175505008,1207227522,52805,44099,0,17,0,0,100
147.32.111.101,147.32.110.220,5088,8220,0,2021-04-10T16:00:37.562187,2021-04-10T16:02:41.896207,d8:58:d7:00:bc:82,28:d2:44:7c:a9:59,37,52,2588969467,3580317389,44099,41993,0,17,0,0,100
147.32.111.101,147.32.110.220,3920,6300,0,2021-04-10T16:02:41.896207,2021-04-10T16:04:42.033166,d8:58:d7:00:bc:82,28:d2:44:7c:a9:59,29,44,3619843067,1791020594,44099,41993,0,17,0,0,100
147.32.111.101,147.32.110.220,17932,24804,0,2021-04-10T16:04:42.033166,2021-04-10T16:05:14.805044,d8:58:d7:00:bc:82,28:d2:44:7c:a9:59,138,142,3304217979,3848115376,44099,41993,0,17,0,0,100
147.32.111.101,147.32.110.220,176,92,0,2021-04-27T00:06:16.952594,2021-04-27T00:06:16.953205,d8:58:d7:00:bc:82,28:d2:44:7c:a9:59,1,1,0,3832103995,44099,46362,0,17,0,0,100
147.32.110.50,10.0.2.15,120,536,0,2023-08-28T21:02:42.370509,2023-08-28T21:04:47.901665,52:54:00:12:35:02,08:00:27:82:d6:d6,1,7,3512262135,3266391210,58119,55385,0,17,0,0,100
147.32.110.50,10.0.2.15,304,784,0,2023-08-28T21:00:26.677584,2023-08-28T21:02:42.370509,52:54:00:12:35:02,08:00:27:82:d6:d6,3,9,146449797,84499236,58119,55385,0,17,0,0,100
147.32.110.50,10.0.2.15,3532,7600,0,2023-08-28T20:56:07.603286,2023-08-28T20:58:17.644913,52:54:00:12:35:02,08:00:27:82:d6:d6,20,26,2885499184,526936422,58119,55385,0,17,0,0,100
147.32.110.50,10.0.2.15,5496,9344,0,2023-08-28T20:54:58.886374,2023-08-28T20:56:07.603286,52:54:00:12:35:02,08:00:27:82:d6:d6,30,21,3915122724,1379208129,58119,55385,0,17,0,0,100
147.32.110.50,10.0.2.15,708,480,0,2023-08-28T21:04:47.901665,2023-08-28T21:06:16.203839,52:54:00:12:35:02,08:00:27:82:d6:d6,6,5,3332083181,3587616127,58119,55385,0,17,0,0,100
147.32.110.50,10.0.2.15,892,1472,0,2023-08-28T20:58:17.644913,2023-08-28T21:00:26.677584,52:54:00:12:35:02,08:00:27:82:d6:d6,8,13,3166542825,3326513808,58119,55385,0,17,0,0,100
147.32.111.101,147.32.110.220,1732,2348,0,2021-04-27T00:06:16.953205,2021-04-27T00:06:22.326846,d8:58:d7:00:bc:82,28:d2:44:7c:a9:59,12,12,1040128619,2676251999,44099,46362,0,17,0,0,100
147.32.111.101,147.32.110.220,176,92,0,2021-04-27T00:06:16.952594,2021-04-27T00:06:16.953205,d8:58:d7:00:bc:82,28:d2:44:7c:a9:59,1,1,0,3832103995,44099,46362,0,17,0,0,100
147.32.111.101,147.32.110.220,17932,24804,0,2021-04-10T16:04:42.033166,2021-04-10T16:05:14.805044,d8:58:d7:00:bc:82,28:d2:44:7c:a9:59,138,142,3304217979,3848115376,44099,41993,0,17,0,0,100
147.32.111.101,147.32.110.220,3920,6300,0,2021-04-10T16:02:41.896207,2021-04-10T16:04:42.033166,d8:58:d7:00:bc:82,28:d2:44:7c:a9:59,29,44,3619843067,1791020594,44099,41993,0,17,0,0,100
147.32.111.101,147.32.110.220,5088,8220,0,2021-04-10T16:00:37.562187,2021-04-10T16:02:41.896207,d8:58:d7:00:bc:82,28:d2:44:7c:a9:59,37,52,2588969467,3580317389,44099,41993,0,17,0,0,100
ipaddr DST_IP,ipaddr SRC_IP,uint64 BYTES,uint64 BYTES_REV,uint64 LINK_BIT_FIELD,time TIME_FIRST,time TIME_LAST,macaddr DST_MAC,macaddr SRC_MAC,uint32 PACKETS,uint32 PACKETS_REV,uint32 WG_DST_PEER,uint32 WG_SRC_PEER,uint16 DST_PORT,uint16 SRC_PORT,uint8 DIR_BIT_FIELD,uint8 PROTOCOL,uint8 TCP_FLAGS,uint8 TCP_FLAGS_REV,uint8 WG_CONF_LEVEL

0 comments on commit 47a2ded

Please sign in to comment.