码迷,mamicode.com
首页 > 其他好文 > 详细

ovs-fields

时间:2021-01-27 13:22:50      阅读:0      评论:0      收藏:0      [点我收藏+]

标签:ipv4   udp   参考   形式   tcp6   val   field   协议类型   rarp   

1. 字段匹配

精确匹配

field=value,如,nw_src=10.1.2.3.

 

按位匹配

field=value/mask,如,nw_src=10.1.0.0/255.255.0.0,nw_src=10.1.0.0/16.

 

通配

"field=*".

 

简便方式

  • eth      packet_type=(0,0) (Open vSwitch 2.8 and later)
  • ip        eth_type=0x0800
  • ipv6    eth_type=0x86dd
  • icmp   eth_type=0x0800,ip_proto=1
  • icmp6    eth_type=0x86dd,ip_proto=58
  • tcp      eth_type=0x0800,ip_proto=6
  • tcp6     eth_type=0x86dd,ip_proto=6
  • udp     eth_type=0x0800,ip_proto=17
  • udp6   eth_type=0x86dd,ip_proto=17
  • sctp     eth_type=0x0800,ip_proto=132
  • sctp6     eth_type=0x86dd,ip_proto=132
  • arp      eth_type=0x0806
  • rarp     eth_type=0x8035
  • mpls    eth_type=0x8847
  • mplsm      eth_type=0x8848

 

2. 隧道字段

Name                   Bytes             Mask   RW?   Prereqs   NXM/OXM Support
─────────────────────  ────────────────  ─────  ────  ────────  ─────────────────────
tun_id aka tunnel_id   8                 yes    yes   none      OF 1.3+ and OVS 1.1+
tun_src                4                 yes    yes   none      OVS 2.0+
tun_dst                4                 yes    yes   none      OVS 2.0+
tun_ipv6_src           16                yes    yes   none      OVS 2.5+

tun_ipv6_dst           16                yes    yes   none      OVS 2.5+
tun_gbp_id             2                 yes    yes   none      OVS 2.4+
tun_gbp_flags          1                 yes    yes   none      OVS 2.4+
tun_erspan_ver         1 (low 4 bits)    yes    yes   none      OVS 2.10+
tun_erspan_idx         4 (low 20 bits)   yes    yes   none      OVS 2.10+
tun_erspan_dir         1 (low 1 bits)    yes    yes   none      OVS 2.10+
tun_erspan_hwid        1 (low 6 bits)    yes    yes   none      OVS 2.10+
tun_metadata0          124               yes    yes   none      OVS 2.5+
tun_metadata1          124               yes    yes   none      OVS 2.5+

tun_metadata2          124               yes    yes   none      OVS 2.5+
tun_metadata3          124               yes    yes   none      OVS 2.5+
tun_metadata4          124               yes    yes   none      OVS 2.5+
tun_metadata5          124               yes    yes   none      OVS 2.5+
tun_metadata6          124               yes    yes   none      OVS 2.5+
tun_metadata7          124               yes    yes   none      OVS 2.5+
tun_metadata8          124               yes    yes   none      OVS 2.5+
tun_metadata9          124               yes    yes   none      OVS 2.5+
tun_metadata10         124               yes    yes   none      OVS 2.5+

tun_metadata11         124               yes    yes   none      OVS 2.5+
tun_metadata12         124               yes    yes   none      OVS 2.5+
tun_metadata13         124               yes    yes   none      OVS 2.5+
tun_metadata14         124               yes    yes   none      OVS 2.5+
tun_metadata15         124               yes    yes   none      OVS 2.5+
tun_metadata16         124               yes    yes   none      OVS 2.5+
tun_metadata17         124               yes    yes   none      OVS 2.5+
tun_metadata18         124               yes    yes   none      OVS 2.5+
tun_metadata19         124               yes    yes   none      OVS 2.5+

tun_metadata20         124               yes    yes   none      OVS 2.5+
tun_metadata21         124               yes    yes   none      OVS 2.5+
tun_metadata22         124               yes    yes   none      OVS 2.5+
tun_metadata23         124               yes    yes   none      OVS 2.5+
tun_metadata24         124               yes    yes   none      OVS 2.5+
tun_metadata25         124               yes    yes   none      OVS 2.5+
tun_metadata26         124               yes    yes   none      OVS 2.5+
tun_metadata27         124               yes    yes   none      OVS 2.5+
tun_metadata28         124               yes    yes   none      OVS 2.5+

tun_metadata29         124               yes    yes   none      OVS 2.5+
tun_metadata30         124               yes    yes   none      OVS 2.5+
tun_metadata31         124               yes    yes   none      OVS 2.5+
tun_metadata32         124               yes    yes   none      OVS 2.5+
tun_metadata33         124               yes    yes   none      OVS 2.5+
tun_metadata34         124               yes    yes   none      OVS 2.5+
tun_metadata35         124               yes    yes   none      OVS 2.5+
tun_metadata36         124               yes    yes   none      OVS 2.5+
tun_metadata37         124               yes    yes   none      OVS 2.5+

tun_metadata38         124               yes    yes   none      OVS 2.5+
tun_metadata39         124               yes    yes   none      OVS 2.5+
tun_metadata40         124               yes    yes   none      OVS 2.5+
tun_metadata41         124               yes    yes   none      OVS 2.5+
tun_metadata42         124               yes    yes   none      OVS 2.5+
tun_metadata43         124               yes    yes   none      OVS 2.5+
tun_metadata44         124               yes    yes   none      OVS 2.5+
tun_metadata45         124               yes    yes   none      OVS 2.5+
tun_metadata46         124               yes    yes   none      OVS 2.5+

tun_metadata47         124               yes    yes   none      OVS 2.5+
tun_metadata48         124               yes    yes   none      OVS 2.5+
tun_metadata49         124               yes    yes   none      OVS 2.5+
tun_metadata50         124               yes    yes   none      OVS 2.5+
tun_metadata51         124               yes    yes   none      OVS 2.5+
tun_metadata52         124               yes    yes   none      OVS 2.5+
tun_metadata53         124               yes    yes   none      OVS 2.5+
tun_metadata54         124               yes    yes   none      OVS 2.5+
tun_metadata55         124               yes    yes   none      OVS 2.5+

tun_metadata56         124               yes    yes   none      OVS 2.5+
tun_metadata57         124               yes    yes   none      OVS 2.5+
tun_metadata58         124               yes    yes   none      OVS 2.5+
tun_metadata59         124               yes    yes   none      OVS 2.5+
tun_metadata60         124               yes    yes   none      OVS 2.5+
tun_metadata61         124               yes    yes   none      OVS 2.5+
tun_metadata62         124               yes    yes   none      OVS 2.5+
tun_metadata63         124               yes    yes   none      OVS 2.5+
tun_flags              2 (low 1 bits)    yes    yes   none      OVS 2.5+

tun_id: 即tunnel ID;对于VXLAN即是VNI,对于GRE则是key...

tun_src: 外层IP头的源IPv4地址。

tun_dst: 外层IP头的目的IPv4地址。

tun_metadata0: Geneve选项0.

Name Format
tun_id hexadecimal
tun_src IPv4
tun_dst IPv4
tun_ipv6_src IPv6
tun_ipv6_dst IPv6
tun_gbp_id decimal
tun_gbp_flags hexadecimal
tun_erspan_ver decimal
tun_erspan_idx hexadecimal
tun_erspan_dir decimal
tun_erspan_hwid hexadecimal
tun_metadata0 hexadecimal
tun_flags tunnel flags

 字段格式

  decimal: 十进制或十六进制数(0x开头);

  hexadecimal: 十六进制数(0x开头);

  Ethernet: 以太网地址格式,xx:xx:xx:xx:xx:xx;

  IPv4: IPv4地址格式,a.b.c.d, address/length, address/mask;

  IPv6: IPv6地址格式;

  OpenFlow 1.0 port: 16位十进制数字,或端口名称;

  OpenFlow 1.1+ port: 和OpenFlow 1.0 port相同,但是端口号32位长;

  

3. 元数据字段

Name            Bytes   Mask   RW?   Prereqs   NXM/OXM Support
──────────────  ──────  ─────  ────  ────────  ─────────────────────
in_port         2       no     yes   none      OVS 1.1+
in_port_oxm     4       no     yes   none      OF 1.2+ and OVS 1.7+
skb_priority    4       no     no    none

pkt_mark        4       yes    yes   none      OVS 2.0+
actset_output   4       no     no    none      OF 1.3+ and OVS 2.4+
packet_type     4       no     no    none      OF 1.5+ and OVS 2.8+

in_port: 数据包输入端口。

actset_output: 当前action set中的输出端口,如果没有,则为OFPP_UNSET.

packet_type: 数据包类型;以(ns, ns_type)的形式表示,如(0,0)表示以太网。

Name Format
in_port OpenFlow 1.0 port
in_port_oxm OpenFlow 1.1+ port
skb_priority hexadecimal
pkt_mark hexadecimal
actset_output OpenFlow 1.1+ port
packet_type packet type

 

4. 连接跟踪字段

Name          Bytes   Mask   RW?   Prereqs   NXM/OXM Support
────────────  ──────  ─────  ────  ────────  ────────────────
ct_state      4       yes    no    none      OVS 2.5+
ct_zone       2       no     no    none      OVS 2.5+
ct_mark       4       yes    yes   none      OVS 2.5+
ct_label      16      yes    yes   none      OVS 2.5+
ct_nw_src     4       yes    no    CT        OVS 2.8+
ct_nw_dst     4       yes    no    CT        OVS 2.8+

ct_ipv6_src   16      yes    no    CT        OVS 2.8+
ct_ipv6_dst   16      yes    no    CT        OVS 2.8+
ct_nw_proto   1       no     no    CT        OVS 2.8+
ct_tp_src     2       yes    no    CT        OVS 2.8+
ct_tp_dst     2       yes    no    CT        OVS 2.8+

ct_state: 连接状态;+state表示state被设置了,-state表示state没有被设置。支持以下状态标志:

  new  新的连接;如果这是一个未提交的连接,则设为1;

  est  已有连接的一部分;如果这是一个已提交的连接,则设为1;

  rel  与已有连接相关;如ICMP的“目标不可达”或FTP数据连接;仅当与此标志相关的连接已提交时,此标志才为1;

  rpl  数据包处于回复方向;如果这是一个已提交的连接,则设为1;

  inv  无效状态,连接跟踪器无法识别该连接;

  trk  该数据包被跟踪,即它之前已遍历了连接跟踪器;

  snat  该数据包被之前的ct action实施了SNAT;

  dnat  该数据包被之前的ct action实施了DNAT;

ct_nw_proto: IP协议类型。

Name Format
ct_state ct state
ct_zone hexadecimal
ct_label hexadecimal
ct_nw_src IPv4
ct_nw_dst IPv4
ct_ipv6_src IPv6
ct_ipv6_dst IPv6
ct_nw_proto decimal
ct_tp_src decimal
ct_tp_dst decimal

 

5. 寄存器字段

Name       Bytes   Mask   RW?   Prereqs   NXM/OXM Support
─────────  ──────  ─────  ────  ────────  ─────────────────────
metadata   8       yes    yes   none      OF 1.2+ and OVS 1.8+
reg0       4       yes    yes   none      OVS 1.1+
reg1       4       yes    yes   none      OVS 1.1+
reg2       4       yes    yes   none      OVS 1.1+
reg3       4       yes    yes   none      OVS 1.1+

reg4       4       yes    yes   none      OVS 1.3+
reg5       4       yes    yes   none      OVS 1.7+
reg6       4       yes    yes   none      OVS 1.7+
reg7       4       yes    yes   none      OVS 1.7+
reg8       4       yes    yes   none      OVS 2.6+
reg9       4       yes    yes   none      OVS 2.6+
reg10      4       yes    yes   none      OVS 2.6+
reg11      4       yes    yes   none      OVS 2.6+
reg12      4       yes    yes   none      OVS 2.6+
reg13      4       yes    yes   none      OVS 2.6+

reg14      4       yes    yes   none      OVS 2.6+
reg15      4       yes    yes   none      OVS 2.6+
xreg0      8       yes    yes   none      OF 1.3+ and OVS 2.4+
xreg1      8       yes    yes   none      OF 1.3+ and OVS 2.4+
xreg2      8       yes    yes   none      OF 1.3+ and OVS 2.4+
xreg3      8       yes    yes   none      OF 1.3+ and OVS 2.4+
xreg4      8       yes    yes   none      OF 1.3+ and OVS 2.4+
xreg5      8       yes    yes   none      OF 1.3+ and OVS 2.4+
xreg6      8       yes    yes   none      OF 1.3+ and OVS 2.4+
xreg7      8       yes    yes   none      OF 1.3+ and OVS 2.4+

xxreg0     16      yes    yes   none      OVS 2.6+
xxreg1     16      yes    yes   none      OVS 2.6+
xxreg2     16      yes    yes   none      OVS 2.6+
xxreg3     16      yes    yes   none      OVS 2.6+

流水线处理过程中的临时存储。

Name Format
metadata hexadecimal
reg0 hexadecimal
xreg0 hexadecimal
xxreg0 hexadecimal

 

6. 二层字段

Name                   Bytes   Mask   RW?   Prereqs    NXM/OXM Support
─────────────────────  ──────  ─────  ────  ─────────  ─────────────────────
eth_src aka dl_src     6       yes    yes   Ethernet   OF 1.2+ and OVS 1.1+
eth_dst aka dl_dst     6       yes    yes   Ethernet   OF 1.2+ and OVS 1.1+
eth_type aka dl_type   2       no     no    Ethernet   OF 1.2+ and OVS 1.1+
Name Format
eth_src Ethernet
eth_dst Ethernet
eth_type hexadecimal

 

7. VLAN字段

Name          Bytes             Mask   RW?   Prereqs    NXM/OXM Support
────────────  ────────────────  ─────  ────  ─────────  ─────────────────────
dl_vlan       2 (low 12 bits)   no     yes   Ethernet
dl_vlan_pcp   1 (low 3 bits)    no     yes   Ethernet

vlan_vid      2 (low 12 bits)   yes    yes   Ethernet   OF 1.2+ and OVS 1.7+
vlan_pcp      1 (low 3 bits)    no     yes   VLAN VID   OF 1.2+ and OVS 1.7+
vlan_tci      2                 yes    yes   Ethernet   OVS 1.1+
Name Format
vlan_vid decimal
vlan_pcp decimal
vlan_tci hexadecimal

 

8. MPLS(2.5层)字段

Name         Bytes             Mask   RW?   Prereqs   NXM/OXM Support
───────────  ────────────────  ─────  ────  ────────  ──────────────────────
mpls_label   4 (low 20 bits)   no     yes   MPLS      OF 1.2+ and OVS 1.11+
mpls_tc      1 (low 3 bits)    no     yes   MPLS      OF 1.2+ and OVS 1.11+

mpls_bos     1 (low 1 bits)    no     no    MPLS      OF 1.3+ and OVS 1.11+
mpls_ttl     1                 no     yes   MPLS      OVS 2.6+
Name Format
mpls_label decimal
mpls_tc decimal
mpls_bos decimal
mpls_ttl decimal

 

9. 三层:IPv4和IPv6字段

Name                    Bytes             Mask   RW?   Prereqs     NXM/OXM Support
──────────────────────  ────────────────  ─────  ────  ──────────  ─────────────────────
ip_src aka nw_src       4                 yes    yes   IPv4        OF 1.2+ and OVS 1.1+
ip_dst aka nw_dst       4                 yes    yes   IPv4        OF 1.2+ and OVS 1.1+

ipv6_src                16                yes    yes   IPv6        OF 1.2+ and OVS 1.1+
ipv6_dst                16                yes    yes   IPv6        OF 1.2+ and OVS 1.1+
ipv6_label              4 (low 20 bits)   yes    yes   IPv6        OF 1.2+ and OVS 1.4+

nw_proto aka ip_proto   1                 no     no    IPv4/IPv6   OF 1.2+ and OVS 1.1+
nw_ttl                  1                 no     yes   IPv4/IPv6   OVS 1.4+
ip_frag aka nw_frag     1 (low 2 bits)    yes    no    IPv4/IPv6   OVS 1.3+

nw_tos                  1                 no     yes   IPv4/IPv6   OVS 1.1+
ip_dscp                 1 (low 6 bits)    no     yes   IPv4/IPv6   OF 1.2+ and OVS 1.7+
nw_ecn aka ip_ecn       1 (low 2 bits)    no     yes   IPv4/IPv6   OF 1.2+ and OVS 1.4+

ip_frag: IP分片;可取值如下:

  no  只匹配非分片数据包;

  yes  匹配所有的分片;

  first  只匹配偏移为0的分片;

  later  只匹配偏移不为0的分片;

  not_later  匹配非分片数据包或偏移为0的分片;

Name Format
ip_src IPv4
ip_dst IPv4
ipv6_src IPv6
ipv6_dst IPv6
nw_proto decimal
nw_ttl decimal
ip_frag frag
nw_tos decimal
ip_dscp decimal
nw_ecn decimal

 

10. ARP字段

Name      Bytes   Mask   RW?   Prereqs   NXM/OXM Support
────────  ──────  ─────  ────  ────────  ─────────────────────
arp_op    2       no     yes   ARP       OF 1.2+ and OVS 1.1+
arp_spa   4       yes    yes   ARP       OF 1.2+ and OVS 1.1+
arp_tpa   4       yes    yes   ARP       OF 1.2+ and OVS 1.1+
arp_sha   6       yes    yes   ARP       OF 1.2+ and OVS 1.1+
arp_tha   6       yes    yes   ARP       OF 1.2+ and OVS 1.1+

arp_op: ARP操作码;

arp_spa: 源IPv4地址;

arp_tpa: 目的IPv4地址;

arp_sha: 源以太网地址;

arp_tha: 目的以太网地址;

Name Format
arp_op decimal
arp_spa IPv4
arp_tpa IPv4
arp_sha Ethernet
arp_tha Ethernet

 

11. NSH字段

Name               Bytes             Mask   RW?   Prereqs   NXM/OXM Support
─────────────────  ────────────────  ─────  ────  ────────  ────────────────
nsh_flags          1                 yes    yes   NSH       OVS 2.8+
nsh_ttl            1                 no     yes   NSH       OVS 2.9+

nsh_mdtype         1                 no     no    NSH       OVS 2.8+
nsh_np             1                 no     no    NSH       OVS 2.8+
nsh_spi aka nsp    4 (low 24 bits)   no     yes   NSH       OVS 2.8+

nsh_si aka nsi     1                 no     yes   NSH       OVS 2.8+
nsh_c1 aka nshc1   4                 yes    yes   NSH       OVS 2.8+
nsh_c2 aka nshc2   4                 yes    yes   NSH       OVS 2.8+

nsh_c3 aka nshc3   4                 yes    yes   NSH       OVS 2.8+
nsh_c4 aka nshc4   4                 yes    yes   NSH       OVS 2.8+
Name Format
nsh_flags decimal
nsh_ttl decimal
nsh_mdtype decimal
nsh_np decimal
nsh_spi hexadecimal
nsh_si decimal
nsh_c1 hexadecimal
nsh_c2 hexadecimal
nsh_c3 hexadecimal
nsh_c4 hexadecimal

 

12. 四层:TCP,UDP,SCTP字段

Name                 Bytes             Mask   RW?   Prereqs   NXM/OXM Support
───────────────────  ────────────────  ─────  ────  ────────  ─────────────────────
tcp_src aka tp_src   2                 yes    yes   TCP       OF 1.2+ and OVS 1.1+
tcp_dst aka tp_dst   2                 yes    yes   TCP       OF 1.2+ and OVS 1.1+
tcp_flags            2 (low 12 bits)   yes    no    TCP       OF 1.3+ and OVS 2.1+

udp_src              2                 yes    yes   UDP       OF 1.2+ and OVS 1.1+
udp_dst              2                 yes    yes   UDP       OF 1.2+ and OVS 1.1+
sctp_src             2                 yes    yes   SCTP      OF 1.2+ and OVS 2.0+
sctp_dst             2                 yes    yes   SCTP      OF 1.2+ and OVS 2.0+
Name Format
tcp_src decimal
tcp_dst decimal
tcp_flags TCP flags
udp_src decimal
udp_dst decimal
sctp_src decimal
sctp_dst decimal

 

13. ICMPv4和ICMPv6字段

Name          Bytes   Mask   RW?   Prereqs      NXM/OXM Support
────────────  ──────  ─────  ────  ───────────  ─────────────────────
icmp_type     1       no     yes   ICMPv4       OF 1.2+ and OVS 1.1+
icmp_code     1       no     yes   ICMPv4       OF 1.2+ and OVS 1.1+
icmpv6_type   1       no     yes   ICMPv6       OF 1.2+ and OVS 1.1+
icmpv6_code   1       no     yes   ICMPv6       OF 1.2+ and OVS 1.1+
nd_target     16      yes    yes   ND           OF 1.2+ and OVS 1.1+

nd_sll        6       yes    yes   ND solicit   OF 1.2+ and OVS 1.1+
nd_tll        6       yes    yes   ND advert    OF 1.2+ and OVS 1.1+

nd_target: 邻居发现目标IPv6地址。

nd_sll: 邻居发现源以太网地址。

nd_tll: 邻居发现目的以太网地址。

Name Format
icmp_type decimal
icmp_code decimal
icmpv6_type decimal
imcpv6_code decimal
nd_target IPv6
nd_sll Ethernet
nd_tll Ethernet

 

参考资料

https://www.openvswitch.org/support/dist-docs/ovs-fields.7.txt

ovs-fields

标签:ipv4   udp   参考   形式   tcp6   val   field   协议类型   rarp   

原文地址:https://www.cnblogs.com/gzming/p/14325859.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!