Wireshark-dev: [Wireshark-dev] Re: [PATCH] BGP: fix check of length of labeled prefix
From: Vitaliy Guschin <guschin108@xxxxxxxxx>
Date: Mon, 29 Jul 2024 04:07:57 +0700
Hi, The previous message was not sent as plain text, so the patch is distorted. Send again. From 56db108410981663f942f904bf66f121617747bb Mon Sep 17 00:00:00 2001 From: Vitaliy Guschin <guschin108@xxxxxxxxx> Date: Sun, 28 Jul 2024 04:43:05 +0700 Subject: [PATCH] BGP: fix check of length of labeled prefix Fixed display of default route for SAFI 4. The problem was in incorrect checking of the prefix length. The default route prefix length for this SAFI is 24 bits. This value was invalid. This was fixed for the SAFI 128, 129, 130. Also, RD accounting has been added to the prefix length check. --- epan/dissectors/packet-bgp.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/epan/dissectors/packet-bgp.c b/epan/dissectors/packet-bgp.c index 980a82ae74..7ac475afaf 100644 --- a/epan/dissectors/packet-bgp.c +++ b/epan/dissectors/packet-bgp.c@@ -7445,7 +7445,7 @@ decode_prefix_MP(proto_tree *tree, int hf_path_id, int hf_addr4, int hf_addr6,
labnum = decode_MPLS_stack(tvb, offset + 1, stack_strbuf); offset += (1 + labnum * 3); - if (plen <= (labnum * 3*8)) { + if (plen < (labnum * 3*8)) {proto_tree_add_expert_format(tree, pinfo, &ei_bgp_prefix_length_invalid, tvb, start_offset, 1, "%s Labeled IPv4 prefix length %u invalid",
tag, plen);@@ -7603,7 +7603,7 @@ decode_prefix_MP(proto_tree *tree, int hf_path_id, int hf_addr4, int hf_addr6,
labnum = decode_MPLS_stack(tvb, offset + 1, stack_strbuf); offset += (1 + labnum * 3); - if (plen <= (labnum * 3*8)) { + if (plen < (labnum * 3*8 + 8*8)) {proto_tree_add_expert_format(tree, pinfo, &ei_bgp_prefix_length_invalid, tvb, start_offset, 1, "%s Labeled VPN IPv4 prefix length %u invalid",
tag, plen);@@ -7693,7 +7693,7 @@ decode_prefix_MP(proto_tree *tree, int hf_path_id, int hf_addr4, int hf_addr6,
labnum = decode_MPLS_stack(tvb, offset + 1, stack_strbuf); offset += (1 + labnum * 3); - if (plen <= (labnum * 3*8)) { + if (plen < (labnum * 3*8)) {proto_tree_add_expert_format(tree, pinfo, &ei_bgp_prefix_length_invalid, tvb, start_offset, 1, "%s Labeled IPv6 prefix length %u invalid", tag, plen);
return -1;@@ -7802,7 +7802,7 @@ decode_prefix_MP(proto_tree *tree, int hf_path_id, int hf_addr4, int hf_addr6,
labnum = decode_MPLS_stack(tvb, offset + 1, stack_strbuf); offset += (1 + labnum * 3); - if (plen <= (labnum * 3*8)) { + if (plen < (labnum * 3*8 + 8*8)) {proto_tree_add_expert_format(tree, pinfo, &ei_bgp_prefix_length_invalid, tvb, start_offset, 1, "%s Labeled VPN IPv6 prefix length %u invalid", tag, plen);
return -1; -- 2.45.2 Best regards, Vitaliy.
- Prev by Date: [Wireshark-dev] Alternative way to share edits in code
- Next by Date: [Wireshark-dev] Wiki editor permission request
- Previous by thread: [Wireshark-dev] Alternative way to share edits in code
- Next by thread: [Wireshark-dev] Wiki editor permission request
- Index(es):