OpenFlow Rule Metadata

依然范特西╮ 提交于 2019-12-11 19:14:21

问题


I would like to understand how the Metadata are calculated in an Open Flow rule.

cookie=0x6900000, duration=228925.519s, table=17, n_packets=384, n_bytes=35436, priority=10,metadata=0xf30000000000/0xffffff0000000000 actions=write_metadata:0xc000f30000000000/0xfffffffffffffffe,goto_table:211

Example: I have a flow very similar to this. How are exactly the Metadata are Calculated.

And how to Intrepret the Metadata Values and Mask

Some says new_metadata = old_metadata & ~mask | value & Mask

Honestly i do not understand it, could some one explain it


回答1:


The purpose of the value and metadata fields in the write_metadata action are explained in the Open vSwitch documentation:

write_metadata:value[/mask]
    Updates the metadata field for the flow. If mask is omit‐
    ted, the metadata field is set exactly to value; if  mask
    is  specified,  then  a  1-bit in mask indicates that the
    corresponding bit in the metadata field will be  replaced
    with  the  corresponding  bit  from value. Both value and
    mask are 64-bit values that are decimal by default; use a
    0x prefix to specify them in hexadecimal.

The preceding explanation is indeed equivalent to:

new_metadata = (old_metadata & ~mask) | (value & mask)

In other words, we first erase bits of the old metadata value set to 1 in the mask (old_metadata & ~mask) and then set to 1 the bits of the value that are also set to 1 in the mask (| (value & mask)).



来源:https://stackoverflow.com/questions/53771023/openflow-rule-metadata

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!