Comment # 9
on bug 8691
from Alexis La Goutte
Hi Matt,
Some example :
+ proto_tree_add_boolean(op_value_tree,
hf_bgp_flowspec_nlri_tcp_flags_cwr, tvb, offset+cursor_op_val, 1, tcpflags);
+ proto_tree_add_boolean(op_value_tree,
hf_bgp_flowspec_nlri_tcp_flags_ecn, tvb, offset+cursor_op_val, 1, tcpflags);
+ proto_tree_add_boolean(op_value_tree,
hf_bgp_flowspec_nlri_tcp_flags_urg, tvb, offset+cursor_op_val, 1, tcpflags);
+ proto_tree_add_boolean(op_value_tree,
hf_bgp_flowspec_nlri_tcp_flags_ack, tvb, offset+cursor_op_val, 1, tcpflags);
Must be replace by proto_tree_add_item
Also this code :
+ proto_tree_add_boolean(op_value_tree, hf_bgp_flowspec_nlri_op_eol,
tvb,offset+cursor_op_val, 1,operator);
+ proto_tree_add_boolean(op_value_tree, hf_bgp_flowspec_nlri_op_and,
tvb,offset+cursor_op_val, 1,operator);
+ proto_tree_add_text(op_value_tree, tvb, offset+cursor_op_val, 1,
"Value length: %u (1 << %u)",value_len,shift_amount);
+ proto_tree_add_boolean(op_value_tree, hf_bgp_flowspec_nlri_op_flg_not,
tvb,offset+cursor_op_val, 1,operator);
+ proto_tree_add_boolean(op_value_tree,
hf_bgp_flowspec_nlri_op_flg_match, tvb,offset+cursor_op_val, 1,operator);
is duplicate.
It is not possible to make a function to decode the op ? and return the length
(and also replace by proto_tree_add_item)
+ if (value_len == 1) {
+ proto_tree_add_text(op_value_tree, tvb, offset+cursor_op_val,
+ value_len, "%s : %u",tag,tvb_get_guint8(tvb,
offset+cursor_op_val));
+ }
+ else {
+ proto_tree_add_text(op_value_tree, tvb, offset+cursor_op_val,
+ value_len, "%s : %u",tag,tvb_get_ntohs(tvb,
offset+cursor_op_val));
+ }
you should use hf with FT_UINTXX and specify the length in proto_tree_add_item
function (4eme arg)
+ proto_tree_add_text(op_value_tree, tvb, offset+cursor_op_val,
+ value_len, "%s : 0x%02x
%s",tag,dscp_value,val_to_str_ext_const(dscp_value,&dscp_vals_ext, "Unknown
DSCP"));
+ /*proto_tree_add_item(op_value_tree, hf_bgp_flowspec_nlri_dscp, tvb,
offset+cursor_op_val, 1, ENC_NA);*/
there is a problem with hf (proto_tree_add_item function) ?
+ proto_tree_add_text(nlri_tree, tvb, offset+cursor_fspec,
+ 1,"Type destination prefix filter");
[...]
+ proto_tree_add_text(nlri_tree, tvb, offset+cursor_fspec,
+ 1,"Type source prefix filter");
Look the dev guide about value_string (for create a table with all type)