From 98c5bc15e712a6fb4dc7ae827124cb5494e23688 Mon Sep 17 00:00:00 2001 From: Christian Franke Date: Sat, 10 Mar 2018 18:16:34 +0100 Subject: [PATCH] isisd: revert some counterproductive indentation This reverts some of commit 996c93142d3abfab0f6d6c800474e22a8cfbdbc5. --- isisd/isis_circuit.c | 6 +- isisd/isis_circuit.h | 5 +- isisd/isis_lsp.c | 7 +- isisd/isis_pdu.c | 11 +-- isisd/isis_spf.c | 36 ++++---- isisd/isis_te.c | 57 ++++++------- isisd/isis_tlvs.c | 190 ++++++++++++++++++------------------------- isisd/isisd.h | 5 +- 8 files changed, 131 insertions(+), 186 deletions(-) diff --git a/isisd/isis_circuit.c b/isisd/isis_circuit.c index 75d4397637..a2d1e75d94 100644 --- a/isisd/isis_circuit.c +++ b/isisd/isis_circuit.c @@ -382,12 +382,10 @@ static uint8_t isis_circuit_id_gen(struct interface *ifp) /* Circuit ids MUST be unique for any broadcast circuits. Otherwise, * Pseudo-Node LSPs cannot be generated correctly. * - * Currently, allocate one circuit ID for any circuit, limiting the - * total + * Currently, allocate one circuit ID for any circuit, limiting the total * numer of circuits IS-IS can run on to 255. * - * We should revisit this when implementing 3-way adjacencies for p2p, - * since + * We should revisit this when implementing 3-way adjacencies for p2p, since * we then have extended interface IDs available. */ uint8_t id = ifp->ifindex; diff --git a/isisd/isis_circuit.h b/isisd/isis_circuit.h index 0d392036e9..3d97d42b5e 100644 --- a/isisd/isis_circuit.h +++ b/isisd/isis_circuit.h @@ -82,9 +82,8 @@ struct isis_circuit { struct thread *t_send_csnp[2]; struct thread *t_send_psnp[2]; struct thread *t_send_lsp; - struct list *lsp_queue; /* LSPs to be txed (both levels) */ - struct isis_lsp_hash - *lsp_hash; /* Hashtable synchronized with lsp_queue */ + struct list *lsp_queue; /* LSPs to be txed (both levels) */ + struct isis_lsp_hash *lsp_hash; /* Hashtable synchronized with lsp_queue */ time_t lsp_queue_last_push[2]; /* timestamp used to enforce transmit * interval; * for scalability, use one timestamp per diff --git a/isisd/isis_lsp.c b/isisd/isis_lsp.c index 55888bd389..34eac676d6 100644 --- a/isisd/isis_lsp.c +++ b/isisd/isis_lsp.c @@ -1875,15 +1875,12 @@ int lsp_tick(struct thread *thread) if (!circuit->lsp_queue) continue; - if (now - - circuit->lsp_queue_last_push - [level] + if (now - circuit->lsp_queue_last_push[level] < MIN_LSP_RETRANS_INTERVAL) { continue; } - circuit->lsp_queue_last_push[level] = - now; + circuit->lsp_queue_last_push[level] = now; for (ALL_LIST_ELEMENTS_RO( lsp_list, lspnode, lsp)) { diff --git a/isisd/isis_pdu.c b/isisd/isis_pdu.c index 20c39a624f..cdbfb0e653 100644 --- a/isisd/isis_pdu.c +++ b/isisd/isis_pdu.c @@ -1184,8 +1184,7 @@ static int process_snp(uint8_t pdu_type, struct isis_circuit *circuit, entry = entry->next) { zlog_debug( "ISIS-Snp (%s): %cSNP entry %s, seq 0x%08" PRIx32 - ", cksum 0x%04" PRIx16 ", lifetime %" PRIu16 - "s", + ", cksum 0x%04" PRIx16 ", lifetime %" PRIu16 "s", circuit->area->area_tag, typechar, rawlspid_print(entry->id), entry->seqno, entry->checksum, entry->rem_lifetime); @@ -1244,12 +1243,10 @@ static int process_snp(uint8_t pdu_type, struct isis_circuit *circuit, ISIS_SYS_ID_LEN + 1); LSP_FRAGMENT(lspid) = 0; lsp0 = lsp_search( - lspid, - circuit->area - ->lspdb[level - 1]); + lspid, + circuit->area->lspdb[level - 1]); if (!lsp0) { - zlog_debug( - "Got lsp frag in snp, while zero not in database"); + zlog_debug("Got lsp frag in snp, while zero not in database"); continue; } } diff --git a/isisd/isis_spf.c b/isisd/isis_spf.c index 0eabcb7e47..0aaa66cdeb 100644 --- a/isisd/isis_spf.c +++ b/isisd/isis_spf.c @@ -85,10 +85,10 @@ struct isis_vertex { struct prefix prefix; } N; - u_int32_t d_N; /* d(N) Distance from this IS */ - u_int16_t depth; /* The depth in the imaginary tree */ - struct list *Adj_N; /* {Adj(N)} next hop or neighbor list */ - struct list *parents; /* list of parents for ECMP */ + u_int32_t d_N; /* d(N) Distance from this IS */ + u_int16_t depth; /* The depth in the imaginary tree */ + struct list *Adj_N; /* {Adj(N)} next hop or neighbor list */ + struct list *parents; /* list of parents for ECMP */ uint64_t insert_counter; }; @@ -276,12 +276,11 @@ static void isis_vertex_queue_delete(struct isis_vertex_queue *queue, struct isis_spftree { struct isis_vertex_queue paths; /* the SPT */ struct isis_vertex_queue tents; /* TENT */ - struct isis_area *area; /* back pointer to area */ - unsigned int runcount; /* number of runs since uptime */ - time_t last_run_timestamp; /* last run timestamp as wall time for - display */ - time_t last_run_monotime; /* last run as monotime for scheduling */ - time_t last_run_duration; /* last run duration in msec */ + struct isis_area *area; /* back pointer to area */ + unsigned int runcount; /* number of runs since uptime */ + time_t last_run_timestamp; /* last run timestamp as wall time for display */ + time_t last_run_monotime; /* last run as monotime for scheduling */ + time_t last_run_duration; /* last run duration in msec */ uint16_t mtid; int family; @@ -831,10 +830,10 @@ static int isis_spf_process_lsp(struct isis_spftree *spftree, return ISIS_OK; /* RFC3787 section 4 SHOULD ignore overload bit in pseudo LSPs */ - bool no_overload = - (pseudo_lsp || (spftree->mtid == ISIS_MT_IPV4_UNICAST + bool no_overload = (pseudo_lsp + || (spftree->mtid == ISIS_MT_IPV4_UNICAST && !ISIS_MASK_LSP_OL_BIT(lsp->hdr.lsp_bits)) - || (mt_router_info && !mt_router_info->overload)); + || (mt_router_info && !mt_router_info->overload)); lspfragloop: if (lsp->hdr.seqno == 0) { @@ -1430,8 +1429,7 @@ int isis_spf_schedule(struct isis_area *area, int level) /* wait configured min_spf_interval before doing the SPF */ long timer; if (diff >= area->min_spf_interval[level - 1]) { - /* Last run is more than min interval ago, schedule immediate - * run */ + /* Last run is more than min interval ago, schedule immediate run */ timer = 0; } else { timer = area->min_spf_interval[level - 1] - diff; @@ -1549,9 +1547,7 @@ DEFUN (show_isis_topology, continue; if (area->ip_circuits > 0 && area->spftree[level - 1] - && isis_vertex_queue_count( - &area->spftree[level - 1]->paths) - > 0) { + && isis_vertex_queue_count(&area->spftree[level - 1]->paths) > 0) { vty_out(vty, "IS-IS paths to level-%d routers that speak IP\n", level); @@ -1561,9 +1557,7 @@ DEFUN (show_isis_topology, vty_out(vty, "\n"); } if (area->ipv6_circuits > 0 && area->spftree6[level - 1] - && isis_vertex_queue_count( - &area->spftree6[level - 1]->paths) - > 0) { + && isis_vertex_queue_count(&area->spftree6[level - 1]->paths) > 0) { vty_out(vty, "IS-IS paths to level-%d routers that speak IPv6\n", level); diff --git a/isisd/isis_te.c b/isisd/isis_te.c index df0b8b62d6..079340b4a4 100644 --- a/isisd/isis_te.c +++ b/isisd/isis_te.c @@ -805,8 +805,7 @@ static u_char print_subtlv_mm_delay(struct sbuf *buf, int indent, A = (u_int32_t)ntohl(tlv->low) & TE_EXT_ANORMAL; high = (u_int32_t)ntohl(tlv->high) & TE_EXT_MASK; - sbuf_push(buf, indent, "%s Min/Max Link Delay: %" PRIu32 " / %" PRIu32 - " (micro-sec)\n", + sbuf_push(buf, indent, "%s Min/Max Link Delay: %" PRIu32 " / %" PRIu32 " (micro-sec)\n", A ? "Anomalous" : "Normal", low, high); return (SUBTLV_HDR_SIZE + SUBTLV_DEF_SIZE); @@ -913,8 +912,8 @@ static u_char print_unknown_tlv(struct sbuf *buf, int indent, } /* Main Show function */ -void mpls_te_print_detail(struct sbuf *buf, int indent, uint8_t *subtlvs, - uint8_t subtlv_len) +void mpls_te_print_detail(struct sbuf *buf, int indent, + uint8_t *subtlvs, uint8_t subtlv_len) { struct subtlv_header *tlvh = (struct subtlv_header *)subtlvs; uint16_t sum = 0; @@ -922,8 +921,7 @@ void mpls_te_print_detail(struct sbuf *buf, int indent, uint8_t *subtlvs, for (; sum < subtlv_len; tlvh = SUBTLV_HDR_NEXT(tlvh)) { switch (tlvh->type) { case TE_SUBTLV_ADMIN_GRP: - sum += print_subtlv_admin_grp( - buf, indent, + sum += print_subtlv_admin_grp(buf, indent, (struct te_subtlv_admin_grp *)tlvh); break; case TE_SUBTLV_LLRI: @@ -931,31 +929,27 @@ void mpls_te_print_detail(struct sbuf *buf, int indent, uint8_t *subtlvs, (struct te_subtlv_llri *)tlvh); break; case TE_SUBTLV_LOCAL_IPADDR: - sum += print_subtlv_local_ipaddr( - buf, indent, + sum += print_subtlv_local_ipaddr(buf, indent, (struct te_subtlv_local_ipaddr *)tlvh); break; case TE_SUBTLV_RMT_IPADDR: - sum += print_subtlv_rmt_ipaddr( - buf, indent, + sum += print_subtlv_rmt_ipaddr(buf, indent, (struct te_subtlv_rmt_ipaddr *)tlvh); break; case TE_SUBTLV_MAX_BW: - sum += print_subtlv_max_bw( - buf, indent, (struct te_subtlv_max_bw *)tlvh); + sum += print_subtlv_max_bw(buf, indent, + (struct te_subtlv_max_bw *)tlvh); break; case TE_SUBTLV_MAX_RSV_BW: - sum += print_subtlv_max_rsv_bw( - buf, indent, + sum += print_subtlv_max_rsv_bw(buf, indent, (struct te_subtlv_max_rsv_bw *)tlvh); break; case TE_SUBTLV_UNRSV_BW: - sum += print_subtlv_unrsv_bw( - buf, indent, (struct te_subtlv_unrsv_bw *)tlvh); + sum += print_subtlv_unrsv_bw(buf, indent, + (struct te_subtlv_unrsv_bw *)tlvh); break; case TE_SUBTLV_TE_METRIC: - sum += print_subtlv_te_metric( - buf, indent, + sum += print_subtlv_te_metric(buf, indent, (struct te_subtlv_te_metric *)tlvh); break; case TE_SUBTLV_RAS: @@ -967,33 +961,32 @@ void mpls_te_print_detail(struct sbuf *buf, int indent, uint8_t *subtlvs, (struct te_subtlv_rip *)tlvh); break; case TE_SUBTLV_AV_DELAY: - sum += print_subtlv_av_delay( - buf, indent, (struct te_subtlv_av_delay *)tlvh); + sum += print_subtlv_av_delay(buf, indent, + (struct te_subtlv_av_delay *)tlvh); break; case TE_SUBTLV_MM_DELAY: - sum += print_subtlv_mm_delay( - buf, indent, (struct te_subtlv_mm_delay *)tlvh); + sum += print_subtlv_mm_delay(buf, indent, + (struct te_subtlv_mm_delay *)tlvh); break; case TE_SUBTLV_DELAY_VAR: - sum += print_subtlv_delay_var( - buf, indent, + sum += print_subtlv_delay_var(buf, indent, (struct te_subtlv_delay_var *)tlvh); break; case TE_SUBTLV_PKT_LOSS: - sum += print_subtlv_pkt_loss( - buf, indent, (struct te_subtlv_pkt_loss *)tlvh); + sum += print_subtlv_pkt_loss(buf, indent, + (struct te_subtlv_pkt_loss *)tlvh); break; case TE_SUBTLV_RES_BW: - sum += print_subtlv_res_bw( - buf, indent, (struct te_subtlv_res_bw *)tlvh); + sum += print_subtlv_res_bw(buf, indent, + (struct te_subtlv_res_bw *)tlvh); break; case TE_SUBTLV_AVA_BW: - sum += print_subtlv_ava_bw( - buf, indent, (struct te_subtlv_ava_bw *)tlvh); + sum += print_subtlv_ava_bw(buf, indent, + (struct te_subtlv_ava_bw *)tlvh); break; case TE_SUBTLV_USE_BW: - sum += print_subtlv_use_bw( - buf, indent, (struct te_subtlv_use_bw *)tlvh); + sum += print_subtlv_use_bw(buf, indent, + (struct te_subtlv_use_bw *)tlvh); break; default: sum += print_unknown_tlv(buf, indent, tlvh); diff --git a/isisd/isis_tlvs.c b/isisd/isis_tlvs.c index 8e0fd74b73..452025bed7 100644 --- a/isisd/isis_tlvs.c +++ b/isisd/isis_tlvs.c @@ -161,11 +161,9 @@ static int unpack_subtlv_ipv6_source_prefix(enum isis_tlv_context context, sbuf_push(log, indent, "Unpacking IPv6 Source Prefix Sub-TLV...\n"); if (tlv_len < 1) { - sbuf_push( - log, indent, - "Not enough data left. (expected 1 or more bytes, got %" PRIu8 - ")\n", - tlv_len); + sbuf_push(log, indent, + "Not enough data left. (expected 1 or more bytes, got %" PRIu8 ")\n", + tlv_len); return 1; } @@ -625,11 +623,10 @@ static int unpack_item_extended_reach(uint16_t mtid, uint8_t len, (mtid == ISIS_MT_IPV4_UNICAST) ? "extended" : "mt"); if (len < 11) { - sbuf_push( - log, indent, - "Not enough data left. (expected 11 or more bytes, got %" PRIu8 - ")\n", - len); + sbuf_push(log, indent, + "Not enough data left. (expected 11 or more bytes, got %" + PRIu8 ")\n", + len); goto out; } @@ -977,7 +974,8 @@ static void format_item_mt_router_info(uint16_t mtid, struct isis_item *i, struct isis_mt_router_info *info = (struct isis_mt_router_info *)i; sbuf_push(buf, indent, "MT Router Info: %s%s%s\n", - isis_mtid2str(info->mtid), info->overload ? " Overload" : "", + isis_mtid2str(info->mtid), + info->overload ? " Overload" : "", info->attached ? " Attached" : ""); } @@ -1126,8 +1124,8 @@ static void format_item_extended_ip_reach(uint16_t mtid, struct isis_item *i, sbuf_push(buf, indent, "%s IP Reachability: %s (Metric: %u)%s", (mtid == ISIS_MT_IPV4_UNICAST) ? "Extended" : "MT", - prefix2str(&r->prefix, prefixbuf, sizeof(prefixbuf)), - r->metric, r->down ? " Down" : ""); + prefix2str(&r->prefix, prefixbuf, sizeof(prefixbuf)), r->metric, + r->down ? " Down" : ""); if (mtid != ISIS_MT_IPV4_UNICAST) sbuf_push(buf, 0, " %s", isis_mtid2str(mtid)); sbuf_push(buf, 0, "\n"); @@ -1180,11 +1178,9 @@ static int unpack_item_extended_ip_reach(uint16_t mtid, uint8_t len, consume = 5; if (len < consume) { - sbuf_push( - log, indent, - "Not enough data left. (expected 5 or more bytes, got %" PRIu8 - ")\n", - len); + sbuf_push(log, indent, + "Not enough data left. (expected 5 or more bytes, got %" PRIu8 ")\n", + len); goto out; } @@ -1203,10 +1199,9 @@ static int unpack_item_extended_ip_reach(uint16_t mtid, uint8_t len, consume += PSIZE(rv->prefix.prefixlen); if (len < consume) { - sbuf_push( - log, indent, - "Expected %u bytes of prefix, but only %u bytes available.\n", - PSIZE(rv->prefix.prefixlen), len - 5); + sbuf_push(log, indent, + "Expected %u bytes of prefix, but only %u bytes available.\n", + PSIZE(rv->prefix.prefixlen), len - 5); goto out; } stream_get(&rv->prefix.prefix.s_addr, s, PSIZE(rv->prefix.prefixlen)); @@ -1221,26 +1216,23 @@ static int unpack_item_extended_ip_reach(uint16_t mtid, uint8_t len, if (control & ISIS_EXTENDED_IP_REACH_SUBTLV) { consume += 1; if (len < consume) { - sbuf_push( - log, indent, - "Expected 1 byte of subtlv len, but no more data present.\n"); + sbuf_push(log, indent, + "Expected 1 byte of subtlv len, but no more data present.\n"); goto out; } subtlv_len = stream_getc(s); if (!subtlv_len) { - sbuf_push( - log, indent + 2, - " WARNING: subtlv bit is set, but there are no subtlvs.\n"); + sbuf_push(log, indent + 2, + " WARNING: subtlv bit is set, but there are no subtlvs.\n"); } consume += subtlv_len; if (len < consume) { - sbuf_push( - log, indent, - "Expected %" PRIu8 - " bytes of subtlvs, but only %u bytes available.\n", - subtlv_len, - len - 6 - PSIZE(rv->prefix.prefixlen)); + sbuf_push(log, indent, + "Expected %" PRIu8 + " bytes of subtlvs, but only %u bytes available.\n", + subtlv_len, + len - 6 - PSIZE(rv->prefix.prefixlen)); goto out; } sbuf_push(log, indent, "Skipping %" PRIu8 " bytes of subvls", @@ -1361,7 +1353,8 @@ static void format_item_ipv6_reach(uint16_t mtid, struct isis_item *i, sbuf_push(buf, indent, "%sIPv6 Reachability: %s (Metric: %u)%s%s", (mtid == ISIS_MT_IPV4_UNICAST) ? "" : "MT ", prefix2str(&r->prefix, prefixbuf, sizeof(prefixbuf)), - r->metric, r->down ? " Down" : "", + r->metric, + r->down ? " Down" : "", r->external ? " External" : ""); if (mtid != ISIS_MT_IPV4_UNICAST) sbuf_push(buf, 0, " %s", isis_mtid2str(mtid)); @@ -1426,11 +1419,10 @@ static int unpack_item_ipv6_reach(uint16_t mtid, uint8_t len, struct stream *s, (mtid == ISIS_MT_IPV4_UNICAST) ? "" : "mt "); consume = 6; if (len < consume) { - sbuf_push( - log, indent, - "Not enough data left. (expected 6 or more bytes, got %" PRIu8 - ")\n", - len); + sbuf_push(log, indent, + "Not enough data left. (expected 6 or more bytes, got %" + PRIu8 ")\n", + len); goto out; } @@ -1451,10 +1443,9 @@ static int unpack_item_ipv6_reach(uint16_t mtid, uint8_t len, struct stream *s, consume += PSIZE(rv->prefix.prefixlen); if (len < consume) { - sbuf_push( - log, indent, - "Expected %u bytes of prefix, but only %u bytes available.\n", - PSIZE(rv->prefix.prefixlen), len - 6); + sbuf_push(log, indent, + "Expected %u bytes of prefix, but only %u bytes available.\n", + PSIZE(rv->prefix.prefixlen), len - 6); goto out; } stream_get(&rv->prefix.prefix.s6_addr, s, PSIZE(rv->prefix.prefixlen)); @@ -1468,26 +1459,23 @@ static int unpack_item_ipv6_reach(uint16_t mtid, uint8_t len, struct stream *s, if (control & ISIS_IPV6_REACH_SUBTLV) { consume += 1; if (len < consume) { - sbuf_push( - log, indent, - "Expected 1 byte of subtlv len, but no more data persent.\n"); + sbuf_push(log, indent, + "Expected 1 byte of subtlv len, but no more data persent.\n"); goto out; } subtlv_len = stream_getc(s); if (!subtlv_len) { - sbuf_push( - log, indent + 2, - " WARNING: subtlv bit set, but there are no subtlvs.\n"); + sbuf_push(log, indent + 2, + " WARNING: subtlv bit set, but there are no subtlvs.\n"); } consume += subtlv_len; if (len < consume) { - sbuf_push( - log, indent, - "Expected %" PRIu8 - " bytes of subtlvs, but only %u bytes available.\n", - subtlv_len, - len - 6 - PSIZE(rv->prefix.prefixlen)); + sbuf_push(log, indent, + "Expected %" PRIu8 + " bytes of subtlvs, but only %u bytes available.\n", + subtlv_len, + len - 6 - PSIZE(rv->prefix.prefixlen)); goto out; } @@ -1710,19 +1698,16 @@ static int pack_item(enum isis_tlv_context context, enum isis_tlv_type type, return 1; } -static void add_item_to_fragment(struct isis_item *i, - struct pack_order_entry *pe, +static void add_item_to_fragment(struct isis_item *i, struct pack_order_entry *pe, struct isis_tlvs *fragment_tlvs, uint16_t mtid) { struct isis_item_list *l; if (pe->how_to_pack == ISIS_ITEMS) { - l = (struct isis_item_list *)(((char *)fragment_tlvs) - + pe->what_to_pack); + l = (struct isis_item_list *)(((char *)fragment_tlvs) + pe->what_to_pack); } else { struct isis_mt_item_list *m; - m = (struct isis_mt_item_list *)(((char *)fragment_tlvs) - + pe->what_to_pack); + m = (struct isis_mt_item_list *)(((char *)fragment_tlvs) + pe->what_to_pack); l = isis_get_mt_items(m, mtid); } @@ -2459,11 +2444,9 @@ static int unpack_tlv(enum isis_tlv_context context, size_t avail_len, tlv_type, tlv_len); if (avail_len < ((size_t)tlv_len) + 2) { - sbuf_push( - log, indent + 2, - "Available data %zu too short for claimed TLV len %" PRIu8 - ".\n", - avail_len - 2, tlv_len); + sbuf_push(log, indent + 2, + "Available data %zu too short for claimed TLV len %" PRIu8 ".\n", + avail_len - 2, tlv_len); return 1; } @@ -2541,7 +2524,7 @@ int isis_unpack_tlvs(size_t avail_len, struct stream *stream, static const struct tlv_ops tlv_##_name_##_ops = { \ .name = _desc_, \ .unpack = unpack_tlv_with_items, \ - \ + \ .pack_item = pack_item_##_name_, \ .free_item = free_item_##_name_, \ .unpack_item = unpack_item_##_name_, \ @@ -2571,49 +2554,34 @@ ITEM_TLV_OPS(ipv6_reach, "TLV 236 IPv6 Reachability"); SUBTLV_OPS(ipv6_source_prefix, "Sub-TLV 22 IPv6 Source Prefix"); -static const struct tlv_ops *tlv_table[ISIS_CONTEXT_MAX][ISIS_TLV_MAX] = - {[ISIS_CONTEXT_LSP] = - { - [ISIS_TLV_AREA_ADDRESSES] = - &tlv_area_address_ops, - [ISIS_TLV_OLDSTYLE_REACH] = - &tlv_oldstyle_reach_ops, - [ISIS_TLV_LAN_NEIGHBORS] = - &tlv_lan_neighbor_ops, - [ISIS_TLV_LSP_ENTRY] = &tlv_lsp_entry_ops, - [ISIS_TLV_AUTH] = &tlv_auth_ops, - [ISIS_TLV_EXTENDED_REACH] = - &tlv_extended_reach_ops, - [ISIS_TLV_MT_REACH] = &tlv_extended_reach_ops, - [ISIS_TLV_OLDSTYLE_IP_REACH] = - &tlv_oldstyle_ip_reach_ops, - [ISIS_TLV_PROTOCOLS_SUPPORTED] = - &tlv_protocols_supported_ops, - [ISIS_TLV_OLDSTYLE_IP_REACH_EXT] = - &tlv_oldstyle_ip_reach_ops, - [ISIS_TLV_IPV4_ADDRESS] = - &tlv_ipv4_address_ops, - [ISIS_TLV_TE_ROUTER_ID] = - &tlv_te_router_id_ops, - [ISIS_TLV_EXTENDED_IP_REACH] = - &tlv_extended_ip_reach_ops, - [ISIS_TLV_MT_IP_REACH] = - &tlv_extended_ip_reach_ops, - [ISIS_TLV_DYNAMIC_HOSTNAME] = - &tlv_dynamic_hostname_ops, - [ISIS_TLV_MT_ROUTER_INFO] = - &tlv_mt_router_info_ops, - [ISIS_TLV_IPV6_ADDRESS] = - &tlv_ipv6_address_ops, - [ISIS_TLV_IPV6_REACH] = &tlv_ipv6_reach_ops, - [ISIS_TLV_MT_IPV6_REACH] = &tlv_ipv6_reach_ops, - }, - [ISIS_CONTEXT_SUBTLV_NE_REACH] = {}, - [ISIS_CONTEXT_SUBTLV_IP_REACH] = {}, - [ISIS_CONTEXT_SUBTLV_IPV6_REACH] = { - [ISIS_SUBTLV_IPV6_SOURCE_PREFIX] = - &subtlv_ipv6_source_prefix_ops, - }}; +static const struct tlv_ops *tlv_table[ISIS_CONTEXT_MAX][ISIS_TLV_MAX] = { + [ISIS_CONTEXT_LSP] = { + [ISIS_TLV_AREA_ADDRESSES] = &tlv_area_address_ops, + [ISIS_TLV_OLDSTYLE_REACH] = &tlv_oldstyle_reach_ops, + [ISIS_TLV_LAN_NEIGHBORS] = &tlv_lan_neighbor_ops, + [ISIS_TLV_LSP_ENTRY] = &tlv_lsp_entry_ops, + [ISIS_TLV_AUTH] = &tlv_auth_ops, + [ISIS_TLV_EXTENDED_REACH] = &tlv_extended_reach_ops, + [ISIS_TLV_MT_REACH] = &tlv_extended_reach_ops, + [ISIS_TLV_OLDSTYLE_IP_REACH] = &tlv_oldstyle_ip_reach_ops, + [ISIS_TLV_PROTOCOLS_SUPPORTED] = &tlv_protocols_supported_ops, + [ISIS_TLV_OLDSTYLE_IP_REACH_EXT] = &tlv_oldstyle_ip_reach_ops, + [ISIS_TLV_IPV4_ADDRESS] = &tlv_ipv4_address_ops, + [ISIS_TLV_TE_ROUTER_ID] = &tlv_te_router_id_ops, + [ISIS_TLV_EXTENDED_IP_REACH] = &tlv_extended_ip_reach_ops, + [ISIS_TLV_MT_IP_REACH] = &tlv_extended_ip_reach_ops, + [ISIS_TLV_DYNAMIC_HOSTNAME] = &tlv_dynamic_hostname_ops, + [ISIS_TLV_MT_ROUTER_INFO] = &tlv_mt_router_info_ops, + [ISIS_TLV_IPV6_ADDRESS] = &tlv_ipv6_address_ops, + [ISIS_TLV_IPV6_REACH] = &tlv_ipv6_reach_ops, + [ISIS_TLV_MT_IPV6_REACH] = &tlv_ipv6_reach_ops, + }, + [ISIS_CONTEXT_SUBTLV_NE_REACH] = {}, + [ISIS_CONTEXT_SUBTLV_IP_REACH] = {}, + [ISIS_CONTEXT_SUBTLV_IPV6_REACH] = { + [ISIS_SUBTLV_IPV6_SOURCE_PREFIX] = &subtlv_ipv6_source_prefix_ops, + } +}; /* Accessor functions */ diff --git a/isisd/isisd.h b/isisd/isisd.h index a8dcc8adaf..4cf164d00a 100644 --- a/isisd/isisd.h +++ b/isisd/isisd.h @@ -52,9 +52,8 @@ struct isis { struct area_addr *man_area_addrs; /* manualAreaAddresses */ u_int32_t debugs; /* bitmap for debug */ time_t uptime; /* when did we start */ - struct thread *t_dync_clean; /* dynamic hostname cache cleanup thread */ - uint32_t circuit_ids_used - [8]; /* 256 bits to track circuit ids 0 through 255 */ + struct thread *t_dync_clean; /* dynamic hostname cache cleanup thread */ + uint32_t circuit_ids_used[8]; /* 256 bits to track circuit ids 0 through 255 */ struct route_table *ext_info[REDIST_PROTOCOL_COUNT]; -- 2.39.5