]> git.proxmox.com Git - mirror_frr.git/commitdiff
ospfd: Convert ospf_lsa.c to use new error-card Syntax
authorDonald Sharp <sharpd@cumulusnetworks.com>
Tue, 21 Aug 2018 13:22:33 +0000 (09:22 -0400)
committerQuentin Young <qlyoung@cumulusnetworks.com>
Thu, 6 Sep 2018 20:50:58 +0000 (20:50 +0000)
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
ospfd/ospf_errors.c
ospfd/ospf_errors.h
ospfd/ospf_lsa.c

index 0eb68755c2196fd535e57c3bbc7d4bd114f39e42..b3673a7f76a410501f66e2b34b8195863243797b 100644 (file)
@@ -97,6 +97,18 @@ static struct log_ref ferr_ospf_warn[] = {
                .description = "During processing of new LSA information, we attempted to look up an old LSA and it was not found",
                .suggestion = "Gather data from this machine and open an Issue",
        },
+       {
+               .code = OSPF_WARN_PTP_NEIGHBOR,
+               .title = "OSPF has detected more than 1 neighbor on a P2P interface",
+               .description = "If you configure a ospf interface as P2P we should not detect more than one neighbor on the interface",
+               .suggestion = "Fix your config",
+       },
+       {
+               .code = OSPF_WARN_LSA_SIZE,
+               .title = "OSPF has detected an invalid LSA size",
+               .description = "OSPF has detected a state where we are attempting to grow a LSA but the LSA has reached it's maximum size",
+               .suggestion = "Gather data and open an Issue",
+       },
        {
                .code = END_FERR,
        }
index 33fbec8889cd78203044ce96f9556a38e4307459..f0e9e3da93acc426cc4bddc35aab1f4d0b78c3b5 100644 (file)
@@ -44,6 +44,8 @@ enum ospf_log_refs {
        OSPF_WARN_LSA_NULL,
        OSPF_WARN_EXT_LSA_UNEXPECTED,
        OSPF_WARN_LSA_MISSING,
+       OSPF_WARN_PTP_NEIGHBOR,
+       OSPF_WARN_LSA_SIZE,
 };
 
 extern void ospf_error_init(void);
index b2056e59cb53b639d0ddb0c80793bfd13df5bcb4..4d46e9739bc353d9ba0bd6a6974e2f48cd5b31d4 100644 (file)
@@ -398,7 +398,8 @@ struct ospf_neighbor *ospf_nbr_lookup_ptop(struct ospf_interface *oi)
 
        /* PtoP link must have only 1 neighbor. */
        if (ospf_nbr_count(oi, 0) > 1)
-               zlog_warn("Point-to-Point link has more than 1 neighobrs.");
+               flog_warn(OSPF_WARN_PTP_NEIGHBOR,
+                         "Point-to-Point link has more than 1 neighobrs.");
 
        return nbr;
 }
@@ -446,7 +447,8 @@ static char link_info_set(struct stream **s, struct in_addr id,
                }
 
                if (ret == OSPF_MAX_LSA_SIZE) {
-                       zlog_warn(
+                       flog_warn(
+                               OSPF_WARN_LSA_SIZE,
                                "%s: Out of space in LSA stream, left %zd, size %zd",
                                __func__, STREAM_WRITEABLE(*s),
                                STREAM_SIZE(*s));
@@ -2041,19 +2043,28 @@ int ospf_external_lsa_originate_timer(struct thread *thread)
        if (!ext_list)
                return 0;
 
-       for (ALL_LIST_ELEMENTS_RO(ext_list, node, ext))
+       for (ALL_LIST_ELEMENTS_RO(ext_list, node, ext)) {
                /* Originate As-external-LSA from all type of distribute source.
                 */
-               if ((rt = ext->external_info))
-                       for (rn = route_top(rt); rn; rn = route_next(rn))
-                               if ((ei = rn->info) != NULL)
-                                       if (!is_prefix_default(
-                                                   (struct prefix_ipv4 *)&ei
-                                                           ->p))
-                                               if (!ospf_external_lsa_originate(
-                                                           ospf, ei))
-                                                       zlog_warn(
-                                                               "LSA: AS-external-LSA was not originated.");
+               rt = ext->external_info;
+               if (!rt)
+                       continue;
+
+               for (rn = route_top(rt); rn; rn = route_next(rn)) {
+                       ei = rn->info;
+
+                       if (!ei)
+                               continue;
+
+                       if (is_prefix_default((struct prefix_ipv4 *)&ei->p))
+                               continue;
+
+                       if (!ospf_external_lsa_originate(ospf, ei))
+                               flog_warn(
+                                       OSPF_WARN_LSA_INSTALL_FAILURE,
+                                       "LSA: AS-external-LSA was not originated.");
+               }
+       }
 
        return 0;
 }
@@ -2832,11 +2843,13 @@ static int ospf_maxage_lsa_remover(struct thread *thread)
                        if (lsa->lsdb) {
                                ospf_discard_from_db(ospf, lsa->lsdb, lsa);
                                ospf_lsdb_delete(lsa->lsdb, lsa);
-                       } else
-                               zlog_warn(
-                                       "%s: LSA[Type%d:%s]: No associated LSDB!",
-                                       __func__, lsa->data->type,
-                                       inet_ntoa(lsa->data->id));
+                       } else {
+                               if (IS_DEBUG_OSPF(lsa, LSA_FLOODING))
+                                       zlog_debug(
+                                               "%s: LSA[Type%d:%s]: No associated LSDB!",
+                                               __func__, lsa->data->type,
+                                               inet_ntoa(lsa->data->id));
+                       }
                }
 
        /*    A MaxAge LSA must be removed immediately from the router's link