diff options
author | Martin Mathieson <martin.mathieson@keysight.com> | 2020-07-05 16:56:53 +0100 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2020-07-06 10:42:20 +0000 |
commit | 77d4112bb171cf29127bb0c9109206bf1a25d9e4 (patch) | |
tree | f8ac982857b1e789ed0fdbc5fed3fa15c07a57b7 | |
parent | df5cc85a79d2870baf37a1e47616afba0123fd6f (diff) |
DVB-S2-BB: For GSE Protocol Type, separate Next-Header and Ethertype subtypes.
For Ethertype, use etype_vals (don't know how likely types not named as
examples in specs are likely to be seen).
Fixes warnings from previous range_string that tried to cover both types, but
where "not implemented" catch-all ranges preceded and hid individual types.
** (process:24396): WARNING **: 21:24:48.760: value_range_string error: Protocol (dvb-s2_gse.proto) hidden by earlier entry (prev="not implemented": 0 0x0 -> 255 0xff) (this="NCR": 129 0x81 -> 129 0x81)
** (process:24396): WARNING **: 21:24:48.760: value_range_string error: Protocol (dvb-s2_gse.proto) hidden by earlier entry (prev="not implemented": 0 0x0 -> 255 0xff) (this="Signaling Table": 130 0x82 -> 130 0x82)
** (process:24396): WARNING **: 21:24:48.760: value_range_string error: Protocol (dvb-s2_gse.proto) hidden by earlier entry (prev="not implemented": 2049 0x801 -> 34524 0x86dc) (this="VLAN": 33024 0x8100 -> 33024 0x8100)
Tested with dvb-s2_bb_example.pcap (where the only Protocol Type value set is for IPv4).
Change-Id: I7c8d8669c3f3e76974db8472783284975e063c12
Reviewed-on: https://code.wireshark.org/review/37711
Petri-Dish: Martin Mathieson <martin.r.mathieson@googlemail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
-rw-r--r-- | epan/dissectors/packet-dvb-s2-bb.c | 41 |
1 files changed, 25 insertions, 16 deletions
diff --git a/epan/dissectors/packet-dvb-s2-bb.c b/epan/dissectors/packet-dvb-s2-bb.c index 9cb626d451..797fd3e162 100644 --- a/epan/dissectors/packet-dvb-s2-bb.c +++ b/epan/dissectors/packet-dvb-s2-bb.c @@ -140,6 +140,7 @@ static int hf_dvb_s2_gse_hdr_labeltype = -1; static int hf_dvb_s2_gse_hdr_length = -1; static int hf_dvb_s2_gse_padding = -1; static int hf_dvb_s2_gse_proto = -1; +static int hf_dvb_s2_gse_proto_ethertype = -1; static int hf_dvb_s2_gse_label6 = -1; static int hf_dvb_s2_gse_label3 = -1; static int hf_dvb_s2_gse_fragid = -1; @@ -866,18 +867,10 @@ static const value_string gse_labeltype[] = { #define DVB_RCS2_NCR 0x0081 #define DVB_RCS2_SIGNAL_TABLE 0x0082 -static const range_string gse_proto_str[] = { - {0x0000 , 0x00FF , "not implemented"}, - {DVB_RCS2_NCR , DVB_RCS2_NCR , "NCR" }, - {DVB_RCS2_SIGNAL_TABLE, DVB_RCS2_SIGNAL_TABLE, "Signaling Table"}, - {0x0100 , 0x05FF , "not implemented"}, - {0x0600 , 0x07FF , "not implemented"}, - {ETHERTYPE_IP , ETHERTYPE_IP , "IPv4 Payload" }, - {0x0801 , 0x86DC , "not implemented"}, - {ETHERTYPE_IPv6 , ETHERTYPE_IPv6 , "IPv6 Payload" }, - {ETHERTYPE_VLAN , ETHERTYPE_VLAN , "VLAN" }, - {0x86DE , 0xFFFF , "not implemented"}, - {0 , 0 , NULL } +static const value_string gse_proto_str[] = { + {DVB_RCS2_NCR, "NCR" }, + {DVB_RCS2_SIGNAL_TABLE, "Signaling Table"}, + {0, NULL} }; #define DVB_S2_GSE_CRC32_LEN 4 @@ -964,8 +957,15 @@ static int dissect_dvb_s2_gse(tvbuff_t *tvb, int cur_off, proto_tree *tree, pack /* Start packet, decode the header */ gse_proto = tvb_get_ntohs(tvb, cur_off + new_off); - proto_tree_add_item(dvb_s2_gse_tree, hf_dvb_s2_gse_proto, tvb, cur_off + new_off, 2, ENC_BIG_ENDIAN); - + /* Protocol Type */ + if (gse_proto <= 1535) { + /* Type 1 (Next-Header Type field) */ + proto_tree_add_item(dvb_s2_gse_tree, hf_dvb_s2_gse_proto, tvb, cur_off + new_off, 2, ENC_BIG_ENDIAN); + } + else { + /* Type 2 (EtherType compatible Type Fields) */ + proto_tree_add_item(dvb_s2_gse_tree, hf_dvb_s2_gse_proto_ethertype, tvb, cur_off + new_off, 2, ENC_BIG_ENDIAN); + } new_off += 2; if (BIT_IS_CLEAR(gse_hdr, DVB_S2_GSE_HDR_LABELTYPE_POS1) && BIT_IS_CLEAR(gse_hdr, DVB_S2_GSE_HDR_LABELTYPE_POS2)) { @@ -1079,9 +1079,13 @@ static int dissect_dvb_s2_gse(tvbuff_t *tvb, int cur_off, proto_tree *tree, pack new_off += data_len; dissected = TRUE; break; + + default: + /* Not handled! TODO: expert info? */ + break; } - if (dissected == FALSE) { + if (!dissected) { proto_tree_add_item(dvb_s2_gse_tree, hf_dvb_s2_gse_data, tvb, cur_off + new_off, data_len, ENC_NA); new_off += data_len; } @@ -1589,7 +1593,12 @@ void proto_register_dvb_s2_modeadapt(void) }, {&hf_dvb_s2_gse_proto, { "Protocol", "dvb-s2_gse.proto", - FT_UINT16, BASE_HEX | BASE_RANGE_STRING, RVALS(gse_proto_str), 0x0, + FT_UINT16, BASE_HEX, VALS(gse_proto_str), 0x0, + "Protocol Type", HFILL} + }, + {&hf_dvb_s2_gse_proto_ethertype, { + "Protocol", "dvb-s2_gse.proto", + FT_UINT16, BASE_HEX, VALS(etype_vals), 0x0, "Protocol Type", HFILL} }, {&hf_dvb_s2_gse_label6, { |