uint32_t upper_bound)
{
struct isis_sr_db *srdb = &area->srdb;
- struct listnode *node, *nnode;
+ struct listnode *node;
struct sr_adjacency *sra;
sr_debug("ISIS-Sr (%s): Update SRLB with new range [%u/%u]",
return -1;
/* Reinstall local Adjacency-SIDs with new labels. */
- for (ALL_LIST_ELEMENTS(area->srdb.adj_sids, node, nnode, sra))
+ for (ALL_LIST_ELEMENTS_RO(area->srdb.adj_sids, node, sra))
sr_adj_sid_update(sra, &srdb->srlb);
/* Update and Flood LSP */
"Segment-Routing\n"
"Segment-Routing Prefix-SIDs\n")
{
- struct listnode *node, *inode, *nnode;
+ struct listnode *node, *inode;
struct isis_area *area;
struct isis *isis = NULL;
const char *vrf_name = VRF_DEFAULT_NAME;
ISIS_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf);
if (vrf_name) {
if (all_vrf) {
- for (ALL_LIST_ELEMENTS(im->isis, nnode, inode, isis)) {
+ for (ALL_LIST_ELEMENTS_RO(im->isis, inode, isis)) {
for (ALL_LIST_ELEMENTS_RO(isis->area_list, node,
area)) {
vty_out(vty, "Area %s:\n",
"Segment-Routing\n"
"Segment-Routing node\n")
{
- struct listnode *node, *inode, *nnode;
+ struct listnode *node, *inode;
struct isis_area *area;
- struct isis *isis = NULL;
+ struct isis *isis;
- for (ALL_LIST_ELEMENTS(im->isis, inode, nnode, isis)) {
+ for (ALL_LIST_ELEMENTS_RO(im->isis, inode, isis)) {
for (ALL_LIST_ELEMENTS_RO(isis->area_list, node, area)) {
vty_out(vty, "Area %s:\n",
area->area_tag ? area->area_tag : "null");
struct isis *isis_lookup_by_vrfid(vrf_id_t vrf_id)
{
- struct isis *isis = NULL;
- struct listnode *node, *nnode;
+ struct isis *isis;
+ struct listnode *node;
- for (ALL_LIST_ELEMENTS(im->isis, node, nnode, isis))
+ for (ALL_LIST_ELEMENTS_RO(im->isis, node, isis))
if (isis->vrf_id == vrf_id)
return isis;
+
return NULL;
}
struct isis *isis_lookup_by_vrfname(const char *vrfname)
{
- struct isis *isis = NULL;
- struct listnode *node, *nnode;
+ struct isis *isis;
+ struct listnode *node;
- for (ALL_LIST_ELEMENTS(im->isis, node, nnode, isis))
+ for (ALL_LIST_ELEMENTS_RO(im->isis, node, isis))
if (isis->name && vrfname && strcmp(isis->name, vrfname) == 0)
return isis;
+
return NULL;
}
-struct isis *isis_lookup_by_sysid(uint8_t *sysid)
+struct isis *isis_lookup_by_sysid(const uint8_t *sysid)
{
- struct isis *isis = NULL;
- struct listnode *node, *nnode;
- for (ALL_LIST_ELEMENTS(im->isis, node, nnode, isis))
+ struct isis *isis;
+ struct listnode *node;
+
+ for (ALL_LIST_ELEMENTS_RO(im->isis, node, isis))
if (!memcmp(isis->sysid, sysid, ISIS_SYS_ID_LEN))
return isis;
+
return NULL;
}
void isis_global_instance_create()
{
- struct isis *isis = NULL;
+ struct isis *isis;
isis = isis_lookup_by_vrfid(VRF_DEFAULT);
if (isis == NULL) {
struct isis *isis_new(vrf_id_t vrf_id)
{
- struct vrf *vrf = NULL;
- struct isis *isis = NULL;
+ struct vrf *vrf;
+ struct isis *isis;
isis = XCALLOC(MTYPE_ISIS, sizeof(struct isis));
isis->vrf_id = vrf_id;
{
struct isis_area *area;
struct listnode *node;
- struct isis *isis = NULL;
+ struct isis *isis;
isis = isis_lookup_by_vrfid(vrf_id);
if (isis == NULL)
void isis_terminate()
{
- struct isis *isis = NULL;
+ struct isis *isis;
struct listnode *node, *nnode;
if (listcount(im->isis) == 0)
int show_isis_interface_common(struct vty *vty, const char *ifname, char detail,
const char *vrf_name, bool all_vrf)
{
- struct listnode *anode, *cnode, *mnode, *inode;
+ struct listnode *anode, *cnode, *inode;
struct isis_area *area;
struct isis_circuit *circuit;
- struct isis *isis = NULL;
+ struct isis *isis;
if (!im) {
vty_out(vty, "IS-IS Routing Process not enabled\n");
}
if (vrf_name) {
if (all_vrf) {
- for (ALL_LIST_ELEMENTS(im->isis, mnode, inode, isis)) {
+ for (ALL_LIST_ELEMENTS_RO(im->isis, inode, isis)) {
for (ALL_LIST_ELEMENTS_RO(isis->area_list,
anode, area)) {
vty_out(vty, "Area %s:\n",
detail);
}
}
- return 0;
+ return CMD_SUCCESS;
}
isis = isis_lookup_by_vrfname(vrf_name);
if (isis != NULL) {
int show_isis_neighbor_common(struct vty *vty, const char *id, char detail,
const char *vrf_name, bool all_vrf)
{
- struct listnode *nnode, *inode;
+ struct listnode *node;
struct isis_dynhn *dynhn;
uint8_t sysid[ISIS_SYS_ID_LEN];
- struct isis *isis = NULL;
+ struct isis *isis;
if (!im) {
vty_out(vty, "IS-IS Routing Process not enabled\n");
if (vrf_name) {
if (all_vrf) {
- for (ALL_LIST_ELEMENTS(im->isis, nnode, inode, isis)) {
+ for (ALL_LIST_ELEMENTS_RO(im->isis, node, isis)) {
isis_neighbor_common(vty, id, detail, isis,
sysid);
}
- return 0;
+ return CMD_SUCCESS;
}
isis = isis_lookup_by_vrfname(vrf_name);
if (isis != NULL)
static void isis_neighbor_common_clear(struct vty *vty, const char *id,
uint8_t *sysid, struct isis *isis)
{
- struct listnode *anode, *cnode, *cnextnode, *node, *nnode;
+ struct listnode *anode, *cnode, *node, *nnode;
struct isis_area *area;
struct isis_circuit *circuit;
struct list *adjdb;
int i;
for (ALL_LIST_ELEMENTS_RO(isis->area_list, anode, area)) {
- for (ALL_LIST_ELEMENTS(area->circuit_list, cnode, cnextnode,
- circuit)) {
+ for (ALL_LIST_ELEMENTS_RO(area->circuit_list, cnode, circuit)) {
if (circuit->circ_type == CIRCUIT_T_BROADCAST) {
for (i = 0; i < 2; i++) {
adjdb = circuit->u.bc.adjdb[i];
int clear_isis_neighbor_common(struct vty *vty, const char *id, const char *vrf_name,
bool all_vrf)
{
- struct listnode *nnode, *inode;
+ struct listnode *node;
struct isis_dynhn *dynhn;
uint8_t sysid[ISIS_SYS_ID_LEN];
- struct isis *isis = NULL;
+ struct isis *isis;
if (!im) {
vty_out(vty, "IS-IS Routing Process not enabled\n");
}
if (vrf_name) {
if (all_vrf) {
- for (ALL_LIST_ELEMENTS(im->isis, nnode, inode, isis)) {
+ for (ALL_LIST_ELEMENTS_RO(im->isis, node, isis))
isis_neighbor_common_clear(vty, id, sysid,
isis);
- }
- return 0;
+ return CMD_SUCCESS;
}
isis = isis_lookup_by_vrfname(vrf_name);
if (isis != NULL)
"All VRFs\n"
"IS-IS Dynamic hostname mapping\n")
{
- struct listnode *nnode, *inode;
+ struct listnode *node;
const char *vrf_name = VRF_DEFAULT_NAME;
bool all_vrf = false;
int idx_vrf = 0;
- struct isis *isis = NULL;
+ struct isis *isis;
ISIS_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf);
if (vrf_name) {
if (all_vrf) {
- for (ALL_LIST_ELEMENTS(im->isis, nnode, inode, isis)) {
+ for (ALL_LIST_ELEMENTS_RO(im->isis, node, isis))
dynhn_print_all(vty, isis);
- }
- return 0;
+
+ return CMD_SUCCESS;
}
isis = isis_lookup_by_vrfname(vrf_name);
if (isis != NULL)
"All VRFs\n"
"SPF delay IETF information\n")
{
- struct listnode *nnode, *inode;
- struct isis *isis = NULL;
+ struct listnode *node;
+ struct isis *isis;
int idx_vrf = 0;
const char *vrf_name = VRF_DEFAULT_NAME;
bool all_vrf = false;
if (vrf_name) {
if (all_vrf) {
- for (ALL_LIST_ELEMENTS(im->isis, nnode, inode, isis)) {
+ for (ALL_LIST_ELEMENTS_RO(im->isis, node, isis))
isis_spf_ietf_common(vty, isis);
- }
- return 0;
+
+ return CMD_SUCCESS;
}
isis = isis_lookup_by_vrfname(vrf_name);
if (isis != NULL)
"All VRFs\n"
"summary\n")
{
- struct listnode *inode, *nnode;
+ struct listnode *node;
int idx_vrf = 0;
- struct isis *isis = NULL;
+ struct isis *isis;
const char *vrf_name = VRF_DEFAULT_NAME;
bool all_vrf = false;
}
if (vrf_name) {
if (all_vrf) {
- for (ALL_LIST_ELEMENTS(im->isis, nnode, inode, isis)) {
+ for (ALL_LIST_ELEMENTS_RO(im->isis, node, isis))
common_isis_summary(vty, isis);
- }
- return 0;
+
+ return CMD_SUCCESS;
}
isis = isis_lookup_by_vrfname(vrf_name);
if (isis != NULL)
static int show_isis_database(struct vty *vty, const char *argv, int ui_level,
const char *vrf_name, bool all_vrf)
{
- struct listnode *inode, *nnode;
- struct isis *isis = NULL;
+ struct listnode *node;
+ struct isis *isis;
if (vrf_name) {
if (all_vrf) {
- for (ALL_LIST_ELEMENTS(im->isis, nnode, inode, isis)) {
+ for (ALL_LIST_ELEMENTS_RO(im->isis, node, isis))
show_isis_database_common(vty, argv, ui_level,
isis);
- }
- return 0;
+
+ return CMD_SUCCESS;
}
isis = isis_lookup_by_vrfname(vrf_name);
- if (isis != NULL)
+ if (isis)
show_isis_database_common(vty, argv, ui_level, isis);
}
{
int write = 0;
struct isis_area *area;
- struct listnode *node, *node2, *inode, *nnode;
- struct isis *isis = NULL;
+ struct listnode *node, *node2, *inode;
+ struct isis *isis;
if (!im) {
vty_out(vty, "IS-IS Routing Process not enabled\n");
return CMD_SUCCESS;
}
- for (ALL_LIST_ELEMENTS(im->isis, nnode, inode, isis)) {
-
+ for (ALL_LIST_ELEMENTS_RO(im->isis, inode, isis)) {
for (ALL_LIST_ELEMENTS_RO(isis->area_list, node, area)) {
/* ISIS - Area name */
vty_out(vty, "router " PROTO_NAME " %s\n", area->area_tag);