]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-ospf.c
Use the EXTRACT_U_1() macro in some utility functions
[tcpdump] / print-ospf.c
index 157a590ca0ce21066da22dc6047b537e7ce6b69f..a37b5b1fd4e8d7675d807eadf69d61111c599ed7 100644 (file)
@@ -644,7 +644,7 @@ ospf_print_lsa(netdissect_options *ndo,
 
                ND_TCHECK_2(lsap->lsa_un.un_rla.rla_count);
                j = EXTRACT_BE_U_2(lsap->lsa_un.un_rla.rla_count);
-               ND_TCHECK(lsap->lsa_un.un_rla.rla_link);
+               ND_TCHECK_SIZE(lsap->lsa_un.un_rla.rla_link);
                rlp = lsap->lsa_un.un_rla.rla_link;
                while (j--) {
                        ND_TCHECK_SIZE(rlp);
@@ -704,7 +704,7 @@ ospf_print_lsa(netdissect_options *ndo,
                ND_TCHECK_4(&lsap->lsa_un.un_nla.nla_mask);
                ND_PRINT("\n\t    Mask %s",
                    ipaddr_string(ndo, &lsap->lsa_un.un_sla.sla_mask));
-               ND_TCHECK(lsap->lsa_un.un_sla.sla_tosmetric);
+               ND_TCHECK_SIZE(lsap->lsa_un.un_sla.sla_tosmetric);
                lp = (const uint8_t *)lsap->lsa_un.un_sla.sla_tosmetric;
                while (lp < ls_end) {
                        uint32_t ul;
@@ -721,7 +721,7 @@ ospf_print_lsa(netdissect_options *ndo,
                break;
 
        case LS_TYPE_SUM_ABR:
-               ND_TCHECK(lsap->lsa_un.un_sla.sla_tosmetric);
+               ND_TCHECK_SIZE(lsap->lsa_un.un_sla.sla_tosmetric);
                lp = (const uint8_t *)lsap->lsa_un.un_sla.sla_tosmetric;
                while (lp < ls_end) {
                        uint32_t ul;
@@ -743,7 +743,7 @@ ospf_print_lsa(netdissect_options *ndo,
                ND_PRINT("\n\t    Mask %s",
                    ipaddr_string(ndo, &lsap->lsa_un.un_asla.asla_mask));
 
-               ND_TCHECK(lsap->lsa_un.un_sla.sla_tosmetric);
+               ND_TCHECK_SIZE(lsap->lsa_un.un_sla.sla_tosmetric);
                almp = lsap->lsa_un.un_asla.asla_metric;
                while ((const u_char *)almp < ls_end) {
                        uint32_t ul;
@@ -992,23 +992,23 @@ ospf_decode_v2(netdissect_options *ndo,
        switch (EXTRACT_U_1(op->ospf_type)) {
 
        case OSPF_TYPE_HELLO:
-               ND_TCHECK(op->ospf_hello.hello_options);
+               ND_TCHECK_1(op->ospf_hello.hello_options);
                ND_PRINT("\n\tOptions [%s]",
                          bittok2str(ospf_option_values,"none",EXTRACT_U_1(op->ospf_hello.hello_options)));
 
-               ND_TCHECK(op->ospf_hello.hello_deadint);
+               ND_TCHECK_4(op->ospf_hello.hello_deadint);
                ND_PRINT("\n\t  Hello Timer %us, Dead Timer %us, Mask %s, Priority %u",
                          EXTRACT_BE_U_2(op->ospf_hello.hello_helloint),
                          EXTRACT_BE_U_4(op->ospf_hello.hello_deadint),
                          ipaddr_string(ndo, &op->ospf_hello.hello_mask),
                          EXTRACT_U_1(op->ospf_hello.hello_priority));
 
-               ND_TCHECK(op->ospf_hello.hello_dr);
+               ND_TCHECK_4(&op->ospf_hello.hello_dr);
                if (op->ospf_hello.hello_dr.s_addr != 0)
                        ND_PRINT("\n\t  Designated Router %s",
                            ipaddr_string(ndo, &op->ospf_hello.hello_dr));
 
-               ND_TCHECK(op->ospf_hello.hello_bdr);
+               ND_TCHECK_4(&op->ospf_hello.hello_bdr);
                if (op->ospf_hello.hello_bdr.s_addr != 0)
                        ND_PRINT(", Backup Designated Router %s",
                                  ipaddr_string(ndo, &op->ospf_hello.hello_bdr));
@@ -1024,17 +1024,17 @@ ospf_decode_v2(netdissect_options *ndo,
                break;  /* HELLO */
 
        case OSPF_TYPE_DD:
-               ND_TCHECK(op->ospf_db.db_options);
+               ND_TCHECK_1(op->ospf_db.db_options);
                ND_PRINT("\n\tOptions [%s]",
                          bittok2str(ospf_option_values, "none", EXTRACT_U_1(op->ospf_db.db_options)));
-               ND_TCHECK(op->ospf_db.db_flags);
+               ND_TCHECK_1(op->ospf_db.db_flags);
                ND_PRINT(", DD Flags [%s]",
                          bittok2str(ospf_dd_flag_values, "none", EXTRACT_U_1(op->ospf_db.db_flags)));
-               ND_TCHECK(op->ospf_db.db_ifmtu);
+               ND_TCHECK_2(op->ospf_db.db_ifmtu);
                if (EXTRACT_BE_U_2(op->ospf_db.db_ifmtu)) {
                        ND_PRINT(", MTU: %u", EXTRACT_BE_U_2(op->ospf_db.db_ifmtu));
                }
-               ND_TCHECK(op->ospf_db.db_seq);
+               ND_TCHECK_4(op->ospf_db.db_seq);
                ND_PRINT(", Sequence: 0x%08x", EXTRACT_BE_U_4(op->ospf_db.db_seq));
 
                /* Print all the LS adv's */
@@ -1076,7 +1076,7 @@ ospf_decode_v2(netdissect_options *ndo,
 
        case OSPF_TYPE_LS_UPDATE:
                 lsap = op->ospf_lsu.lsu_lsa;
-                ND_TCHECK(op->ospf_lsu.lsu_count);
+                ND_TCHECK_4(op->ospf_lsu.lsu_count);
                 lsa_count_max = EXTRACT_BE_U_4(op->ospf_lsu.lsu_count);
                 ND_PRINT(", %u LSA%s", lsa_count_max, PLURAL_SUFFIX(lsa_count_max));
                 for (lsa_count=1;lsa_count <= lsa_count_max;lsa_count++) {