Skip to content

Commit 107401e

Browse files
committed
Adjust WG plugin
1 parent 80cfca3 commit 107401e

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

process/wg.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,32 +70,34 @@ ProcessPlugin *WGPlugin::copy()
7070
return new WGPlugin(*this);
7171
}
7272

73-
int WGPlugin::post_create(Flow &rec, const Packet &pkt)
73+
ProcessPlugin::FlowAction WGPlugin::post_create(Flow &rec, const Packet &pkt)
7474
{
7575
if (pkt.ip_proto == IPPROTO_UDP) {
7676
add_ext_wg(reinterpret_cast<const char *>(pkt.payload), pkt.payload_len, pkt.source_pkt, rec);
77+
return ProcessPlugin::FlowAction::GET_ALL_DATA;
7778
}
7879

79-
return 0;
80+
return ProcessPlugin::FlowAction::NO_PROCESS;
8081
}
8182

82-
int WGPlugin::pre_update(Flow &rec, Packet &pkt)
83+
ProcessPlugin::FlowAction WGPlugin::pre_update(Flow &rec, Packet &pkt)
8384
{
8485
RecordExtWG *vpn_data = (RecordExtWG *) rec.get_extension(RecordExtWG::REGISTERED_ID);
8586
if (vpn_data != nullptr && vpn_data->possible_wg) {
8687
bool res = parse_wg(reinterpret_cast<const char *>(pkt.payload), pkt.payload_len, pkt.source_pkt, vpn_data);
8788
// In case of new flow, flush
8889
if (flow_flush) {
8990
flow_flush = false;
90-
return FLOW_FLUSH_WITH_REINSERT;
91+
return ProcessPlugin::FlowAction::FLUSH_WITH_REINSERT;
9192
}
9293
// In other cases, when WG was not detected
9394
if (!res) {
9495
vpn_data->possible_wg = 0;
96+
return ProcessPlugin::FlowAction::NO_PROCESS;
9597
}
98+
return ProcessPlugin::FlowAction::GET_ALL_DATA;
9699
}
97-
98-
return 0;
100+
return ProcessPlugin::FlowAction::NO_PROCESS;
99101
}
100102

101103
void WGPlugin::pre_export(Flow &rec)

process/wg.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,8 @@ class WGPlugin : public ProcessPlugin
158158
RecordExt *get_ext() const { return new RecordExtWG(); }
159159
ProcessPlugin *copy();
160160

161-
int post_create(Flow &rec, const Packet &pkt);
162-
int pre_update(Flow &rec, Packet &pkt);
161+
ProcessPlugin::FlowAction post_create(Flow &rec, const Packet &pkt);
162+
ProcessPlugin::FlowAction pre_update(Flow &rec, Packet &pkt);
163163
void pre_export(Flow &rec);
164164
void finish(bool print_stats);
165165

0 commit comments

Comments
 (0)