Skip to content

Commit 2a131ff

Browse files
authored
Merge pull request #149 from CESNET/ssadetector_plugin
SSADetector: Bugfix, improved memory consumption
2 parents 6a609ff + b236c4e commit 2a131ff

File tree

3 files changed

+20
-11
lines changed

3 files changed

+20
-11
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -590,6 +590,15 @@ List of fields exported together with basic flow fields on interface by quic plu
590590
|:------------------:|:------:|:-------------------------------:|
591591
| QUIC_SNI | string | Decrypted server name |
592592

593+
### SSADetector
594+
595+
List of fields exported together with basic flow fields on interface by ssadetector plugin.
596+
The detector search for the SYN SYN-ACK ACK pattern in packet lengths. Multiple occurrences of this pattern suggest a tunneled connection.
597+
598+
| Output field | Type | Description |
599+
|:------------------:|:------:|:---------------------------------------:|
600+
| SSA_CONF_LEVEL | uint8 | 1 if SSA sequence detected, 0 otherwise |
601+
593602
## Simplified function diagram
594603
Diagram below shows how `ipfixprobe` works.
595604

process/ssadetector.cpp

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -133,19 +133,20 @@ void SSADetectorPlugin::update_record(RecordExtSSADetector* record, const Packet
133133
transition_from_init(record, len, ts, dir);
134134
}
135135

136-
int SSADetectorPlugin::post_create(Flow& rec, const Packet& pkt)
137-
{
138-
RecordExtSSADetector* record = new RecordExtSSADetector();
139-
rec.add_extension(record);
140-
141-
update_record(record, pkt);
142-
return 0;
143-
}
144136

145137
int SSADetectorPlugin::post_update(Flow& rec, const Packet& pkt)
146138
{
147-
RecordExtSSADetector* record
148-
= (RecordExtSSADetector*) rec.get_extension(RecordExtSSADetector::REGISTERED_ID);
139+
RecordExtSSADetector *record = nullptr;
140+
if (rec.src_packets + rec.dst_packets < MIN_PKT_IN_FLOW) {
141+
return 0;
142+
}
143+
144+
record = (RecordExtSSADetector *) rec.get_extension(RecordExtSSADetector::REGISTERED_ID);
145+
if (record == nullptr) {
146+
record = new RecordExtSSADetector();
147+
rec.add_extension(record);
148+
}
149+
149150
update_record(record, pkt);
150151
return 0;
151152
}

process/ssadetector.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,6 @@ class SSADetectorPlugin : public ProcessPlugin {
189189
RecordExt* get_ext() const { return new RecordExtSSADetector(); }
190190
ProcessPlugin* copy();
191191

192-
int post_create(Flow& rec, const Packet& pkt);
193192
int post_update(Flow& rec, const Packet& pkt);
194193
void pre_export(Flow& rec);
195194
void update_record(RecordExtSSADetector* record, const Packet& pkt);

0 commit comments

Comments
 (0)