diff options
author | Alexis La Goutte <alexis.lagoutte@gmail.com> | 2014-08-02 12:00:59 +0200 |
---|---|---|
committer | Evan Huus <eapache@gmail.com> | 2014-08-03 12:52:31 +0000 |
commit | 0b23e0f91f1b3cce68dd2ff19058f41b0d93a7d4 (patch) | |
tree | e53dccbd71b92d42feb02b7b49e0e6357f58f282 /epan/dissectors/packet-http2.c | |
parent | 7df03a7c3ec4c89a3f623d00f828bc66ce120ddc (diff) |
HTTP2: Add a preference to enable/disable HTTP2 (weak) heuristics
By default, the heuristic is disabled
Change-Id: I26ef23e8b153576a4fabd2e3324e830756e64bb7
Ping-Bug:10335
Ping-Bug:10310
Reviewed-on: https://code.wireshark.org/review/3350
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Reviewed-by: Evan Huus <eapache@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-http2.c')
-rw-r--r-- | epan/dissectors/packet-http2.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/epan/dissectors/packet-http2.c b/epan/dissectors/packet-http2.c index d2771c6b93..260110b1b3 100644 --- a/epan/dissectors/packet-http2.c +++ b/epan/dissectors/packet-http2.c @@ -97,6 +97,11 @@ typedef struct { void proto_register_http2(void); void proto_reg_handoff_http2(void); + +/* Heuristic dissection */ +static gboolean global_http2_heur = FALSE; + + /* Packet Header */ static int proto_http2 = -1; static int hf_http2 = -1; @@ -1143,6 +1148,16 @@ dissect_http2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, static gboolean dissect_http2_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) { + + /* It is not easy to write a good http2 heuristic, + this heuristic is disabled by default + */ + + if (!global_http2_heur) + { + return FALSE; + } + if (tvb_memeql(tvb, 0, kMagicHello, MAGIC_FRAME_LENGTH) != 0) { /* we couldn't find the Magic Hello (PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n) see if there's a valid frame type (0-11 are defined at the moment) */ @@ -1537,11 +1552,20 @@ proto_register_http2(void) &ett_http2_settings }; + module_t *http2_module; + proto_http2 = proto_register_protocol("HyperText Transfer Protocol 2", "HTTP2", "http2"); proto_register_field_array(proto_http2, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + http2_module = prefs_register_protocol(proto_http2, NULL); + + prefs_register_bool_preference(http2_module, "heuristic_http2", + "Enable HTTP2 heuristic (disabled by default)", + "The HTTP2 heuristic is weak and there are some false positives", + &global_http2_heur); + new_register_dissector("http2", dissect_http2, proto_http2); } |