Upgrade tcpdump to tcpdump-4.99.1

Test: make
Change-Id: I052ed8f5279c806e4d2ff925f581b71db3ac03c0
diff --git a/print-msdp.c b/print-msdp.c
index 50bafb0..7845116 100644
--- a/print-msdp.c
+++ b/print-msdp.c
@@ -19,10 +19,10 @@
 /* \summary: Multicast Source Discovery Protocol (MSDP) printer */
 
 #ifdef HAVE_CONFIG_H
-#include "config.h"
+#include <config.h>
 #endif
 
-#include <netdissect-stdinc.h>
+#include "netdissect-stdinc.h"
 
 #include "netdissect.h"
 #include "addrtoname.h"
@@ -35,56 +35,57 @@
 {
 	unsigned int type, len;
 
-	ND_TCHECK2(*sp, 3);
+	ndo->ndo_protocol = "msdp";
+	ND_PRINT(": ");
+	nd_print_protocol(ndo);
 	/* See if we think we're at the beginning of a compound packet */
-	type = *sp;
-	len = EXTRACT_16BITS(sp + 1);
+	type = GET_U_1(sp);
+	len = GET_BE_U_2(sp + 1);
 	if (len > 1500 || len < 3 || type == 0 || type > MSDP_TYPE_MAX)
 		goto trunc;	/* not really truncated, but still not decodable */
-	ND_PRINT((ndo, " msdp:"));
-	while (length > 0) {
-		ND_TCHECK2(*sp, 3);
-		type = *sp;
-		len = EXTRACT_16BITS(sp + 1);
+	while (length != 0) {
+		type = GET_U_1(sp);
+		len = GET_BE_U_2(sp + 1);
 		if (len > 1400 || ndo->ndo_vflag)
-			ND_PRINT((ndo, " [len %u]", len));
+			ND_PRINT(" [len %u]", len);
 		if (len < 3)
 			goto trunc;
+		if (length < len)
+			goto trunc;
 		sp += 3;
 		length -= 3;
 		switch (type) {
 		case 1:	/* IPv4 Source-Active */
 		case 3: /* IPv4 Source-Active Response */
 			if (type == 1)
-				ND_PRINT((ndo, " SA"));
+				ND_PRINT(" SA");
 			else
-				ND_PRINT((ndo, " SA-Response"));
-			ND_TCHECK(*sp);
-			ND_PRINT((ndo, " %u entries", *sp));
-			if ((u_int)((*sp * 12) + 8) < len) {
-				ND_PRINT((ndo, " [w/data]"));
+				ND_PRINT(" SA-Response");
+			ND_PRINT(" %u entries", GET_U_1(sp));
+			if ((u_int)((GET_U_1(sp) * 12) + 8) < len) {
+				ND_PRINT(" [w/data]");
 				if (ndo->ndo_vflag > 1) {
-					ND_PRINT((ndo, " "));
-					ip_print(ndo, sp + *sp * 12 + 8 - 3,
-					         len - (*sp * 12 + 8));
+					ND_PRINT(" ");
+					ip_print(ndo, sp +
+						 GET_U_1(sp) * 12 + 8 - 3,
+						 len - (GET_U_1(sp) * 12 + 8));
 				}
 			}
 			break;
 		case 2:
-			ND_PRINT((ndo, " SA-Request"));
-			ND_TCHECK2(*sp, 5);
-			ND_PRINT((ndo, " for %s", ipaddr_string(ndo, sp + 1)));
+			ND_PRINT(" SA-Request");
+			ND_PRINT(" for %s", GET_IPADDR_STRING(sp + 1));
 			break;
 		case 4:
-			ND_PRINT((ndo, " Keepalive"));
+			ND_PRINT(" Keepalive");
 			if (len != 3)
-				ND_PRINT((ndo, "[len=%d] ", len));
+				ND_PRINT("[len=%u] ", len);
 			break;
 		case 5:
-			ND_PRINT((ndo, " Notification"));
+			ND_PRINT(" Notification");
 			break;
 		default:
-			ND_PRINT((ndo, " [type=%d len=%d]", type, len));
+			ND_PRINT(" [type=%u len=%u]", type, len);
 			break;
 		}
 		sp += (len - 3);
@@ -92,12 +93,5 @@
 	}
 	return;
 trunc:
-	ND_PRINT((ndo, " [|msdp]"));
+	nd_print_trunc(ndo);
 }
-
-/*
- * Local Variables:
- * c-style: whitesmith
- * c-basic-offset: 8
- * End:
- */