@@ -65,7 +65,9 @@ static int hf_ja4h = -1;
6565static int hf_ja4h_raw = -1 ;
6666static int hf_ja4h_raw_original = -1 ;
6767static int hf_ja4l = -1 ;
68+ static int hf_ja4l_delta = -1 ;
6869static int hf_ja4ls = -1 ;
70+ static int hf_ja4ls_delta = -1 ;
6971static int hf_ja4ssh = -1 ;
7072static int hf_ja4t = -1 ;
7173static int hf_ja4ts = -1 ;
@@ -282,7 +284,7 @@ proto_tree *locate_tree(proto_tree *tree, const char *s) {
282284
283285void update_tree_item (
284286 tvbuff_t * tvb , proto_tree * tree , proto_tree * * ja4_tree , int field ,
285- const char * str , const char * insert_at
287+ const void * data , const char * insert_at
286288) {
287289
288290 // We get to the right part of the tree using locate_tree and insert the
@@ -300,7 +302,12 @@ void update_tree_item(
300302 * ja4_tree = proto_item_add_subtree (ja4_ti , ett_ja4 );
301303 }
302304
303- proto_tree_add_string (* ja4_tree , field , NULL , 0 , 0 , str );
305+ enum ftenum type = proto_registrar_get_ftype (field );
306+ if (type == FT_STRING ) {
307+ proto_tree_add_string (* ja4_tree , field , NULL , 0 , 0 , (const char * )data );
308+ } else if (type == FT_DOUBLE ) {
309+ proto_tree_add_double (* ja4_tree , field , NULL , 0 , 0 , * (const double * )data );
310+ }
304311}
305312
306313void update_mode (int pkt_len , wmem_map_t * hash_table ) {
@@ -1190,6 +1197,13 @@ static int dissect_ja4(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
11901197 wmem_strbuf_finalize (display ), "tcp"
11911198 );
11921199
1200+ double delta = (double )latency2 .nsecs / (double )latency .nsecs ;
1201+ delta = round (delta * 10.0 ) / 10.0 ;
1202+ update_tree_item (
1203+ tvb , tree , & ja4_tree , hf_ja4ls_delta ,
1204+ & delta , "tcp"
1205+ );
1206+
11931207 nstime_delta (& latency , & conn -> timestamp_C , & conn -> timestamp_B );
11941208 nstime_delta (& latency2 , & conn -> timestamp_F , & conn -> timestamp_E );
11951209 wmem_strbuf_append_printf (
@@ -1200,6 +1214,13 @@ static int dissect_ja4(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
12001214 tvb , tree , & ja4_tree , hf_ja4l ,
12011215 wmem_strbuf_finalize (display2 ), "tcp"
12021216 );
1217+
1218+ double delta2 = (double )latency2 .nsecs / (double )latency .nsecs ;
1219+ delta2 = round (delta2 * 10.0 ) / 10.0 ;
1220+ update_tree_item (
1221+ tvb , tree , & ja4_tree , hf_ja4l_delta ,
1222+ & delta2 , "tcp"
1223+ );
12031224 }
12041225 }
12051226 }
@@ -1489,7 +1510,11 @@ void proto_register_ja4(void) {
14891510 {& hf_ja4h_raw_original ,
14901511 {"JA4H Raw (Original)" , "ja4.ja4h_ro" , FT_STRING , BASE_NONE , NULL , 0x0 , NULL , HFILL } },
14911512 {& hf_ja4l , {"JA4L" , "ja4.ja4l" , FT_STRING , BASE_NONE , NULL , 0x0 , NULL , HFILL } },
1513+ {& hf_ja4l_delta ,
1514+ {"JA4L Delta" , "ja4.ja4l_delta" , FT_DOUBLE , BASE_NONE , NULL , 0x0 , NULL , HFILL } },
14921515 {& hf_ja4ls , {"JA4LS" , "ja4.ja4ls" , FT_STRING , BASE_NONE , NULL , 0x0 , NULL , HFILL } },
1516+ {& hf_ja4ls_delta ,
1517+ {"JA4LS Delta" , "ja4.ja4ls_delta" , FT_DOUBLE , BASE_NONE , NULL , 0x0 , NULL , HFILL } },
14931518 {& hf_ja4ssh , {"JA4SSH" , "ja4.ja4ssh" , FT_STRING , BASE_NONE , NULL , 0x0 , NULL , HFILL } },
14941519 {& hf_ja4t , {"JA4T" , "ja4.ja4t" , FT_STRING , BASE_NONE , NULL , 0x0 , NULL , HFILL } },
14951520 {& hf_ja4ts , {"JA4T-S" , "ja4.ja4ts" , FT_STRING , BASE_NONE , NULL , 0x0 , NULL , HFILL } },
0 commit comments