CORD-2870: Bypass DHCP leasequery without learning routes.

  Changes:
    * Add configuration flag to disable old leasequery routing/learning flow
    * Route leasequery (v4 and v6) responses to an originator
    * Fix NPE and BufferOverflow exceptions in Dhcp6LeaseQueryOption
    * Make Dhcp4/Dhcp6HandlerUtil classes static
    * Fix codestyle issues

Change-Id: Ic9e527d73a226e7f1f544dab9fb98398b85c5460
diff --git a/utils/misc/src/main/java/org/onlab/packet/dhcp/Dhcp6LeaseQueryOption.java b/utils/misc/src/main/java/org/onlab/packet/dhcp/Dhcp6LeaseQueryOption.java
index 5bcc8ba..baa2e6e 100644
--- a/utils/misc/src/main/java/org/onlab/packet/dhcp/Dhcp6LeaseQueryOption.java
+++ b/utils/misc/src/main/java/org/onlab/packet/dhcp/Dhcp6LeaseQueryOption.java
@@ -36,9 +36,11 @@
     //public short QueryType;
     public Ip6Address linkAddress;
     private List<Dhcp6Option> options;
+    public byte queryType;
 
     public Dhcp6LeaseQueryOption(Dhcp6Option dhcp6Option) {
         super(dhcp6Option);
+        options =  Lists.newArrayList();
     }
 
     @Override
@@ -66,10 +68,10 @@
             Dhcp6LeaseQueryOption lQ6Option = new Dhcp6LeaseQueryOption(dhcp6Option);
 
             byte[] optionData = lQ6Option.getData();
-            if (optionData.length >= 61) { // 61 is LQ option length + 4 header
+            if (optionData.length >= DEFAULT_LEN) {
                 ByteBuffer bb = ByteBuffer.wrap(optionData);
                 // fetch the Query type - just pop the byte from the byte buffer for subsequent parsing...
-                bb.get();
+                lQ6Option.queryType = bb.get();
                 byte[] ipv6Addr = new byte[16];
                 bb.get(ipv6Addr);
                 lQ6Option.linkAddress = Ip6Address.valueOf(ipv6Addr);
@@ -108,10 +110,13 @@
 
     @Override
     public byte[] serialize() {
-        ByteBuffer bb = ByteBuffer.allocate(this.getLength() + Dhcp6Option.DEFAULT_LEN);
+        byte[] serializedPayload = payload.serialize();
+
+        ByteBuffer bb = ByteBuffer.allocate(serializedPayload.length + Dhcp6Option.DEFAULT_LEN);
         bb.putShort(getCode());
         bb.putShort(getLength());
-        bb.put(payload.serialize());
+        bb.put(serializedPayload);
+
         return bb.array();
     }