]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-ospf6.c
Makefile.in: don't remove configure and config.h.in in make distclean.
[tcpdump] / print-ospf6.c
index b4cf7378363955a4c7e2b101427a6888793d9a4b..49167954e20c77cb0c10a1f8c861ffeaff94293c 100644 (file)
@@ -95,7 +95,7 @@
 #define        RLA_FLAG_E      0x02
 #define        RLA_FLAG_V      0x04
 #define        RLA_FLAG_W      0x08
-#define RLA_FLAG_N      0x10
+#define        RLA_FLAG_Nt     0x10
 
 /* lsa_prefix options */
 #define LSA_PREFIX_OPT_NU 0x01
 #define LSA_PREFIX_OPT_MC 0x04
 #define LSA_PREFIX_OPT_P  0x08
 #define LSA_PREFIX_OPT_DN 0x10
+#define LSA_PREFIX_OPT_N  0x20
 
 /* sla_tosmetric breakdown     */
 #define        SLA_MASK_TOS            0x7f000000
@@ -302,8 +303,8 @@ static const struct tok ospf6_rla_flag_values[] = {
        { RLA_FLAG_B,           "ABR" },
        { RLA_FLAG_E,           "External" },
        { RLA_FLAG_V,           "Virtual-Link Endpoint" },
-       { RLA_FLAG_W,           "Wildcard Receiver" },
-        { RLA_FLAG_N,           "NSSA Translator" },
+       { RLA_FLAG_W,           "Deprecated" },
+       { RLA_FLAG_Nt,          "NSSA Translator" },
        { 0,                    NULL }
 };
 
@@ -362,6 +363,7 @@ static const struct tok ospf6_lsa_prefix_option_values[] = {
         { LSA_PREFIX_OPT_MC, "Deprecated" },
         { LSA_PREFIX_OPT_P, "Propagate" },
         { LSA_PREFIX_OPT_DN, "Down" },
+        { LSA_PREFIX_OPT_N, "N-bit" },
        { 0, NULL }
 };
 
@@ -379,7 +381,7 @@ ospf6_print_ls_type(netdissect_options *ndo,
                ls_type & LS_TYPE_MASK,
                tok2str(ospf6_ls_scope_values, "Unknown", ls_type & LS_SCOPE_MASK),
                ls_type &0x8000 ? ", transitive" : "", /* U-bit */
-               GET_IPADDR_STRING((const u_char *)ls_stateid));
+               GET_IPADDR_STRING(ls_stateid));
 }
 
 static int
@@ -388,13 +390,12 @@ ospf6_print_lshdr(netdissect_options *ndo,
 {
        if ((const u_char *)(lshp + 1) > dataend)
                goto trunc;
-       ND_TCHECK_4(lshp->ls_router);
 
-       ND_PRINT("\n\t  Advertising Router %s, seq 0x%08x, age %us, length %u",
-               GET_IPADDR_STRING(lshp->ls_router),
-               GET_BE_U_4(lshp->ls_seq),
-               GET_BE_U_2(lshp->ls_age),
-               GET_BE_U_2(lshp->ls_length)-(u_int)sizeof(struct lsa6_hdr));
+       ND_PRINT("\n\t  Advertising Router %s, seq 0x%08x, age %us, length %zu",
+                GET_IPADDR_STRING(lshp->ls_router),
+                GET_BE_U_4(lshp->ls_seq),
+                GET_BE_U_2(lshp->ls_age),
+                GET_BE_U_2(lshp->ls_length)-sizeof(struct lsa6_hdr));
 
        ospf6_print_ls_type(ndo, GET_BE_U_2(lshp->ls_type),
                            &lshp->ls_stateid);
@@ -424,9 +425,8 @@ ospf6_print_lsaprefix(netdissect_options *ndo,
        if (lsa_length < wordlen * 4)
                goto trunc;
        lsa_length -= wordlen * 4;
-       ND_TCHECK_LEN(lsapp->lsa_p_prefix, wordlen * 4);
        memset(prefix, 0, sizeof(prefix));
-       memcpy(prefix, lsapp->lsa_p_prefix, wordlen * 4);
+       GET_CPY_BYTES(prefix, lsapp->lsa_p_prefix, wordlen * 4);
        ND_PRINT("\n\t\t%s/%u", ip6addr_string(ndo, prefix), /* local buffer, not packet data; don't use GET_IP6ADDR_STRING() */
                 GET_U_1(lsapp->lsa_p_len));
         if (GET_U_1(lsapp->lsa_p_opt)) {
@@ -552,8 +552,7 @@ ospf6_print_lsa(netdissect_options *ndo,
                        if (lsa_length < sizeof (*ap))
                                return (1);
                        lsa_length -= sizeof (*ap);
-                       ND_TCHECK_SIZE(ap);
-                       ND_PRINT("\n\t\t%s", GET_IPADDR_STRING(*ap));
+                       ND_PRINT("\n\t\t%s", GET_IPADDR_STRING(ap));
                        ++ap;
                }
                break;
@@ -608,7 +607,6 @@ ospf6_print_lsa(netdissect_options *ndo,
                        if (lsa_length < sizeof (nd_ipv6))
                                return (1);
                        lsa_length -= sizeof (nd_ipv6);
-                       ND_TCHECK_16(tptr);
                        ND_PRINT(" forward %s",
                                 GET_IP6ADDR_STRING(tptr));
                        tptr += sizeof(nd_ipv6);
@@ -618,7 +616,6 @@ ospf6_print_lsa(netdissect_options *ndo,
                        if (lsa_length < sizeof (uint32_t))
                                return (1);
                        lsa_length -= sizeof (uint32_t);
-                       ND_TCHECK_4(tptr);
                        ND_PRINT(" tag %s",
                               GET_IPADDR_STRING(tptr));
                        tptr += sizeof(uint32_t);
@@ -628,7 +625,6 @@ ospf6_print_lsa(netdissect_options *ndo,
                        if (lsa_length < sizeof (uint32_t))
                                return (1);
                        lsa_length -= sizeof (uint32_t);
-                       ND_TCHECK_4(tptr);
                        ND_PRINT(" RefLSID: %s",
                               GET_IPADDR_STRING(tptr));
                        tptr += sizeof(uint32_t);
@@ -765,8 +761,7 @@ ospf6_decode_v3(netdissect_options *ndo,
                        ND_PRINT("\n\t  Neighbor List:");
                        ap = hellop->hello_neighbor;
                        while ((const u_char *)ap < dataend) {
-                               ND_TCHECK_SIZE(ap);
-                               ND_PRINT("\n\t    %s", GET_IPADDR_STRING(*ap));
+                               ND_PRINT("\n\t    %s", GET_IPADDR_STRING(ap));
                                ++ap;
                        }
                }
@@ -895,7 +890,6 @@ ospf6_decode_at(netdissect_options *ndo,
                goto trunc;
        cp += 2;
        /* Reserved */
-       ND_TCHECK_2(cp);
        cp += 2;
        /* Security Association ID */
        ND_PRINT(", SAID %u", GET_BE_U_2(cp));
@@ -982,7 +976,6 @@ ospf6_print(netdissect_options *ndo,
        }
        dataend = bp + datalen;
 
-       ND_TCHECK_4(op->ospf6_routerid);
        ND_PRINT("\n\tRouter-ID %s", GET_IPADDR_STRING(op->ospf6_routerid));
 
        if (GET_BE_U_4(op->ospf6_areaid) != 0)