summaryrefslogtreecommitdiffstats
path: root/isisd/isis_pdu.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@nvidia.com>2020-10-09 14:00:44 +0200
committerDonald Sharp <sharpd@nvidia.com>2020-10-09 14:18:21 +0200
commit99e5d4af38875ce1919abeabe4030ea4cfc48ed1 (patch)
treebb2773af57498b9679ce8eb2725bf49587b289dc /isisd/isis_pdu.c
parentisisd: Always set `circuit->isis` on creation (diff)
downloadfrr-99e5d4af38875ce1919abeabe4030ea4cfc48ed1.tar.xz
frr-99e5d4af38875ce1919abeabe4030ea4cfc48ed1.zip
isisd: circuit->area->isis to circuit->isis
The code in isisd uses `circuit->area->isis` all the time but we know that circuit now has a valid `circuit->isis` pointer so let's use that and cleanup the long dereference. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to 'isisd/isis_pdu.c')
-rw-r--r--isisd/isis_pdu.c31
1 files changed, 13 insertions, 18 deletions
diff --git a/isisd/isis_pdu.c b/isisd/isis_pdu.c
index 43b9f6685..d6f257117 100644
--- a/isisd/isis_pdu.c
+++ b/isisd/isis_pdu.c
@@ -76,8 +76,7 @@ static int ack_lsp(struct isis_lsp_hdr *hdr, struct isis_circuit *circuit,
lenp = stream_get_endp(circuit->snd_stream);
stream_putw(circuit->snd_stream, 0); /* PDU length */
- stream_put(circuit->snd_stream, circuit->area->isis->sysid,
- ISIS_SYS_ID_LEN);
+ stream_put(circuit->snd_stream, circuit->isis->sysid, ISIS_SYS_ID_LEN);
stream_putc(circuit->snd_stream, circuit->idx);
stream_putc(circuit->snd_stream, 9); /* code */
stream_putc(circuit->snd_stream, 16); /* len */
@@ -143,8 +142,8 @@ static int process_p2p_hello(struct iih_info *iih)
}
if (tw_adj->neighbor_set
- && (memcmp(tw_adj->neighbor_id,
- iih->circuit->area->isis->sysid, ISIS_SYS_ID_LEN)
+ && (memcmp(tw_adj->neighbor_id, iih->circuit->isis->sysid,
+ ISIS_SYS_ID_LEN)
|| tw_adj->neighbor_circuit_id
!= (uint32_t)iih->circuit->idx)) {
@@ -728,7 +727,7 @@ static int process_hello(uint8_t pdu_type, struct isis_circuit *circuit,
goto out;
}
- if (!memcmp(iih.sys_id, circuit->area->isis->sysid, ISIS_SYS_ID_LEN)) {
+ if (!memcmp(iih.sys_id, circuit->isis->sysid, ISIS_SYS_ID_LEN)) {
zlog_warn(
"ISIS-Adj (%s): Received IIH with own sysid - discard",
circuit->area->area_tag);
@@ -1044,7 +1043,7 @@ dontcheckadj:
ack_lsp(&hdr, circuit, level);
goto out; /* FIXME: do we need a purge? */
} else {
- if (memcmp(hdr.lsp_id, circuit->area->isis->sysid,
+ if (memcmp(hdr.lsp_id, circuit->isis->sysid,
ISIS_SYS_ID_LEN)) {
/* LSP by some other system -> do 7.3.16.4 b) */
/* 7.3.16.4 b) 1) */
@@ -1139,8 +1138,7 @@ dontcheckadj:
}
/* 7.3.15.1 c) - If this is our own lsp and we don't have it initiate a
* purge */
- if (memcmp(hdr.lsp_id, circuit->area->isis->sysid, ISIS_SYS_ID_LEN)
- == 0) {
+ if (memcmp(hdr.lsp_id, circuit->isis->sysid, ISIS_SYS_ID_LEN) == 0) {
if (!lsp) {
/* 7.3.16.4: initiate a purge */
lsp_purge_non_exist(level, &hdr, circuit->area);
@@ -1427,7 +1425,7 @@ static int process_snp(uint8_t pdu_type, struct isis_circuit *circuit,
entry = entry->next) {
struct isis_lsp *lsp =
lsp_search(&circuit->area->lspdb[level - 1], entry->id);
- bool own_lsp = !memcmp(entry->id, circuit->area->isis->sysid,
+ bool own_lsp = !memcmp(entry->id, circuit->isis->sysid,
ISIS_SYS_ID_LEN);
if (lsp) {
/* 7.3.15.2 b) 1) is this LSP newer */
@@ -1468,7 +1466,7 @@ static int process_snp(uint8_t pdu_type, struct isis_circuit *circuit,
* insert it and set SSN on it */
if (entry->rem_lifetime && entry->checksum
&& entry->seqno
- && memcmp(entry->id, circuit->area->isis->sysid,
+ && memcmp(entry->id, circuit->isis->sysid,
ISIS_SYS_ID_LEN)) {
struct isis_lsp *lsp0 = NULL;
@@ -1679,11 +1677,11 @@ int isis_handle_pdu(struct isis_circuit *circuit, uint8_t *ssnpa)
if (pdu_type != FS_LINK_STATE /* FS PDU doesn't contain max area addr
field */
&& max_area_addrs != 0
- && max_area_addrs != circuit->area->isis->max_area_addrs) {
+ && max_area_addrs != circuit->isis->max_area_addrs) {
flog_err(
EC_ISIS_PACKET,
"maximumAreaAddressesMismatch: maximumAreaAdresses in a received PDU %hhu while the parameter for this IS is %u",
- max_area_addrs, circuit->area->isis->max_area_addrs);
+ max_area_addrs, circuit->isis->max_area_addrs);
circuit->max_area_addr_mismatches++;
#ifndef FABRICD
/* send northbound notification */
@@ -1792,8 +1790,7 @@ static void put_hello_hdr(struct isis_circuit *circuit, int level,
fill_fixed_hdr(pdu_type, circuit->snd_stream);
stream_putc(circuit->snd_stream, circuit->is_type);
- stream_put(circuit->snd_stream, circuit->area->isis->sysid,
- ISIS_SYS_ID_LEN);
+ stream_put(circuit->snd_stream, circuit->isis->sysid, ISIS_SYS_ID_LEN);
uint32_t holdtime = circuit->hello_multiplier[level - 1]
* circuit->hello_interval[level - 1];
@@ -2064,8 +2061,7 @@ int send_csnp(struct isis_circuit *circuit, int level)
size_t len_pointer = stream_get_endp(circuit->snd_stream);
stream_putw(circuit->snd_stream, 0);
- stream_put(circuit->snd_stream, circuit->area->isis->sysid,
- ISIS_SYS_ID_LEN);
+ stream_put(circuit->snd_stream, circuit->isis->sysid, ISIS_SYS_ID_LEN);
/* with zero circuit id - ref 9.10, 9.11 */
stream_putc(circuit->snd_stream, 0);
@@ -2242,8 +2238,7 @@ static int send_psnp(int level, struct isis_circuit *circuit)
size_t len_pointer = stream_get_endp(circuit->snd_stream);
stream_putw(circuit->snd_stream, 0); /* length is filled in later */
- stream_put(circuit->snd_stream, circuit->area->isis->sysid,
- ISIS_SYS_ID_LEN);
+ stream_put(circuit->snd_stream, circuit->isis->sysid, ISIS_SYS_ID_LEN);
stream_putc(circuit->snd_stream, circuit->idx);
struct isis_passwd *passwd = (level == ISIS_LEVEL1)