isisd: use ISIS_LEVELS instead of hardcoded array sizes whenever possible

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
This commit is contained in:
Renato Westphal 2020-08-10 23:01:15 -03:00
parent 14c6e77243
commit 981cc629e8

View File

@ -50,16 +50,18 @@ struct metric {
};
struct isis_bcast_info {
uint8_t snpa[ETH_ALEN]; /* SNPA of this circuit */
char run_dr_elect[2]; /* Should we run dr election ? */
struct thread *t_run_dr[2]; /* DR election thread */
struct thread *t_send_lan_hello[2]; /* send LAN IIHs in this thread */
struct list *adjdb[2]; /* adjacency dbs */
struct list *lan_neighs[2]; /* list of lx neigh snpa */
char is_dr[2]; /* Are we level x DR ? */
uint8_t snpa[ETH_ALEN]; /* SNPA of this circuit */
char run_dr_elect[ISIS_LEVELS]; /* Should we run dr election ? */
struct thread *t_run_dr[ISIS_LEVELS]; /* DR election thread */
struct thread *t_send_lan_hello[ISIS_LEVELS]; /* send LAN IIHs in this
thread */
struct list *adjdb[ISIS_LEVELS]; /* adjacency dbs */
struct list *lan_neighs[ISIS_LEVELS]; /* list of lx neigh snpa */
char is_dr[ISIS_LEVELS]; /* Are we level x DR ? */
uint8_t l1_desig_is[ISIS_SYS_ID_LEN + 1]; /* level-1 DR */
uint8_t l2_desig_is[ISIS_SYS_ID_LEN + 1]; /* level-2 DR */
struct thread *t_refresh_pseudo_lsp[2]; /* refresh pseudo-node LSPs */
struct thread *t_refresh_pseudo_lsp[ISIS_LEVELS]; /* refresh pseudo-node
LSPs */
};
struct isis_p2p_info {
@ -86,10 +88,11 @@ struct isis_circuit {
* Threads
*/
struct thread *t_read;
struct thread *t_send_csnp[2];
struct thread *t_send_psnp[2];
struct thread *t_send_csnp[ISIS_LEVELS];
struct thread *t_send_psnp[ISIS_LEVELS];
struct isis_tx_queue *tx_queue;
struct isis_circuit_arg level_arg[2]; /* used as argument for threads */
struct isis_circuit_arg
level_arg[ISIS_LEVELS]; /* used as argument for threads */
/* there is no real point in two streams, just for programming kicker */
int (*rx)(struct isis_circuit *circuit, uint8_t *ssnpa);
@ -107,7 +110,7 @@ struct isis_circuit {
struct isis_bcast_info bc;
struct isis_p2p_info p2p;
} u;
uint8_t priority[2]; /* l1/2 IS configured priority */
uint8_t priority[ISIS_LEVELS]; /* l1/2 IS configured priority */
int pad_hellos; /* add padding to Hello PDUs ? */
char ext_domain; /* externalDomain (boolean) */
int lsp_regenerate_pending[ISIS_LEVELS];
@ -117,12 +120,12 @@ struct isis_circuit {
struct isis_passwd passwd; /* Circuit rx/tx password */
int is_type; /* circuit is type == level of circuit
* differentiated from circuit type (media) */
uint32_t hello_interval[2]; /* hello-interval in seconds */
uint16_t hello_multiplier[2]; /* hello-multiplier */
uint16_t csnp_interval[2]; /* csnp-interval in seconds */
uint16_t psnp_interval[2]; /* psnp-interval in seconds */
uint8_t metric[2];
uint32_t te_metric[2];
uint32_t hello_interval[ISIS_LEVELS]; /* hello-interval in seconds */
uint16_t hello_multiplier[ISIS_LEVELS]; /* hello-multiplier */
uint16_t csnp_interval[ISIS_LEVELS]; /* csnp-interval in seconds */
uint16_t psnp_interval[ISIS_LEVELS]; /* psnp-interval in seconds */
uint8_t metric[ISIS_LEVELS];
uint32_t te_metric[ISIS_LEVELS];
struct isis_ext_subtlvs *ext; /* Extended parameters (TE + Adj SID */
int ip_router; /* Route IP ? */
int is_passive; /* Is Passive ? */
@ -131,7 +134,7 @@ struct isis_circuit {
int ipv6_router; /* Route IPv6 ? */
struct list *ipv6_link; /* our link local IPv6 addresses */
struct list *ipv6_non_link; /* our non-link local IPv6 addresses */
uint16_t upadjcount[2];
uint16_t upadjcount[ISIS_LEVELS];
#define ISIS_CIRCUIT_FLAPPED_AFTER_SPF 0x01
uint8_t flags;
bool disable_threeway_adj;
@ -143,8 +146,8 @@ struct isis_circuit {
uint32_t init_failures; /* intialisationFailures */
uint32_t ctrl_pdus_rxed; /* controlPDUsReceived */
uint32_t ctrl_pdus_txed; /* controlPDUsSent */
uint32_t
desig_changes[2]; /* lanLxDesignatedIntermediateSystemChanges */
uint32_t desig_changes[ISIS_LEVELS]; /* lanLxDesignatedIntermediateSystemChanges
*/
uint32_t rej_adjacencies; /* rejectedAdjacencies */
/*
* Counters as in ietf-isis@2019-09-09.yang