]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-lisp.c
Update the GitHub issue template for the new workflow
[tcpdump] / print-lisp.c
index 24255564d8dc3f5d16ad80fe9fd998629ffbe965..226f9757ce9dd3fe264b56f65b591c4ede9ac8fd 100644 (file)
@@ -128,12 +128,12 @@ enum {
 };
 
 static const struct tok lisp_type [] = {
-       { 0, "LISP-Reserved"                     },
-       { 1, "LISP-Map-Request"                  },
-       { 2, "LISP-Map-Reply"                    },
-       { 3, "LISP-Map-Register"                 },
-       { 4, "LISP-Map-Notify"                   },
-       { 8, "LISP-Encapsulated-Control-Message" },
+       { 0, "Reserved"                  },
+       { 1, "Map-Request"                       },
+       { 2, "Map-Reply"                         },
+       { 3, "Map-Register"              },
+       { 4, "Map-Notify"                        },
+       { 8, "Encapsulated-Control-Message" },
        { 0, NULL }
 };
 
@@ -245,6 +245,8 @@ lisp_print(netdissect_options *ndo, const u_char *bp, u_int length)
        const lisp_map_register_loc *lisp_loc;
 
        ndo->ndo_protocol = "lisp";
+       nd_print_protocol_caps(ndo);
+       ND_ICHECK_ZU(length, <, MAP_REGISTER_HDR_LEN);
        lisp_hdr = (const lisp_map_register_hdr *) bp;
        lisp_hdr_flag(ndo, lisp_hdr);
        /* Supporting only MAP NOTIFY and MAP REGISTER LISP packets */
@@ -268,14 +270,18 @@ lisp_print(netdissect_options *ndo, const u_char *bp, u_int length)
                ND_PRINT("\n    %u record(s), ", record_count);
                ND_PRINT("Authentication %s,",
                         tok2str(auth_type, "unknown-type", key_id));
+               ND_ICHECKMSG_ZU("authentication data length", auth_data_len, >,
+                               length - MAP_REGISTER_HDR_LEN);
                hex_print(ndo, "\n    Authentication-Data: ",
                          bp + packet_offset, auth_data_len);
        } else {
                ND_PRINT(" %u record(s),", record_count);
+               ND_ICHECKMSG_ZU("authentication data length", auth_data_len, >,
+                               length - MAP_REGISTER_HDR_LEN);
        }
        packet_offset += auth_data_len;
 
-       ND_ICHECK_U(record_count, ==, 0);
+       ND_ICHECKMSG_U("record count", record_count, ==, 0);
 
        /* Print all the EID records */
        while ((length > packet_offset) && (record_count != 0)) {
@@ -310,6 +316,8 @@ lisp_print(netdissect_options *ndo, const u_char *bp, u_int length)
                        packet_offset += 16;
                        break;
                default:
+                       ND_PRINT(" [unsupported address family identifier %u]",
+                                eid_afi);
                        /*
                         * No support for LCAF right now.
                         */
@@ -400,7 +408,7 @@ static void lisp_hdr_flag(netdissect_options *ndo, const lisp_map_register_hdr *
 {
        uint8_t type = extract_lisp_type(GET_U_1(lisp_hdr->type_and_flag));
 
-       ND_PRINT("%s,", tok2str(lisp_type, "unknown-type-%u", type));
+       ND_PRINT("-%s,", tok2str(lisp_type, "unknown-type-%u", type));
        if (!ndo->ndo_vflag)
                return;