]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-ospf.c
Fixed some warnings, added print-zep.c to CMakeLists
[tcpdump] / print-ospf.c
index 959df23fbc433683ea8ab1af4eb27d1e7bd339e3..2a502a6c8c4d26fb435b4c7aeaa9697e8d809852 100644 (file)
@@ -36,7 +36,6 @@
 
 #include "ospf.h"
 
-static const char tstr[] = " [|ospf2]";
 
 static const struct tok ospf_option_values[] = {
         { OSPF_OPTION_T,       "MultiTopology" }, /* draft-ietf-ospf-mt-09 */
@@ -180,7 +179,7 @@ static const struct tok ospf_lls_eo_options[] = {
 };
 
 int
-ospf_print_grace_lsa(netdissect_options *ndo,
+ospf_grace_lsa_print(netdissect_options *ndo,
                      const u_char *tptr, u_int ls_length)
 {
     u_int tlv_type, tlv_length;
@@ -263,7 +262,7 @@ trunc:
 }
 
 int
-ospf_print_te_lsa(netdissect_options *ndo,
+ospf_te_lsa_print(netdissect_options *ndo,
                   const u_char *tptr, u_int ls_length)
 {
     u_int tlv_type, tlv_length, subtlv_type, subtlv_length;
@@ -504,7 +503,7 @@ ospf_print_te_lsa(netdissect_options *ndo,
 trunc:
     return -1;
 invalid:
-    ND_PRINT("%s", istr);
+    nd_print_invalid(ndo);
     return -1;
 }
 
@@ -692,7 +691,7 @@ ospf_print_lsa(netdissect_options *ndo,
                ND_TCHECK_4(lsap->lsa_un.un_nla.nla_mask);
                ND_PRINT("\n\t    Mask %s\n\t    Connected Routers:",
                    ipaddr_string(ndo, lsap->lsa_un.un_nla.nla_mask));
-               ap = &lsap->lsa_un.un_nla.nla_router[0];
+               ap = lsap->lsa_un.un_nla.nla_router;
                while ((const u_char *)ap < ls_end) {
                        ND_TCHECK_SIZE(ap);
                        ND_PRINT("\n\t      %s", ipaddr_string(ndo, *ap));
@@ -852,14 +851,14 @@ ospf_print_lsa(netdissect_options *ndo,
                 break;
 
             case LS_OPAQUE_TYPE_GRACE:
-                if (ospf_print_grace_lsa(ndo, (const u_char *)(lsap->lsa_un.un_grace_tlv),
+                if (ospf_grace_lsa_print(ndo, (const u_char *)(lsap->lsa_un.un_grace_tlv),
                                          ls_length) == -1) {
                     return(ls_end);
                 }
                 break;
 
            case LS_OPAQUE_TYPE_TE:
-                if (ospf_print_te_lsa(ndo, (const u_char *)(lsap->lsa_un.un_te_lsa_tlv),
+                if (ospf_te_lsa_print(ndo, (const u_char *)(lsap->lsa_un.un_te_lsa_tlv),
                                       ls_length) == -1) {
                     return(ls_end);
                 }
@@ -1111,6 +1110,7 @@ ospf_print(netdissect_options *ndo,
        const u_char *dataend;
        const char *cp;
 
+       ndo->ndo_protocol = "ospf2";
        op = (const struct ospfhdr *)bp;
 
        /* XXX Before we do anything else, strip off the MD5 trailer */
@@ -1167,7 +1167,7 @@ ospf_print(netdissect_options *ndo,
 
                case OSPF_AUTH_SIMPLE:
                        ND_PRINT("\n\tSimple text password: ");
-                       safeputs(ndo, op->ospf_authdata, OSPF_AUTH_SIMPLE_LEN);
+                       (void)nd_printzp(ndo, op->ospf_authdata, OSPF_AUTH_SIMPLE_LEN, NULL);
                        break;
 
                case OSPF_AUTH_MD5:
@@ -1201,5 +1201,5 @@ ospf_print(netdissect_options *ndo,
 
        return;
 trunc:
-       ND_PRINT("%s", tstr);
+       nd_print_trunc(ndo);
 }