loci: fix OF 1.2+ packet-in data offset

There are two bytes of padding between the match and the packet data.

This commit introduces "extra length", which is the sum of the fixed length
parts of an object having variable offsets (after a variable length member).
The only use is for OF 1.2+ packet-in messages.
diff --git a/c_gen/c_type_maps.py b/c_gen/c_type_maps.py
index 07f8dd5..a0fec7e 100644
--- a/c_gen/c_type_maps.py
+++ b/c_gen/c_type_maps.py
@@ -792,6 +792,7 @@
     gen_obj_to_type_map_functions(out)
 
     out.write("extern const int *const of_object_fixed_len[OF_VERSION_ARRAY_MAX];\n")
+    out.write("extern const int *const of_object_extra_len[OF_VERSION_ARRAY_MAX];\n")
 
     out.write("""
 /**
@@ -1064,6 +1065,47 @@
 """)
 
 
+def gen_extra_length_array(out):
+    """
+    Generate an array giving the extra lengths of all objects/versions
+    @param out The file handle to which to write
+    """
+    out.write("""
+/**
+ * An array with the number of bytes in the extra length part
+ * of each OF object
+ */
+""")
+
+    for version in of_g.of_version_range:
+        out.write("""
+static const int\nof_object_extra_len_v%d[OF_OBJECT_COUNT] = {
+    -1,   /* of_object is not instantiable */
+""" % version)
+        for i, cls in enumerate(of_g.all_class_order):
+            comma = ","
+            if i == len(of_g.all_class_order) - 1:
+                comma = ""
+            val = "-1" + comma
+            if (cls, version) in of_g.base_length:
+                val = str(of_g.extra_length.get((cls, version), 0)) + comma
+            out.write("    %-5s /* %d: %s */\n" % (val, i + 1, cls))
+        out.write("};\n")
+
+    out.write("""
+/**
+ * Unified map of extra length part of each object
+ */
+const int *const of_object_extra_len[OF_VERSION_ARRAY_MAX] = {
+    NULL,
+""")
+    for version in of_g.of_version_range:
+        out.write("    of_object_extra_len_v%d,\n" % version)
+    out.write("""
+};
+""")
+
+
 ################################################################
 ################################################################