From a749da243340cdd11233a93bcf15b228453f750a Mon Sep 17 00:00:00 2001 From: Thomas Chevalier Date: Wed, 22 Jun 2022 16:10:21 +0200 Subject: [PATCH] Add icmp id everywhere --- pgsql-schema.sql | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/pgsql-schema.sql b/pgsql-schema.sql index 956ab38..df7fbf1 100644 --- a/pgsql-schema.sql +++ b/pgsql-schema.sql @@ -29,6 +29,7 @@ CREATE TABLE IF NOT EXISTS ct_logs ( reply_raw_pktcount bigint default 0, icmp_code smallint default NULL, icmp_type smallint default NULL, + icmp_id smallint default NULL, ct_mark bigint default 0, flow_start timestamp default NULL, flow_end timestamp default NULL, @@ -143,6 +144,7 @@ CREATE OR REPLACE VIEW view_log AS reply_raw_pktcount as reply_pktcount, icmp_code, icmp_type, + icmp_id, ct_event, event_name FROM ct_logs @@ -174,6 +176,7 @@ CREATE OR REPLACE FUNCTION INSERT_CT( IN _reply_raw_pktcount bigint, IN _icmp_code integer, IN _icmp_type integer, + IN _icmp_id integer, IN _ct_mark bigint, IN _flow_start_sec bigint, IN _flow_start_usec bigint, @@ -190,10 +193,10 @@ BEGIN reply_l4_sport, reply_l4_dport, reply_raw_pktlen, reply_raw_pktcount, icmp_code, icmp_type, ct_mark, flow_start, flow_end, ct_event) - VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19, - to_timestamp($20) + $21 * interval '1 microsecond', - to_timestamp($22) + $23 * interval '1 microsecond', - $24); + VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20, + to_timestamp($21) + $22 * interval '1 microsecond', + to_timestamp($23) + $24 * interval '1 microsecond', + $25); _id = $1; RETURN _id; END @@ -218,6 +221,7 @@ CREATE OR REPLACE FUNCTION INSERT_OR_REPLACE_CT( IN _reply_raw_pktcount bigint, IN _icmp_code integer, IN _icmp_type integer, + IN _icmp_id integer, IN _ct_mark bigint, IN _flow_start_sec bigint, IN _flow_start_usec bigint, @@ -255,7 +259,7 @@ BEGIN AND ct_event < 4; END IF; ELSE - _id := INSERT_CT($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23,$24); + _id := INSERT_CT($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23,$24,$25); END IF; RETURN _id; END