aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaime Caamaño Ruiz <jcaamano@suse.com>2018-04-11 13:29:52 +0200
committerAnders Broman <a.broman58@gmail.com>2018-04-15 05:36:26 +0000
commitb2c971d9ce911c2835b7c7fd37005cad3fe6d7a6 (patch)
treef24a0f08944c8838025c821e3e9ebc1ac0a2efa8
parent82e8aa33a7812e8917d8e9187e0be4d2333b43b0 (diff)
openflow: fix decode of experimenter OXM fields
No longer report decoded experimenter values as undecoded which was causing incorrect offset handling. Change-Id: If902f8c8c5b53b8062e88229d67728bb67557062 Signed-off-by: Jaime Caamaño Ruiz <jcaamano@suse.com> Reviewed-on: https://code.wireshark.org/review/26888 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
-rw-r--r--epan/dissectors/packet-openflow_v4.c19
-rw-r--r--epan/dissectors/packet-openflow_v5.c16
-rw-r--r--epan/dissectors/packet-openflow_v6.c16
3 files changed, 18 insertions, 33 deletions
diff --git a/epan/dissectors/packet-openflow_v4.c b/epan/dissectors/packet-openflow_v4.c
index ce914d4..83ac7e4 100644
--- a/epan/dissectors/packet-openflow_v4.c
+++ b/epan/dissectors/packet-openflow_v4.c
@@ -901,7 +901,6 @@ static int
dissect_openflow_oxm_header_v4(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, guint16 length _U_)
{
guint16 oxm_class;
- guint8 oxm_length;
/* oxm_class */
oxm_class = tvb_get_ntohs(tvb, offset);
@@ -920,18 +919,9 @@ dissect_openflow_oxm_header_v4(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree
offset+=1;
/* oxm_length */
- oxm_length = tvb_get_guint8(tvb, offset);
proto_tree_add_item(tree, hf_openflow_v4_oxm_length, tvb, offset, 1, ENC_BIG_ENDIAN);
offset+=1;
- if (oxm_class == OFPXMC_EXPERIMENTER) {
- /* uint32_t experimenter; */
- proto_tree_add_item(tree, hf_openflow_v4_oxm_experimenter_experimenter, tvb, offset, 4, ENC_BIG_ENDIAN);
- offset+=4;
- proto_tree_add_item(tree, hf_openflow_v4_oxm_experimenter_value, tvb, offset, oxm_length - 4, ENC_NA);
- offset+=(oxm_length - 4);
- }
-
return offset;
}
@@ -1068,10 +1058,13 @@ dissect_openflow_oxm_v4(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
offset = oxm_end;
}
+ } else if (oxm_class == OFPXMC_EXPERIMENTER) {
+ /* uint32_t experimenter; */
+ proto_tree_add_item(oxm_tree, hf_openflow_v4_oxm_experimenter_experimenter, tvb, offset, 4, ENC_BIG_ENDIAN);
+ offset+=4;
+ proto_tree_add_item(oxm_tree, hf_openflow_v4_oxm_experimenter_value, tvb, offset, oxm_length - 4, ENC_NA);
+ offset+=(oxm_length - 4);
} else {
- if (oxm_class == OFPXMC_EXPERIMENTER) {
- oxm_length -= 4; /* oxm_length includes experimenter field */
- }
proto_tree_add_expert_format(oxm_tree, pinfo, &ei_openflow_v4_oxm_undecoded,
tvb, offset, oxm_length, "Unknown OXM body.");
offset+=oxm_length;
diff --git a/epan/dissectors/packet-openflow_v5.c b/epan/dissectors/packet-openflow_v5.c
index ed923e6..0033c21 100644
--- a/epan/dissectors/packet-openflow_v5.c
+++ b/epan/dissectors/packet-openflow_v5.c
@@ -1078,7 +1078,6 @@ static int
dissect_openflow_oxm_header_v5(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, guint16 length _U_)
{
guint16 oxm_class;
- guint8 oxm_length;
/* oxm_class */
oxm_class = tvb_get_ntohs(tvb, offset);
@@ -1097,18 +1096,9 @@ dissect_openflow_oxm_header_v5(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree
offset+=1;
/* oxm_length */
- oxm_length = tvb_get_guint8(tvb, offset);
proto_tree_add_item(tree, hf_openflow_v5_oxm_length, tvb, offset, 1, ENC_BIG_ENDIAN);
offset+=1;
- if (oxm_class == OFPXMC_EXPERIMENTER) {
- /* uint32_t experimenter; */
- proto_tree_add_item(tree, hf_openflow_v5_oxm_experimenter_experimenter, tvb, offset, 4, ENC_BIG_ENDIAN);
- offset+=4;
- proto_tree_add_item(tree, hf_openflow_v5_oxm_experimenter_value, tvb, offset, oxm_length - 4, ENC_NA);
- offset+=(oxm_length - 4);
- }
-
return offset;
}
@@ -1245,6 +1235,12 @@ dissect_openflow_oxm_v5(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
offset = oxm_end;
}
+ } else if (oxm_class == OFPXMC_EXPERIMENTER) {
+ /* uint32_t experimenter; */
+ proto_tree_add_item(oxm_tree, hf_openflow_v5_oxm_experimenter_experimenter, tvb, offset, 4, ENC_BIG_ENDIAN);
+ offset+=4;
+ proto_tree_add_item(oxm_tree, hf_openflow_v5_oxm_experimenter_value, tvb, offset, oxm_length - 4, ENC_NA);
+ offset+=(oxm_length - 4);
} else {
proto_tree_add_expert_format(oxm_tree, pinfo, &ei_openflow_v5_oxm_undecoded,
tvb, offset, oxm_length, "Unknown OXM body.");
diff --git a/epan/dissectors/packet-openflow_v6.c b/epan/dissectors/packet-openflow_v6.c
index a7be077..3ea3a40 100644
--- a/epan/dissectors/packet-openflow_v6.c
+++ b/epan/dissectors/packet-openflow_v6.c
@@ -1104,7 +1104,6 @@ static int
dissect_openflow_oxm_header_v6(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, guint16 length _U_)
{
guint16 oxm_class;
- guint8 oxm_length;
/* oxm_class */
oxm_class = tvb_get_ntohs(tvb, offset);
@@ -1123,18 +1122,9 @@ dissect_openflow_oxm_header_v6(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree
offset+=1;
/* oxm_length */
- oxm_length = tvb_get_guint8(tvb, offset);
proto_tree_add_item(tree, hf_openflow_v6_oxm_length, tvb, offset, 1, ENC_BIG_ENDIAN);
offset+=1;
- if (oxm_class == OFPXMC_EXPERIMENTER) {
- /* uint32_t experimenter; */
- proto_tree_add_item(tree, hf_openflow_v6_oxm_experimenter_experimenter, tvb, offset, 4, ENC_BIG_ENDIAN);
- offset+=4;
- proto_tree_add_item(tree, hf_openflow_v6_oxm_experimenter_value, tvb, offset, oxm_length - 4, ENC_NA);
- offset+=(oxm_length - 4);
- }
-
return offset;
}
@@ -1271,6 +1261,12 @@ dissect_openflow_oxm_v6(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
offset = oxm_end;
}
+ } else if (oxm_class == OFPXMC_EXPERIMENTER) {
+ /* uint32_t experimenter; */
+ proto_tree_add_item(oxm_tree, hf_openflow_v6_oxm_experimenter_experimenter, tvb, offset, 4, ENC_BIG_ENDIAN);
+ offset+=4;
+ proto_tree_add_item(oxm_tree, hf_openflow_v6_oxm_experimenter_value, tvb, offset, oxm_length - 4, ENC_NA);
+ offset+=(oxm_length - 4);
} else {
proto_tree_add_expert_format(oxm_tree, pinfo, &ei_openflow_v6_oxm_undecoded,
tvb, offset, oxm_length, "Unknown OXM body.");