diff --git a/src/main/java/net/floodlightcontroller/packet/UDP.java b/src/main/java/net/floodlightcontroller/packet/UDP.java
index a5ee35f2c24971cca72c6d183bc2de2bea184f88..930e6259f6635a81118ed13150bd2b0231741d12 100644
--- a/src/main/java/net/floodlightcontroller/packet/UDP.java
+++ b/src/main/java/net/floodlightcontroller/packet/UDP.java
@@ -1,7 +1,7 @@
 /**
-*    Copyright 2011, Big Switch Networks, Inc. 
+*    Copyright 2011, Big Switch Networks, Inc.
 *    Originally created by David Erickson, Stanford University
-* 
+*
 *    Licensed under the Apache License, Version 2.0 (the "License"); you may
 *    not use this file except in compliance with the License. You may obtain
 *    a copy of the License at
@@ -18,6 +18,7 @@
 package net.floodlightcontroller.packet;
 
 import java.nio.ByteBuffer;
+import java.util.Arrays;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -39,7 +40,7 @@ public class UDP extends BasePacket {
          */
         UDP.decodeMap.put(DHCP_CLIENT_PORT, DHCP.class);
         UDP.decodeMap.put(DHCP_SERVER_PORT, DHCP.class);
-        
+
     }
 
     protected TransportPort sourcePort;
@@ -61,7 +62,7 @@ public class UDP extends BasePacket {
         this.sourcePort = sourcePort;
         return this;
     }
-    
+
     /**
      * @param sourcePort the sourcePort to set
      */
@@ -84,7 +85,7 @@ public class UDP extends BasePacket {
         this.destinationPort = destinationPort;
         return this;
     }
-    
+
     /**
      * @param destinationPort the destinationPort to set
      */
@@ -227,6 +228,14 @@ public class UDP extends BasePacket {
         this.destinationPort = TransportPort.of((int) (bb.getShort() & 0xffff)); // convert range 0 to 65534, not -32768 to 32767
         this.length = bb.getShort();
         this.checksum = bb.getShort();
+        // Grab a snapshot of the first four bytes of the UDP payload.
+        // We will use these to see if the payload is SPUD, without
+        // disturbing the existing byte buffer's offsets.
+        ByteBuffer bb_spud = bb.slice();
+        byte[] maybe_spud_bytes = new byte[SPUD.MAGIC_CONSTANT.length];
+        if (bb_spud.remaining() >= SPUD.MAGIC_CONSTANT.length) {
+            bb_spud.get(maybe_spud_bytes, 0, SPUD.MAGIC_CONSTANT.length);
+        }
 
         if (UDP.decodeMap.containsKey(this.destinationPort)) {
             try {
@@ -240,6 +249,8 @@ public class UDP extends BasePacket {
             } catch (Exception e) {
                 throw new RuntimeException("Failure instantiating class", e);
             }
+        } else if (Arrays.equals(maybe_spud_bytes, SPUD.MAGIC_CONSTANT)) {
+            this.payload = new SPUD();
         } else {
             this.payload = new Data();
         }