Skip to content

Commit

Permalink
openflow.nicira: Add NXM_NX_TCP_FLAGS
Browse files Browse the repository at this point in the history
This is totally untested.  The basic support should work.  Whether
the mask-checking works is totally up in the air.
  • Loading branch information
MurphyMc committed Apr 15, 2014
1 parent d0ac092 commit 3d2243c
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions pox/openflow/nicira.py
Original file line number Diff line number Diff line change
Expand Up @@ -1531,6 +1531,19 @@ def _unpack_value (self, v):
raise RuntimeError("Can't unpack %i bytes for %s"
% (self._nxm_length, self.__class__.__name__))


class _nxm_tcp_flags (_nxm_numeric):
"""
Allows setting of TCP flags, while sanity checking mask
"""
def _pack_mask (self, v):
assert self._nxm_length == 2
assert isinstance(v, (int, long))
if (v & 0xf000) != 0:
raise RuntimeError("Top bits of TCP flags mask must be 0")
return struct.pack("!H", v)


class _nxm_ip (object):
"""
Allows setting of IP address in many formats
Expand Down Expand Up @@ -2069,6 +2082,9 @@ def NXM_IS_NX_REG (o):
# Flow cookie
_make_nxm_w("NXM_NX_COOKIE", 1, 30, 8)

# TCP flags
_make_nxm_w("NXM_NX_TCP_FLAGS", 1, 34, 2, type=_nxm_tcp_flags)


# MPLS label, traffic class, and bottom-of-stack flag
# Note that these are from OpenFlow 1.2 and I think BOS is from 1.3,
Expand Down

0 comments on commit 3d2243c

Please sign in to comment.