]> git.proxmox.com Git - mirror_frr.git/blobdiff - ospfd/ospf_lsa.c
zebra, lib: fix the ZEBRA_INTERFACE_VRF_UPDATE zapi message
[mirror_frr.git] / ospfd / ospf_lsa.c
index c3c720b6784618dd0f9311d8f5722ae36bf77a3f..288ce43f79dae78b413d2be0c27d6ec6b8cddcce 100644 (file)
@@ -50,7 +50,7 @@
 #include "ospfd/ospf_ase.h"
 #include "ospfd/ospf_zebra.h"
 #include "ospfd/ospf_abr.h"
-
+#include "ospfd/ospf_errors.h"
 
 uint32_t get_metric(uint8_t *metric)
 {
@@ -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(EC_OSPF_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(
+                               EC_OSPF_LSA_SIZE,
                                "%s: Out of space in LSA stream, left %zd, size %zd",
                                __func__, STREAM_WRITEABLE(*s),
                                STREAM_SIZE(*s));
@@ -1817,12 +1819,11 @@ struct ospf_lsa *ospf_translated_nssa_originate(struct ospf *ospf,
        }
 
        if ((new = ospf_lsa_install(ospf, NULL, new)) == NULL) {
-               if (IS_DEBUG_OSPF_NSSA)
-                       zlog_debug(
-                               "ospf_lsa_translated_nssa_originate(): "
-                               "Could not install LSA "
-                               "id %s",
-                               inet_ntoa(type7->data->id));
+               flog_warn(EC_OSPF_LSA_INSTALL_FAILURE,
+                         "ospf_lsa_translated_nssa_originate(): "
+                         "Could not install LSA "
+                         "id %s",
+                         inet_ntoa(type7->data->id));
                return NULL;
        }
 
@@ -1890,7 +1891,7 @@ struct ospf_lsa *ospf_translated_nssa_refresh(struct ospf *ospf,
                        zlog_debug(
                                "ospf_translated_nssa_refresh(): no Type-7 found for "
                                "Type-5 LSA Id %s",
-                               type5 ? inet_ntoa(type5->data->id) : "(null)");
+                               inet_ntoa(type5->data->id));
                return NULL;
        }
 
@@ -1900,7 +1901,7 @@ struct ospf_lsa *ospf_translated_nssa_refresh(struct ospf *ospf,
                        zlog_debug(
                                "ospf_translated_nssa_refresh(): No translated Type-5 "
                                "found for Type-7 with Id %s",
-                               type7 ? inet_ntoa(type7->data->id) : "(null)");
+                               inet_ntoa(type7->data->id));
                return NULL;
        }
 
@@ -1913,16 +1914,15 @@ struct ospf_lsa *ospf_translated_nssa_refresh(struct ospf *ospf,
                        zlog_debug(
                                "ospf_translated_nssa_refresh(): Could not translate "
                                "Type-7 for %s to Type-5",
-                               type7 ? inet_ntoa(type7->data->id) : "(null)");
+                               inet_ntoa(type7->data->id));
                return NULL;
        }
 
        if (!(new = ospf_lsa_install(ospf, NULL, new))) {
-               if (IS_DEBUG_OSPF_NSSA)
-                       zlog_debug(
-                               "ospf_translated_nssa_refresh(): Could not install "
-                               "translated LSA, Id %s",
-                               inet_ntoa(type7->data->id));
+               flog_warn(
+                       EC_OSPF_LSA_INSTALL_FAILURE,
+                       "ospf_translated_nssa_refresh(): Could not install translated LSA, Id %s",
+                       inet_ntoa(type7->data->id));
                return NULL;
        }
 
@@ -2043,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(
+                                       EC_OSPF_LSA_INSTALL_FAILURE,
+                                       "LSA: AS-external-LSA was not originated.");
+               }
+       }
 
        return 0;
 }
@@ -2834,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
@@ -3622,7 +3633,7 @@ void ospf_refresher_unregister_lsa(struct ospf *ospf, struct ospf_lsa *lsa)
                        ospf->lsa_refresh_queue.qs[lsa->refresh_list];
                listnode_delete(refresh_list, lsa);
                if (!listcount(refresh_list)) {
-                       list_delete_and_null(&refresh_list);
+                       list_delete(&refresh_list);
                        ospf->lsa_refresh_queue.qs[lsa->refresh_list] = NULL;
                }
                ospf_lsa_unlock(&lsa); /* lsa_refresh_queue */
@@ -3691,7 +3702,7 @@ int ospf_lsa_refresh_walker(struct thread *t)
                                lsa->refresh_list = -1;
                                listnode_add(lsa_to_refresh, lsa);
                        }
-                       list_delete_and_null(&refresh_list);
+                       list_delete(&refresh_list);
                }
        }
 
@@ -3707,7 +3718,7 @@ int ospf_lsa_refresh_walker(struct thread *t)
                        &lsa); /* lsa_refresh_queue & temp for lsa_to_refresh*/
        }
 
-       list_delete_and_null(&lsa_to_refresh);
+       list_delete(&lsa_to_refresh);
 
        if (IS_DEBUG_OSPF(lsa, LSA_REFRESH))
                zlog_debug("LSA[Refresh]: ospf_lsa_refresh_walker(): end");