Add support for connection tracking.
[cascardo/ovs.git] / build-aux / extract-ofp-fields
index ca2ca04..8d43e4b 100755 (executable)
@@ -14,15 +14,17 @@ VERSION = {"1.0": 0x01,
            "1.4": 0x05,
            "1.5": 0x06}
 
-TYPES = {"u8": 1,
-         "be16": 2,
-         "be32": 4,
-         "MAC": 6,
-         "be64": 8,
-         "IPv6": 16}
+TYPES = {"u8":       (1,   False),
+         "be16":     (2,   False),
+         "be32":     (4,   False),
+         "MAC":      (6,   False),
+         "be64":     (8,   False),
+         "be128":    (16,  False),
+         "tunnelMD": (124, True)}
 
 FORMATTING = {"decimal":            ("MFS_DECIMAL",      1,   8),
               "hexadecimal":        ("MFS_HEXADECIMAL",  1, 127),
+              "ct state":           ("MFS_CT_STATE",     4,   4),
               "Ethernet":           ("MFS_ETHERNET",     6,   6),
               "IPv4":               ("MFS_IPV4",         4,   4),
               "IPv6":               ("MFS_IPV6",        16,  16),
@@ -234,7 +236,8 @@ def parse_field(mff, comment):
     type_ = m.group(1)
     if type_ not in TYPES:
         fatal("%s: unknown type %s" % (mff, d['Type']))
-    f['n_bytes'] = TYPES[type_]
+
+    f['n_bytes'] = TYPES[type_][0]
     if m.group(2):
         f['n_bits'] = int(m.group(2))
         if f['n_bits'] > f['n_bytes'] * 8:
@@ -242,6 +245,7 @@ def parse_field(mff, comment):
                   % (mff, f['n_bits'], 8 * f['n_bytes']))
     else:
         f['n_bits'] = 8 * f['n_bytes']
+    f['variable'] = TYPES[type_][1]
 
     if d['Maskable'] == 'no':
         f['mask'] = 'MFM_NONE'
@@ -307,7 +311,12 @@ def make_meta_flow(fields):
             output += ["    \"%s\", \"%s\"," % (f['name'], f['extra_name'])]
         else:
             output += ["    \"%s\", NULL," % f['name']]
-        output += ["    %d, %d," % (f['n_bytes'], f['n_bits'])]
+
+        if f['variable']:
+            variable = 'true'
+        else:
+            variable = 'false'
+        output += ["    %d, %d, %s," % (f['n_bytes'], f['n_bits'], variable)]
 
         if f['writable']:
             rw = 'true'