Bug #4537
openflowadm show-flowprop shows possible values of properties incorrectly
0%
Description
The output of 'flowadm show-flowprop' command shows '?' as the possible value of property, if value for the property has not been set.
For e.g., consider flow 'testflow', values for whose properties have not been set, and flow 'https-1', values for whose properties have been set.
shruti@justforkix:~$ flowadm show-flowprop FLOW PROPERTY VALUE DEFAULT POSSIBLE testflow maxbw -- -- ? testflow priority -- -- ? https-1 maxbw 500 -- 500 https-1 priority high -- high
From the man page of flowadm -
POSSIBLE A comma-separated list of the values the property can have. If the values span a numeric range, the minimum and maximum values might be shown as short- hand. If the possible values are unknown or unbounded, -- (double hyphen), is shown.
Updated by Peter Tribble about 3 years ago
- Subject changed from 'flowadm show-flowprop' command output shows possible values of property as '?' if not set to flowadm show-flowprop shows possible values of properties incorrectly
What's actually happening is that flowadm is showing the actual value set for the property, rather than the range of possible values. You can see that for the https-1 flow here. If the value is unset, then it gets printed as a '?'.
The reason for that mistake is a little convoluted.
First, the relevant function dladm_get_flowprop() in libdladm doesn't even have any code to handle the DEFAULT or POSSIBLE case at all. It falls through to the current value.
Second, the DLADM_PROP_VAL_* macros are actually defined in two places. As part of the enum dladm_prop_type_t in libdllink.h, and as part of the enum prop_type_t in libdlflow_impl.h. Unfortunately, the enums are actually different. While flowadm uses the version in libdllink.h, when it gets to dladm_get_flowprop() that uses the other version from libdllink.h. As the values of the macros are different, things just don't match up.
Updated by Peter Tribble about 3 years ago
The other place that uses dladm_get_flowprop() to get the list of possible values is the error message if you try and set an incorrect value. For example:
If the property value is unset, you get:
flowadm set-flowprop -p priority=footle znic0flow
flowadm: warning: footle is an invalid value for flow property priority
If the property value is set (eg to medium), you just get it back:
lowadm set-flowprop -p priority=footle limit-udp-1
flowadm: warning: flow property 'priority' must be one of: medium