]> git.proxmox.com Git - mirror_frr.git/commitdiff
ospfd: Cleanup some warnings that were not warnings
authorDonald Sharp <sharpd@cumulusnetworks.com>
Mon, 20 Aug 2018 18:05:53 +0000 (14:05 -0400)
committerQuentin Young <qlyoung@cumulusnetworks.com>
Thu, 6 Sep 2018 20:50:58 +0000 (20:50 +0000)
1) stream allocation cannot fail
2) some warnings were removed when functions safely ignored
the calling parameters being wrong.
3) some warnings were removed when functions did not consider
the state as an error since we did not return an error code.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
ospfd/ospf_ext.c
ospfd/ospf_interface.c
ospfd/ospf_lsa.c
ospfd/ospf_lsdb.c
ospfd/ospf_ri.c
ospfd/ospf_sr.c
ospfd/ospf_te.c
ospfd/ospf_zebra.c
ospfd/ospfd.c

index f6ed9b81b964d04915f6f9b9f01e64e7998be741..25b27d442b688ce251180f645b386ae7d8ff1965 100644 (file)
@@ -538,8 +538,6 @@ static int ospf_ext_link_new_if(struct interface *ifp)
        int rc = -1;
 
        if (lookup_ext_by_ifp(ifp) != NULL) {
-               zlog_warn("EXT (%s): interface %s is already in use", __func__,
-                         ifp ? ifp->name : "-");
                rc = 0; /* Do nothing here. */
                return rc;
        }
@@ -929,10 +927,6 @@ static struct ospf_lsa *ospf_ext_pref_lsa_new(struct ospf_area *area,
 
        /* Create a stream for LSA. */
        s = stream_new(OSPF_MAX_LSA_SIZE);
-       if (s == NULL) {
-               zlog_warn("EXT (%s): stream_new() error", __func__);
-               return NULL;
-       }
 
        /* Prepare LSA Header */
        lsah = (struct lsa_header *)STREAM_DATA(s);
@@ -1007,10 +1001,6 @@ static struct ospf_lsa *ospf_ext_link_lsa_new(struct ospf_area *area,
 
        /* Create a stream for LSA. */
        s = stream_new(OSPF_MAX_LSA_SIZE);
-       if (s == NULL) {
-               zlog_warn("EXT (%s): stream_new() error", __func__);
-               return NULL;
-       }
        lsah = (struct lsa_header *)STREAM_DATA(s);
 
        options = OSPF_OPTION_O;          /* Don't forget this :-) */
index 24584f671312912113614856b7eb4c90de5a1d11..2ad36ae364a3a98db3811067d2fad86b14b92fd3 100644 (file)
@@ -1033,7 +1033,7 @@ static int ospf_vl_set_params(struct ospf_vl_data *vl_data, struct vertex *v)
                 * there should be due to the ospf_spf_has_link() check
                 * in SPF. Lets warn and try pick a link anyway.
                 */
-               zlog_warn("ospf_vl_set_params: No backlink for %s!",
+               zlog_info("ospf_vl_set_params: No backlink for %s!",
                          vl_data->vl_oi->ifp->name);
                for (i = 0; i < ntohs(rl->links); i++) {
                        switch (rl->link[i].type) {
index 7c8a68994fbba2dc6020af6934d0bef870458547..c3c720b6784618dd0f9311d8f5722ae36bf77a3f 100644 (file)
@@ -2522,15 +2522,8 @@ void ospf_discard_from_db(struct ospf *ospf, struct ospf_lsdb *lsdb,
 {
        struct ospf_lsa *old;
 
-       if (!lsdb) {
-               zlog_warn("%s: Called with NULL lsdb!", __func__);
-               if (!lsa)
-                       zlog_warn("%s: and NULL LSA!", __func__);
-               else
-                       zlog_warn("LSA[Type%d:%s]: not associated with LSDB!",
-                                 lsa->data->type, inet_ntoa(lsa->data->id));
+       if (!lsdb)
                return;
-       }
 
        old = ospf_lsdb_lookup(lsdb, lsa);
 
index ef965a5f911b1e16a01fa6449040b7645b3fd244..f39bea97684c1793fe19171ad77a9503c2a41e03 100644 (file)
@@ -142,19 +142,8 @@ void ospf_lsdb_delete(struct ospf_lsdb *lsdb, struct ospf_lsa *lsa)
        struct prefix_ls lp;
        struct route_node *rn;
 
-       if (!lsdb) {
-               zlog_warn("%s: Called with NULL LSDB", __func__);
-               if (lsa)
-                       zlog_warn("LSA[Type%d:%s]: LSA %p, lsa->lsdb %p",
-                                 lsa->data->type, inet_ntoa(lsa->data->id),
-                                 (void *)lsa, (void *)lsa->lsdb);
+       if (!lsdb || !lsa)
                return;
-       }
-
-       if (!lsa) {
-               zlog_warn("%s: Called with NULL LSA", __func__);
-               return;
-       }
 
        assert(lsa->data->type < OSPF_MAX_LSA);
        table = lsdb->type[lsa->data->type].db;
index c9d0a53c8dc1cf42c7504866d4fb8b2ab808508c..4f6e1be0f469bebe2d6775416fa281d7762d5e64 100644 (file)
@@ -742,10 +742,8 @@ static struct ospf_lsa *ospf_router_info_lsa_new()
        uint16_t length;
 
        /* Create a stream for LSA. */
-       if ((s = stream_new(OSPF_MAX_LSA_SIZE)) == NULL) {
-               zlog_warn("ospf_router_info_lsa_new: stream_new() ?");
-               return NULL;
-       }
+       s = stream_new(OSPF_MAX_LSA_SIZE);
+
        lsah = (struct lsa_header *)STREAM_DATA(s);
 
        options = OSPF_OPTION_E;  /* Enable AS external as we flood RI with
index 62eca156f55d4ffbd694208c85bded837e9174f1..fc8899cc855d079a686a00740cb9fef832f91259 100644 (file)
@@ -233,10 +233,6 @@ static int ospf_sr_start(struct ospf *ospf)
        srn = hash_get(OspfSR.neighbors, (void *)&(ospf->router_id),
                       (void *)sr_node_new);
 
-       /* Sanity Check */
-       if (srn == NULL)
-               return rc;
-
        /* Complete & Store self SR Node */
        srn->srgb.range_size = OspfSR.srgb.range_size;
        srn->srgb.lower_bound = OspfSR.srgb.lower_bound;
@@ -1702,10 +1698,7 @@ DEFUN(ospf_sr_enable,
 
        /* Start Segment Routing */
        OspfSR.enabled = true;
-       if (!ospf_sr_start(ospf)) {
-               zlog_warn("SR: Unable to start Segment Routing. Abort!");
-               return CMD_WARNING;
-       }
+       ospf_sr_start(ospf);
 
        /* Set Router Information SR parameters */
        if (IS_DEBUG_OSPF_EVENT)
@@ -1990,7 +1983,7 @@ DEFUN (sr_prefix_sid,
                 * update of this Extended Prefix
                 */
                listnode_add(OspfSR.self->ext_prefix, new);
-               zlog_warn(
+               zlog_info(
                        "Interface for prefix %s/%u not found. Deferred LSA "
                        "flooding",
                        inet_ntoa(p.u.prefix4), p.prefixlen);
index a9dc1c18e392e110701acbbdc991215a6bf25fd7..f8722f9c868aa67cc92bd7ff60008cebc5d1105e 100644 (file)
@@ -1146,10 +1146,7 @@ static struct ospf_lsa *ospf_mpls_te_lsa_new(struct ospf *ospf,
        uint16_t length;
 
        /* Create a stream for LSA. */
-       if ((s = stream_new(OSPF_MAX_LSA_SIZE)) == NULL) {
-               zlog_warn("ospf_mpls_te_lsa_new: stream_new() ?");
-               return NULL;
-       }
+       s = stream_new(OSPF_MAX_LSA_SIZE);
        lsah = (struct lsa_header *)STREAM_DATA(s);
 
        options = OSPF_OPTION_O; /* Don't forget this :-) */
@@ -1286,7 +1283,7 @@ static int ospf_mpls_te_lsa_originate_area(void *arg)
                if (CHECK_FLAG(lp->flags, LPFLG_LSA_ENGAGED)) {
                        if (CHECK_FLAG(lp->flags, LPFLG_LSA_FORCED_REFRESH)) {
                                UNSET_FLAG(lp->flags, LPFLG_LSA_FORCED_REFRESH);
-                               zlog_warn(
+                               zlog_info(
                                        "OSPF MPLS-TE (ospf_mpls_te_lsa_originate_area): Refresh instead of Originate");
                                ospf_mpls_te_lsa_schedule(lp, REFRESH_THIS_LSA);
                        }
@@ -1294,7 +1291,7 @@ static int ospf_mpls_te_lsa_originate_area(void *arg)
                }
 
                if (!is_mandated_params_set(lp)) {
-                       zlog_warn(
+                       zlog_info(
                                "ospf_mpls_te_lsa_originate_area: Link(%s) lacks some mandated MPLS-TE parameters.",
                                lp->ifp ? lp->ifp->name : "?");
                        continue;
index 8c94a8ef9949bde227fa446aa0b05d7014a7e82e..5dfea4378be6943ba513dc5ea04101e848ab8f84 100644 (file)
@@ -152,10 +152,6 @@ static int ospf_interface_delete(int command, struct zclient *zclient,
        if (ifp == NULL)
                return 0;
 
-       if (if_is_up(ifp))
-               zlog_warn("Zebra: got delete of %s, but interface is still up",
-                         ifp->name);
-
        if (IS_DEBUG_OSPF(zebra, ZEBRA_INTERFACE))
                zlog_debug(
                        "Zebra: interface delete %s vrf %s[%u] index %d flags %llx metric %d mtu %d",
index d311b4da6b75e32664cb9796779fbfb25e78255e..6a8148c62375d1d87923318773b8989acaa4dbf4 100644 (file)
@@ -308,12 +308,8 @@ static struct ospf *ospf_new(unsigned short instance, const char *name)
                         new->lsa_refresh_interval, &new->t_lsa_refresher);
        new->lsa_refresher_started = monotime(NULL);
 
-       if ((new->ibuf = stream_new(OSPF_MAX_PACKET_SIZE + 1)) == NULL) {
-               zlog_err(
-                       "ospf_new: fatal error: stream_new(%u) failed allocating ibuf",
-                       OSPF_MAX_PACKET_SIZE + 1);
-               exit(1);
-       }
+       new->ibuf = stream_new(OSPF_MAX_PACKET_SIZE + 1);
+
        new->t_read = NULL;
        new->oi_write_q = list_new();
        new->write_oi_count = OSPF_WRITE_INTERFACE_COUNT_DEFAULT;