Flag invalid markers.

Change-Id: I8d99fa2b46ffb96100ea0e47273761d9c47e14cb
Reviewed-on: https://code.wireshark.org/review/29831
Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
Guy Harris 2018-09-25 11:57:09 -07:00
parent 4ea91f2aee
commit 42c9bee36f
1 changed files with 12 additions and 1 deletions

View File

@ -2079,6 +2079,7 @@ static gint ett_bgp_prefix_sid_originator_srgb_blocks = -1;
static gint ett_bgp_prefix_sid_label_index = -1;
static gint ett_bgp_prefix_sid_ipv6 = -1;
static expert_field ei_bgp_marker_invalid = EI_INIT;
static expert_field ei_bgp_cap_len_bad = EI_INIT;
static expert_field ei_bgp_cap_gr_helper_mode_only = EI_INIT;
static expert_field ei_bgp_notify_minor_unknown = EI_INIT;
@ -8015,8 +8016,13 @@ dissect_bgp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
guint16 bgp_len; /* Message length */
guint8 bgp_type; /* Message type */
const char *typ; /* Message type (string) */
proto_item *ti_marker = NULL;/* marker item */
proto_item *ti_len = NULL; /* length item */
proto_tree *bgp_tree = NULL; /* BGP packet tree */
static const guint8 valid_marker[BGP_MARKER_SIZE] = {
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
};
bgp_len = tvb_get_ntohs(tvb, BGP_MARKER_SIZE);
bgp_type = tvb_get_guint8(tvb, BGP_MARKER_SIZE + 2);
@ -8058,7 +8064,11 @@ dissect_bgp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break;
}
proto_tree_add_item(bgp_tree, hf_bgp_marker, tvb, 0, 16, ENC_NA);
ti_marker = proto_tree_add_item(bgp_tree, hf_bgp_marker, tvb, 0,
BGP_MARKER_SIZE, ENC_NA);
if (tvb_memeql(tvb, 0, valid_marker, BGP_MARKER_SIZE) != 0) {
expert_add_info(pinfo, ti_marker, &ei_bgp_marker_invalid);
}
ti_len = proto_tree_add_item(bgp_tree, hf_bgp_length, tvb, 16, 2, ENC_BIG_ENDIAN);
}
@ -10015,6 +10025,7 @@ proto_register_bgp(void)
&ett_bgp_prefix_sid_originator_srgb_blocks,
};
static ei_register_info ei[] = {
{ &ei_bgp_marker_invalid, { "bgp.marker_invalid", PI_MALFORMED, PI_ERROR, "Marker is not all ones", EXPFILL }},
{ &ei_bgp_cap_len_bad, { "bgp.cap.length.bad", PI_MALFORMED, PI_ERROR, "Capability length is wrong", EXPFILL }},
{ &ei_bgp_cap_gr_helper_mode_only, { "bgp.cap.gr.helper_mode_only", PI_REQUEST_CODE, PI_CHAT, "Graceful Restart Capability supported in Helper mode only", EXPFILL }},
{ &ei_bgp_notify_minor_unknown, { "bgp.notify.minor_error.unknown", PI_UNDECODED, PI_NOTE, "Unknown notification error", EXPFILL }},