diff options
| -rw-r--r-- | ospf6d/ospf6_area.h | 2 | ||||
| -rw-r--r-- | ospf6d/ospf6_neighbor.c | 4 | ||||
| -rw-r--r-- | ospf6d/ospf6_spf.c | 27 | ||||
| -rw-r--r-- | ospf6d/ospf6_top.c | 33 | ||||
| -rw-r--r-- | ospf6d/ospf6_top.h | 2 | ||||
| -rw-r--r-- | ospf6d/ospf6_zebra.c | 7 | ||||
| -rw-r--r-- | ospfd/ospf_ext.c | 2 | ||||
| -rw-r--r-- | ospfd/ospf_flood.c | 1 | ||||
| -rw-r--r-- | ospfd/ospf_sr.c | 10 | ||||
| -rw-r--r-- | ospfd/ospf_vty.c | 4 | ||||
| -rw-r--r-- | zebra/zebra_ptm.c | 9 | ||||
| -rw-r--r-- | zebra/zebra_vty.c | 12 |
12 files changed, 83 insertions, 30 deletions
diff --git a/ospf6d/ospf6_area.h b/ospf6d/ospf6_area.h index b7cd9b4b09..e162d21cd2 100644 --- a/ospf6d/ospf6_area.h +++ b/ospf6d/ospf6_area.h @@ -99,6 +99,8 @@ struct ospf6_area { /* Time stamps. */ struct timeval ts_spf; /* SPF calculation time stamp. */ + + uint32_t full_nbrs; /* Fully adjacent neighbors. */ }; #define OSPF6_AREA_ENABLE 0x01 diff --git a/ospf6d/ospf6_neighbor.c b/ospf6d/ospf6_neighbor.c index 35d0b0a646..05bc254951 100644 --- a/ospf6d/ospf6_neighbor.c +++ b/ospf6d/ospf6_neighbor.c @@ -193,7 +193,11 @@ static void ospf6_neighbor_state_change(u_char next_state, if (prev_state == OSPF6_NEIGHBOR_LOADING && next_state == OSPF6_NEIGHBOR_FULL) { OSPF6_AS_EXTERN_LSA_SCHEDULE(on->ospf6_if); + on->ospf6_if->area->full_nbrs++; } + + if (prev_state == OSPF6_NEIGHBOR_FULL) + on->ospf6_if->area->full_nbrs--; } if ((prev_state == OSPF6_NEIGHBOR_EXCHANGE diff --git a/ospf6d/ospf6_spf.c b/ospf6d/ospf6_spf.c index 17ce1771e2..29ba1bcec7 100644 --- a/ospf6d/ospf6_spf.c +++ b/ospf6d/ospf6_spf.c @@ -1029,18 +1029,21 @@ struct ospf6_lsa *ospf6_create_single_router_lsa(struct ospf6_area *area, /* Fill Larger LSA Payload */ end = ospf6_lsdb_head(lsdb, 2, type, adv_router, &rtr_lsa); - if (rtr_lsa) { - if (!OSPF6_LSA_IS_MAXAGE(rtr_lsa)) { - /* Append first Link State ID LSA */ - lsa_header = (struct ospf6_lsa_header *)rtr_lsa->header; - memcpy(new_header, lsa_header, - ntohs(lsa_header->length)); - /* Assign new lsa length as aggregated length. */ - ((struct ospf6_lsa_header *)new_header)->length = - htons(total_lsa_length); - new_header += ntohs(lsa_header->length); - num_lsa--; - } + + /* + * We assume at this point in time that rtr_lsa is + * a valid pointer. + */ + assert(rtr_lsa); + if (!OSPF6_LSA_IS_MAXAGE(rtr_lsa)) { + /* Append first Link State ID LSA */ + lsa_header = (struct ospf6_lsa_header *)rtr_lsa->header; + memcpy(new_header, lsa_header, ntohs(lsa_header->length)); + /* Assign new lsa length as aggregated length. */ + ((struct ospf6_lsa_header *)new_header)->length = + htons(total_lsa_length); + new_header += ntohs(lsa_header->length); + num_lsa--; } /* Print LSA Name */ diff --git a/ospf6d/ospf6_top.c b/ospf6d/ospf6_top.c index db39420548..25d968fb68 100644 --- a/ospf6d/ospf6_top.c +++ b/ospf6d/ospf6_top.c @@ -335,6 +335,8 @@ DEFUN(ospf6_router_id, int ret; const char *router_id_str; u_int32_t router_id; + struct ospf6_area *oa; + struct listnode *node; argv_find(argv, argc, "A.B.C.D", &idx); router_id_str = argv[idx]->arg; @@ -346,8 +348,17 @@ DEFUN(ospf6_router_id, } o->router_id_static = router_id; - if (o->router_id == 0) - o->router_id = router_id; + + for (ALL_LIST_ELEMENTS_RO(o->area_list, node, oa)) { + if (oa->full_nbrs) { + vty_out(vty, + "For this router-id change to take effect," + " save config and restart ospf6d\n"); + return CMD_SUCCESS; + } + } + + o->router_id = router_id; return CMD_SUCCESS; } @@ -360,8 +371,22 @@ DEFUN(no_ospf6_router_id, V4NOTATION_STR) { VTY_DECLVAR_CONTEXT(ospf6, o); + struct ospf6_area *oa; + struct listnode *node; + o->router_id_static = 0; + + for (ALL_LIST_ELEMENTS_RO(o->area_list, node, oa)) { + if (oa->full_nbrs) { + vty_out(vty, + "For this router-id change to take effect," + " save config and restart ospf6d\n"); + return CMD_SUCCESS; + } + } o->router_id = 0; + if (o->router_id_zebra.s_addr) + o->router_id = (uint32_t)o->router_id_zebra.s_addr; return CMD_SUCCESS; } @@ -523,6 +548,10 @@ DEFUN (ospf6_distance_ospf6, VTY_DECLVAR_CONTEXT(ospf6, o); int idx = 0; + o->distance_intra = 0; + o->distance_inter = 0; + o->distance_external = 0; + if (argv_find(argv, argc, "intra-area", &idx)) o->distance_intra = atoi(argv[idx + 1]->arg); idx = 0; diff --git a/ospf6d/ospf6_top.h b/ospf6d/ospf6_top.h index 8f99cc33f4..d7a3766b80 100644 --- a/ospf6d/ospf6_top.h +++ b/ospf6d/ospf6_top.h @@ -32,6 +32,8 @@ struct ospf6 { /* static router id */ u_int32_t router_id_static; + struct in_addr router_id_zebra; + /* start time */ struct timeval starttime; diff --git a/ospf6d/ospf6_zebra.c b/ospf6d/ospf6_zebra.c index cc87c499ee..4fb959b952 100644 --- a/ospf6d/ospf6_zebra.c +++ b/ospf6d/ospf6_zebra.c @@ -46,8 +46,6 @@ unsigned char conf_debug_ospf6_zebra = 0; /* information about zebra. */ struct zclient *zclient = NULL; -struct in_addr router_id_zebra; - /* Router-id update message from zebra. */ static int ospf6_router_id_update_zebra(int command, struct zclient *zclient, zebra_size_t length, vrf_id_t vrf_id) @@ -56,13 +54,14 @@ static int ospf6_router_id_update_zebra(int command, struct zclient *zclient, struct ospf6 *o = ospf6; zebra_router_id_update_read(zclient->ibuf, &router_id); - router_id_zebra = router_id.u.prefix4; if (o == NULL) return 0; + o->router_id_zebra = router_id.u.prefix4; + if (o->router_id == 0) - o->router_id = (u_int32_t)router_id_zebra.s_addr; + o->router_id = (uint32_t)o->router_id_zebra.s_addr; return 0; } diff --git a/ospfd/ospf_ext.c b/ospfd/ospf_ext.c index d42476b6d8..d7faf4b0de 100644 --- a/ospfd/ospf_ext.c +++ b/ospfd/ospf_ext.c @@ -175,7 +175,7 @@ void ospf_ext_term(void) { if ((OspfEXT.scope != OSPF_OPAQUE_AREA_LSA) - || (OspfEXT.scope != OSPF_OPAQUE_AS_LSA)) + && (OspfEXT.scope != OSPF_OPAQUE_AS_LSA)) zlog_warn( "EXT: Unable to unregister Extended Prefix " "Opaque LSA functions: Wrong scope!"); diff --git a/ospfd/ospf_flood.c b/ospfd/ospf_flood.c index 36b6d5143d..7ad9cf9f2f 100644 --- a/ospfd/ospf_flood.c +++ b/ospfd/ospf_flood.c @@ -563,6 +563,7 @@ int ospf_flood_through_area(struct ospf_area *area, struct ospf_neighbor *inbr, struct ospf_interface *oi; int lsa_ack_flag = 0; + assert(area); /* All other types are specific to a single area (Area A). The eligible interfaces are all those interfaces attaching to the Area A. If Area A is the backbone, this includes all the virtual diff --git a/ospfd/ospf_sr.c b/ospfd/ospf_sr.c index c6649a7a04..9827eac71b 100644 --- a/ospfd/ospf_sr.c +++ b/ospfd/ospf_sr.c @@ -149,14 +149,6 @@ static struct sr_node *sr_node_new(struct in_addr *rid) new->ext_link->del = del_sr_link; new->ext_prefix->del = del_sr_pref; - /* Check if list are correctly created */ - if (new->ext_link == NULL || new->ext_prefix == NULL) { - list_delete_original(new->ext_link); - list_delete_original(new->ext_prefix); - XFREE(MTYPE_OSPF_SR_PARAMS, new); - return NULL; - } - IPV4_ADDR_COPY(&new->adv_router, rid); new->neighbor = NULL; new->instance = 0; @@ -440,7 +432,7 @@ static struct ospf_path *get_nexthop_by_addr(struct ospf *top, struct route_node *rn; /* Sanity Check */ - if ((top == NULL) && (top->new_table)) + if (top == NULL) return NULL; if (IS_DEBUG_OSPF_SR) diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index 1276f5477c..09350b45a8 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -8558,6 +8558,10 @@ DEFUN (ospf_distance_ospf, VTY_DECLVAR_INSTANCE_CONTEXT(ospf, ospf); int idx = 0; + ospf->distance_intra = 0; + ospf->distance_inter = 0; + ospf->distance_external = 0; + if (argv_find(argv, argc, "intra-area", &idx)) ospf->distance_intra = atoi(argv[idx + 1]->arg); idx = 0; diff --git a/zebra/zebra_ptm.c b/zebra/zebra_ptm.c index 7f5fd472f1..187c2594ad 100644 --- a/zebra/zebra_ptm.c +++ b/zebra/zebra_ptm.c @@ -1007,8 +1007,13 @@ int zebra_ptm_bfd_client_register(struct zserv *client, return 0; stream_failure: - if (out_ctxt) - ptm_lib_cleanup_msg(ptm_hdl, out_ctxt); + /* + * IF we ever add more STREAM_GETXXX functions after the out_ctxt + * is allocated then we need to add this code back in + * + * if (out_ctxt) + * ptm_lib_cleanup_msg(ptm_hdl, out_ctxt); + */ return 0; } diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index f5ad9c1c8a..269244f768 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -458,6 +458,12 @@ DEFPY(ip_route_blackhole_vrf, VTY_DECLVAR_CONTEXT(vrf, vrf); struct zebra_vrf *zvrf = vrf->info; + /* + * Coverity is complaining that prefix could + * be dereferenced, but we know that prefix will + * valid. Add an assert to make it happy + */ + assert(prefix); return zebra_static_route_leak(vty, zvrf, zvrf, AFI_IP, SAFI_UNICAST, no, prefix, mask_str, NULL, NULL, NULL, flag, @@ -2014,6 +2020,12 @@ DEFPY(ipv6_route_blackhole_vrf, VTY_DECLVAR_CONTEXT(vrf, vrf); struct zebra_vrf *zvrf = vrf->info; + /* + * Coverity is complaining that prefix could + * be dereferenced, but we know that prefix will + * valid. Add an assert to make it happy + */ + assert(prefix); return zebra_static_route_leak(vty, zvrf, zvrf, AFI_IP6, SAFI_UNICAST, no, prefix_str, NULL, from_str, NULL, NULL, flag, |
