diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2012-06-21 14:55:01 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2012-06-22 06:27:52 +0900 |
commit | c878fbb3049dfb2493e18c6815c647207df80c73 (patch) | |
tree | 345de1c98d2435a9dd76e56fed8ac5ce952137ff | |
parent | ed1f2b69b6b2159a67958d1db4add06d1c2a5eba (diff) |
nxm: add NXM_NX_IPV6_LABEL
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r-- | ryu/ofproto/nx_match.py | 20 | ||||
-rw-r--r-- | ryu/ofproto/ofproto_v1_0.py | 2 |
2 files changed, 22 insertions, 0 deletions
diff --git a/ryu/ofproto/nx_match.py b/ryu/ofproto/nx_match.py index 0f382558..f8024e26 100644 --- a/ryu/ofproto/nx_match.py +++ b/ryu/ofproto/nx_match.py @@ -39,6 +39,7 @@ FWW_NW_DSCP = 1 << 1 FWW_NW_ECN = 1 << 2 FWW_ARP_SHA = 1 << 3 FWW_ARP_THA = 1 << 6 +FWW_IPV6_LABEL = 1 << 7 FWW_NW_TTL = 1 << 8 FWW_ALL = (1 << 13) - 1 @@ -83,6 +84,7 @@ class Flow(object): self.tun_id = 0 self.arp_spa = 0 self.arp_tpa = 0 + self.ipv6_label = 0 class FlowWildcards(object): @@ -222,6 +224,10 @@ class ClsRule(object): def set_icmpv6_code(self, icmp_code): self.set_tp_dst(icmp_code) + def set_ipv6_label(self, label): + self.wc.wildcards &= ~FWW_IPV6_LABEL + self.flow.ipv6_label = label + def flow_format(self): # Tunnel ID is only supported by NXM if self.wc.tun_id_mask != 0: @@ -556,6 +562,17 @@ class MFICMPV6Code(MFField): return self._put(buf, offset, rule.flow.tp_dst) +@_register_make +@_set_nxm_headers([ofproto_v1_0.NXM_NX_IPV6_LABEL]) +class MFICMPV6Label(MFField): + @classmethod + def make(cls): + return cls(MF_PACK_STRING_BE32) + + def put(self, buf, offset, rule): + return self._put(buf, offset, rule.flow.ipv6_label) + + def serialize_nxm_match(rule, buf, offset): old_offset = offset @@ -662,6 +679,9 @@ def serialize_nxm_match(rule, buf, offset): offset += nxm_put(buf, offset, ofproto_v1_0.NXM_NX_ICMPV6_CODE, rule) + if not rule.wc.wildcards & FWW_IPV6_LABEL: + offset += nxm_put(buf, offset, ofproto_v1_0.NXM_NX_IPV6_LABEL, rule) + # ARP if rule.flow.arp_spa != 0: if rule.wc.arp_spa_mask == UINT32_MAX: diff --git a/ryu/ofproto/ofproto_v1_0.py b/ryu/ofproto/ofproto_v1_0.py index b88581e6..4564843e 100644 --- a/ryu/ofproto/ofproto_v1_0.py +++ b/ryu/ofproto/ofproto_v1_0.py @@ -714,6 +714,8 @@ NXM_NX_ND_SLL = nxm_header(0x0001, 24, 6) NXM_NX_ND_TLL = nxm_header(0x0001, 25, 6) +NXM_NX_IPV6_LABEL = nxm_header(0x0001, 27, 4) + NXM_NX_IP_ECN = nxm_header(0x0001, 28, 1) NXM_NX_IP_TTL = nxm_header(0x0001, 29, 1) |