Merge remote-tracking branch 'upstream/master'
diff --git a/c_gen/templates/of_wire_buf.h b/c_gen/templates/of_wire_buf.h
index dfec5c3..0922a69 100644
--- a/c_gen/templates/of_wire_buf.h
+++ b/c_gen/templates/of_wire_buf.h
@@ -119,12 +119,6 @@
 #define OF_OBJECT_TO_WBUF(obj) ((obj)->wbuf)
 
 
-
-/**
- * Minimum allocation size for wire buffer object
- */
-#define OF_WIRE_BUFFER_MIN_ALLOC_BYTES 128
-
 /**
  * Allocate a wire buffer object and the underlying data buffer.
  * The wire buffer is initally empty (current_bytes == 0).
@@ -142,10 +136,6 @@
     }
     MEMSET(wbuf, 0, sizeof(of_wire_buffer_t));
 
-    if (a_bytes < OF_WIRE_BUFFER_MIN_ALLOC_BYTES) {
-        a_bytes = OF_WIRE_BUFFER_MIN_ALLOC_BYTES;
-    }
-
     if ((wbuf->buf = (uint8_t *)MALLOC(a_bytes)) == NULL) {
         FREE(wbuf);
         return NULL;
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPAddress.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPAddress.java
index 1c5be86..5e4e818 100644
--- a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPAddress.java
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPAddress.java
@@ -1,7 +1,13 @@
 package org.projectfloodlight.openflow.types;
 
+import java.net.Inet4Address;
+import java.net.Inet6Address;
+import java.net.InetAddress;
+
 import javax.annotation.Nonnull;
 
+import com.google.common.base.Preconditions;
+
 public abstract class IPAddress<F extends IPAddress<F>> implements OFValueType<F> {
 
     public abstract IPVersion getIpVersion();
@@ -66,9 +72,7 @@
      */
     @Nonnull
     public static IPAddress<?> of(@Nonnull String ip) {
-        if (ip == null) {
-            throw new NullPointerException("String ip must not be null");
-        }
+        Preconditions.checkNotNull(ip, "ip must not be null");
         if (ip.indexOf('.') != -1)
             return IPv4Address.of(ip);
         else if (ip.indexOf(':') != -1)
@@ -77,4 +81,21 @@
             throw new IllegalArgumentException("IP Address not well formed: " + ip);
     }
 
+    /**
+     * Factory function for InetAddress values.
+     * @param address the InetAddress you wish to parse into an IPAddress object.
+     * @return the IPAddress object.
+     * @throws NullPointerException if address is null
+     */
+    @Nonnull
+    public static IPAddress<?> fromInetAddress(@Nonnull InetAddress address) {
+        Preconditions.checkNotNull(address, "address must not be null");
+        byte [] bytes = address.getAddress();
+        if(address instanceof Inet4Address)
+            return IPv4Address.of(bytes);
+        else if (address instanceof Inet6Address)
+            return IPv6Address.of(bytes);
+        else
+            return IPAddress.of(address.getHostAddress());
+    }
 }
diff --git a/java_gen/pre-written/src/test/java/org/projectfloodlight/openflow/types/IPAddressTest.java b/java_gen/pre-written/src/test/java/org/projectfloodlight/openflow/types/IPAddressTest.java
index 25fc943..865df75 100644
--- a/java_gen/pre-written/src/test/java/org/projectfloodlight/openflow/types/IPAddressTest.java
+++ b/java_gen/pre-written/src/test/java/org/projectfloodlight/openflow/types/IPAddressTest.java
@@ -1,6 +1,9 @@
 package org.projectfloodlight.openflow.types;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+
+import java.net.UnknownHostException;
 
 import org.junit.Test;
 
@@ -51,4 +54,14 @@
         }
     }
 
+    @Test
+    public void testFromInetAddressException() throws UnknownHostException {
+        try {
+            IPAddress.fromInetAddress(null);
+            fail("Should have thrown NullPointerException");
+        } catch (NullPointerException e) {
+            assertNotNull(e.getMessage());
+        }
+    }
+
 }