Skip to content

wrong interpretation of bitmaps in spec? #41

@etnt

Description

@etnt

Hi,

I suspect that there is a wrong interpretation of some bitmaps,
For example, look at the 1.2 spec, A.3.5.4 Table Statistics:

/* Body of reply to OFPST_TABLE request. */
struct ofp_table_stats {
    ...   
    uint64_t match; /* Bitmap of (1 << OFPXMT_*) that indicate the
                               fields the table can match on. */
    ....
    uint32_t instructions; /* Bitmap of OFPIT_* values supported. */
    ....

The match field consists of enums which start on zero, hence the left-shift.
This works ok:

> ofp_utils:binary_to_flags(ofp_v3_enum, oxm_ofb_match_fields,<<0,0,0,0,0,0,0,1>>).
[in_port]

However, the instructions field consists of enums which start on one, hence no left-shift.
Now this I belive is implemented wrong in of_protocol:

> ofp_utils:binary_to_flags(ofp_v3_enum, instruction_type, <<0,0,0,2#10>>).
[goto_table]

Really, 'goto_table' should be represented as:

<<0,0,0,2#1>>

or ?

But that results in:

> ofp_utils:binary_to_flags(ofp_v3_enum, instruction_type, <<0,0,0,2#1>>).          
** exception throw: bad_enum

I also wonder how you represent the:

....
OFPIT_EXPERIMENTER = 0xFFFF
....

enum in a bitmap?

Cheers, Tobbe

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions