lp: Packet::wireDecode checks TLV-TYPE of Block before decoding

refs #3256

Change-Id: Ia0fe8f88416eeecf969cc1a585e3625efe42e866
diff --git a/src/lp/packet.cpp b/src/lp/packet.cpp
index 82b7821..c839666 100644
--- a/src/lp/packet.cpp
+++ b/src/lp/packet.cpp
@@ -97,6 +97,10 @@
     return;
   }
 
+  if (wire.type() != tlv::LpPacket) {
+    BOOST_THROW_EXCEPTION(Error("unrecognized TLV-TYPE " + to_string(wire.type())));
+  }
+
   wire.parse();
 
   bool isFirst = true;
@@ -105,7 +109,7 @@
     detail::FieldInfo info(element.type());
 
     if (!info.isRecognized && !info.canIgnore) {
-      BOOST_THROW_EXCEPTION(Error("unknown field cannot be ignored"));
+      BOOST_THROW_EXCEPTION(Error("unrecognized field cannot be ignored"));
     }
 
     if (!isFirst) {
diff --git a/src/lp/packet.hpp b/src/lp/packet.hpp
index eed6b51..aa77a4f 100644
--- a/src/lp/packet.hpp
+++ b/src/lp/packet.hpp
@@ -60,6 +60,7 @@
 
   /**
    * \brief decode packet from wire format
+   * \throws Error unknown TLV-TYPE
    */
   void
   wireDecode(const Block& wire);