add bsn_udf extension
diff --git a/c_gen/c_match.py b/c_gen/c_match.py
index fe6e56b..0da5227 100644
--- a/c_gen/c_match.py
+++ b/c_gen/c_match.py
@@ -295,6 +295,14 @@
     OF_OXM_INDEX_BSN_L3_SRC_CLASS_ID = 41,
     OF_OXM_INDEX_BSN_L3_DST_CLASS_ID = 42,
     OF_OXM_INDEX_BSN_EGR_PORT_GROUP_ID = 43,
+    OF_OXM_INDEX_BSN_UDF0 = 44,
+    OF_OXM_INDEX_BSN_UDF1 = 45,
+    OF_OXM_INDEX_BSN_UDF2 = 46,
+    OF_OXM_INDEX_BSN_UDF3 = 47,
+    OF_OXM_INDEX_BSN_UDF4 = 48,
+    OF_OXM_INDEX_BSN_UDF5 = 49,
+    OF_OXM_INDEX_BSN_UDF6 = 50,
+    OF_OXM_INDEX_BSN_UDF7 = 51,
 };
 
 #define OF_OXM_BIT(index) (((uint64_t) 1) << (index))
diff --git a/c_gen/c_type_maps.py b/c_gen/c_type_maps.py
index 19d7587..2b46932 100644
--- a/c_gen/c_type_maps.py
+++ b/c_gen/c_type_maps.py
@@ -544,6 +544,22 @@
         case 0x0b: return OF_OXM_BSN_L3_SRC_CLASS_ID_MASKED;
         case 0x0c: return OF_OXM_BSN_L3_DST_CLASS_ID;
         case 0x0d: return OF_OXM_BSN_L3_DST_CLASS_ID_MASKED;
+        case 0x10: return OF_OXM_BSN_UDF0;
+        case 0x11: return OF_OXM_BSN_UDF0_MASKED;
+        case 0x12: return OF_OXM_BSN_UDF1;
+        case 0x13: return OF_OXM_BSN_UDF1_MASKED;
+        case 0x14: return OF_OXM_BSN_UDF2;
+        case 0x15: return OF_OXM_BSN_UDF2_MASKED;
+        case 0x16: return OF_OXM_BSN_UDF3;
+        case 0x17: return OF_OXM_BSN_UDF3_MASKED;
+        case 0x18: return OF_OXM_BSN_UDF4;
+        case 0x19: return OF_OXM_BSN_UDF4_MASKED;
+        case 0x1a: return OF_OXM_BSN_UDF5;
+        case 0x1b: return OF_OXM_BSN_UDF5_MASKED;
+        case 0x1c: return OF_OXM_BSN_UDF6;
+        case 0x1d: return OF_OXM_BSN_UDF6_MASKED;
+        case 0x1e: return OF_OXM_BSN_UDF7;
+        case 0x1f: return OF_OXM_BSN_UDF7_MASKED;
         default: return OF_OBJECT_INVALID;
         }
     } else {
diff --git a/c_gen/match.py b/c_gen/match.py
index 2f12780..d9fdee5 100644
--- a/c_gen/match.py
+++ b/c_gen/match.py
@@ -468,6 +468,78 @@
         takes_mask_in_spec=True,
         order=1006,
         ),
+
+    bsn_udf0 = dict(
+        name="bsn_udf0",
+        m_type="uint32_t",
+        print_type="PRIu32",
+        conditions="",
+        takes_mask_in_spec=True,
+        order=1010,
+        ),
+
+    bsn_udf1 = dict(
+        name="bsn_udf1",
+        m_type="uint32_t",
+        print_type="PRIu32",
+        conditions="",
+        takes_mask_in_spec=True,
+        order=1010,
+        ),
+
+    bsn_udf2 = dict(
+        name="bsn_udf2",
+        m_type="uint32_t",
+        print_type="PRIu32",
+        conditions="",
+        takes_mask_in_spec=True,
+        order=1010,
+        ),
+
+    bsn_udf3 = dict(
+        name="bsn_udf3",
+        m_type="uint32_t",
+        print_type="PRIu32",
+        conditions="",
+        takes_mask_in_spec=True,
+        order=1010,
+        ),
+
+    bsn_udf4 = dict(
+        name="bsn_udf4",
+        m_type="uint32_t",
+        print_type="PRIu32",
+        conditions="",
+        takes_mask_in_spec=True,
+        order=1010,
+        ),
+
+    bsn_udf5 = dict(
+        name="bsn_udf5",
+        m_type="uint32_t",
+        print_type="PRIu32",
+        conditions="",
+        takes_mask_in_spec=True,
+        order=1010,
+        ),
+
+    bsn_udf6 = dict(
+        name="bsn_udf6",
+        m_type="uint32_t",
+        print_type="PRIu32",
+        conditions="",
+        takes_mask_in_spec=True,
+        order=1010,
+        ),
+
+    bsn_udf7 = dict(
+        name="bsn_udf7",
+        m_type="uint32_t",
+        print_type="PRIu32",
+        conditions="",
+        takes_mask_in_spec=True,
+        order=1010,
+        ),
 )
 
 match_keys_sorted = of_match_members.keys()
diff --git a/c_gen/templates/loci_show.h b/c_gen/templates/loci_show.h
index 5384837..f83e1bb 100644
--- a/c_gen/templates/loci_show.h
+++ b/c_gen/templates/loci_show.h
@@ -386,5 +386,13 @@
 #define LOCI_SHOW_u32_num_aux(writer, cookie, val) LOCI_SHOW_u32(writer, cookie, val)
 #define LOCI_SHOW_u64_checksum(writer, cookie, val) LOCI_SHOW_u64(writer, cookie, val)
 #define LOCI_SHOW_u32_bsn_egr_port_group_id(writer, cookie, val) LOCI_SHOW_u32(writer, cookie, val)
+#define LOCI_SHOW_u32_bsn_udf0(writer, cookie, val) LOCI_SHOW_u32(writer, cookie, val)
+#define LOCI_SHOW_u32_bsn_udf1(writer, cookie, val) LOCI_SHOW_u32(writer, cookie, val)
+#define LOCI_SHOW_u32_bsn_udf2(writer, cookie, val) LOCI_SHOW_u32(writer, cookie, val)
+#define LOCI_SHOW_u32_bsn_udf3(writer, cookie, val) LOCI_SHOW_u32(writer, cookie, val)
+#define LOCI_SHOW_u32_bsn_udf4(writer, cookie, val) LOCI_SHOW_u32(writer, cookie, val)
+#define LOCI_SHOW_u32_bsn_udf5(writer, cookie, val) LOCI_SHOW_u32(writer, cookie, val)
+#define LOCI_SHOW_u32_bsn_udf6(writer, cookie, val) LOCI_SHOW_u32(writer, cookie, val)
+#define LOCI_SHOW_u32_bsn_udf7(writer, cookie, val) LOCI_SHOW_u32(writer, cookie, val)
 
 #endif /* _LOCI_SHOW_H_ */
diff --git a/java_gen/java_type.py b/java_gen/java_type.py
index 6188771..59b40eb 100644
--- a/java_gen/java_type.py
+++ b/java_gen/java_type.py
@@ -498,6 +498,8 @@
         .op(read='GenTableId.read2Bytes(bb)',
             write='$name.write2Bytes(bb)',
            )
+udf = JType("UDF") \
+         .op(version=ANY, read="UDF.read4Bytes(bb)", write="$name.write4Bytes(bb)", default="UDF.ZERO")
 
 generic_t = JType("T")
 
@@ -612,6 +614,30 @@
         'of_oxm_bsn_egr_port_group_id' : { 'value' : class_id },
         'of_oxm_bsn_egr_port_group_id_masked' : { 'value' : class_id, 'value_mask' : class_id },
 
+        'of_oxm_bsn_udf0' : { 'value' : udf },
+        'of_oxm_bsn_udf0_masked' : { 'value' : udf, 'value_mask' : udf },
+
+        'of_oxm_bsn_udf1' : { 'value' : udf },
+        'of_oxm_bsn_udf1_masked' : { 'value' : udf, 'value_mask' : udf },
+
+        'of_oxm_bsn_udf2' : { 'value' : udf },
+        'of_oxm_bsn_udf2_masked' : { 'value' : udf, 'value_mask' : udf },
+
+        'of_oxm_bsn_udf3' : { 'value' : udf },
+        'of_oxm_bsn_udf3_masked' : { 'value' : udf, 'value_mask' : udf },
+
+        'of_oxm_bsn_udf4' : { 'value' : udf },
+        'of_oxm_bsn_udf4_masked' : { 'value' : udf, 'value_mask' : udf },
+
+        'of_oxm_bsn_udf5' : { 'value' : udf },
+        'of_oxm_bsn_udf5_masked' : { 'value' : udf, 'value_mask' : udf },
+
+        'of_oxm_bsn_udf6' : { 'value' : udf },
+        'of_oxm_bsn_udf6_masked' : { 'value' : udf, 'value_mask' : udf },
+
+        'of_oxm_bsn_udf7' : { 'value' : udf },
+        'of_oxm_bsn_udf7_masked' : { 'value' : udf, 'value_mask' : udf },
+
         'of_table_stats_entry': { 'wildcards': table_stats_wildcards },
         'of_match_v1': { 'vlan_vid' : vlan_vid_match, 'vlan_pcp': vlan_pcp,
                 'eth_type': eth_type, 'ip_dscp': ip_dscp, 'ip_proto': ip_proto,
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/protocol/match/MatchField.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/protocol/match/MatchField.java
index 7181765..aebcbb2 100644
--- a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/protocol/match/MatchField.java
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/protocol/match/MatchField.java
@@ -22,6 +22,7 @@
 import org.projectfloodlight.openflow.types.TransportPort;
 import org.projectfloodlight.openflow.types.U32;
 import org.projectfloodlight.openflow.types.U8;
+import org.projectfloodlight.openflow.types.UDF;
 import org.projectfloodlight.openflow.types.VRF;
 import org.projectfloodlight.openflow.types.VlanPcp;
 
@@ -199,6 +200,30 @@
     public final static MatchField<ClassId> BSN_EGR_PORT_GROUP_ID =
             new MatchField<ClassId>("bsn_egr_port_group_id", MatchFields.BSN_EGR_PORT_GROUP_ID);
 
+    public final static MatchField<UDF> BSN_UDF0 =
+            new MatchField<UDF>("bsn_udf", MatchFields.BSN_UDF0);
+
+    public final static MatchField<UDF> BSN_UDF1 =
+            new MatchField<UDF>("bsn_udf", MatchFields.BSN_UDF1);
+
+    public final static MatchField<UDF> BSN_UDF2 =
+            new MatchField<UDF>("bsn_udf", MatchFields.BSN_UDF2);
+
+    public final static MatchField<UDF> BSN_UDF3 =
+            new MatchField<UDF>("bsn_udf", MatchFields.BSN_UDF3);
+
+    public final static MatchField<UDF> BSN_UDF4 =
+            new MatchField<UDF>("bsn_udf", MatchFields.BSN_UDF4);
+
+    public final static MatchField<UDF> BSN_UDF5 =
+            new MatchField<UDF>("bsn_udf", MatchFields.BSN_UDF5);
+
+    public final static MatchField<UDF> BSN_UDF6 =
+            new MatchField<UDF>("bsn_udf", MatchFields.BSN_UDF6);
+
+    public final static MatchField<UDF> BSN_UDF7 =
+            new MatchField<UDF>("bsn_udf", MatchFields.BSN_UDF7);
+
     public String getName() {
         return name;
     }
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/protocol/match/MatchFields.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/protocol/match/MatchFields.java
index af04a9e..d1e2ee9 100644
--- a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/protocol/match/MatchFields.java
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/protocol/match/MatchFields.java
@@ -46,4 +46,12 @@
     BSN_L3_SRC_CLASS_ID,
     BSN_L3_DST_CLASS_ID,
     BSN_EGR_PORT_GROUP_ID,
+    BSN_UDF0,
+    BSN_UDF1,
+    BSN_UDF2,
+    BSN_UDF3,
+    BSN_UDF4,
+    BSN_UDF5,
+    BSN_UDF6,
+    BSN_UDF7,
 }
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/UDF.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/UDF.java
new file mode 100644
index 0000000..e537c20
--- /dev/null
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/UDF.java
@@ -0,0 +1,85 @@
+package org.projectfloodlight.openflow.types;
+
+import javax.annotation.concurrent.Immutable;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+
+import com.google.common.hash.PrimitiveSink;
+import com.google.common.primitives.UnsignedInts;
+
+@Immutable
+public class UDF implements OFValueType<UDF> {
+    static final int LENGTH = 4;
+    private final int rawValue;
+
+    public static final UDF ZERO = UDF.of(0x0);
+    public static final UDF NO_MASK = UDF.of(0xFFFFFFFF);
+    public static final UDF FULL_MASK = UDF.of(0x00000000);
+
+    private UDF(final int rawValue) {
+        this.rawValue = rawValue;
+    }
+
+    public static UDF of(final int raw) {
+        return new UDF(raw);
+    }
+
+    public int getInt() {
+        return rawValue;
+    }
+
+    @Override
+    public int getLength() {
+        return LENGTH;
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + rawValue;
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (obj == null)
+            return false;
+        if (getClass() != obj.getClass())
+            return false;
+        UDF other = (UDF) obj;
+        if (rawValue != other.rawValue)
+            return false;
+        return true;
+    }
+
+    @Override
+    public String toString() {
+        return Integer.toString(rawValue);
+    }
+
+    public void write4Bytes(ChannelBuffer c) {
+        c.writeInt(rawValue);
+    }
+
+    public static UDF read4Bytes(ChannelBuffer c) {
+        return UDF.of(c.readInt());
+    }
+
+    @Override
+    public UDF applyMask(UDF mask) {
+        return UDF.of(this.rawValue & mask.rawValue);
+    }
+
+    @Override
+    public int compareTo(UDF o) {
+        return UnsignedInts.compare(rawValue, o.rawValue);
+    }
+
+    @Override
+    public void putTo(PrimitiveSink sink) {
+        sink.putInt(rawValue);
+    }
+}
diff --git a/openflow_input/bsn_udf b/openflow_input/bsn_udf
new file mode 100644
index 0000000..f7ce9a6
--- /dev/null
+++ b/openflow_input/bsn_udf
@@ -0,0 +1,124 @@
+// Copyright 2014, Big Switch Networks, Inc.
+//
+// LoxiGen is licensed under the Eclipse Public License,
+// version 1.0 (EPL), with the following special exception:
+//
+// LOXI Exception
+//
+// As a special exception to the terms of the EPL, you may
+// distribute libraries generated by LoxiGen (LoxiGen Libraries)
+// under the terms of your choice, provided that copyright and
+// licensing notices generated by LoxiGen are not altered or removed
+// from the LoxiGen Libraries and the notice provided below is (i)
+// included in the LoxiGen Libraries, if distributed in source code
+// form and (ii) included in any documentation for the LoxiGen
+// Libraries, if distributed in binary form.
+//
+// Notice: "Copyright 2014, Big Switch Networks, Inc.
+// This library was generated by the LoxiGen Compiler."
+//
+// You may not use this file except in compliance with the EPL or
+// LOXI Exception. You may obtain a copy of the EPL at:
+//
+// http://www.eclipse.org/legal/epl-v10.html
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an "AS
+// IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+// express or implied. See the EPL for the specific language
+// governing permissions and limitations under the EPL.
+
+#version 3
+#version 4
+
+/*
+ * User Defined Fields
+ */
+
+struct of_oxm_bsn_udf0 : of_oxm {
+    uint32_t type_len == 0x00031004;
+    uint32_t value;
+};
+
+struct of_oxm_bsn_udf0_masked : of_oxm {
+    uint32_t type_len == 0x00031108;
+    uint32_t value;
+    uint32_t value_mask;
+};
+
+struct of_oxm_bsn_udf1 : of_oxm {
+    uint32_t type_len == 0x00031204;
+    uint32_t value;
+};
+
+struct of_oxm_bsn_udf1_masked : of_oxm {
+    uint32_t type_len == 0x00031308;
+    uint32_t value;
+    uint32_t value_mask;
+};
+
+struct of_oxm_bsn_udf2 : of_oxm {
+    uint32_t type_len == 0x00031404;
+    uint32_t value;
+};
+
+struct of_oxm_bsn_udf2_masked : of_oxm {
+    uint32_t type_len == 0x00031508;
+    uint32_t value;
+    uint32_t value_mask;
+};
+
+struct of_oxm_bsn_udf3 : of_oxm {
+    uint32_t type_len == 0x00031604;
+    uint32_t value;
+};
+
+struct of_oxm_bsn_udf3_masked : of_oxm {
+    uint32_t type_len == 0x00031708;
+    uint32_t value;
+    uint32_t value_mask;
+};
+
+struct of_oxm_bsn_udf4 : of_oxm {
+    uint32_t type_len == 0x00031804;
+    uint32_t value;
+};
+
+struct of_oxm_bsn_udf4_masked : of_oxm {
+    uint32_t type_len == 0x00031908;
+    uint32_t value;
+    uint32_t value_mask;
+};
+
+struct of_oxm_bsn_udf5 : of_oxm {
+    uint32_t type_len == 0x00031a04;
+    uint32_t value;
+};
+
+struct of_oxm_bsn_udf5_masked : of_oxm {
+    uint32_t type_len == 0x00031b08;
+    uint32_t value;
+    uint32_t value_mask;
+};
+
+struct of_oxm_bsn_udf6 : of_oxm {
+    uint32_t type_len == 0x00031c04;
+    uint32_t value;
+};
+
+struct of_oxm_bsn_udf6_masked : of_oxm {
+    uint32_t type_len == 0x00031d08;
+    uint32_t value;
+    uint32_t value_mask;
+};
+
+struct of_oxm_bsn_udf7 : of_oxm {
+    uint32_t type_len == 0x00031e04;
+    uint32_t value;
+};
+
+struct of_oxm_bsn_udf7_masked : of_oxm {
+    uint32_t type_len == 0x00031f08;
+    uint32_t value;
+    uint32_t value_mask;
+};