summaryrefslogtreecommitdiff
path: root/ospf6d/ospf6_gr_helper.c
diff options
context:
space:
mode:
authorAndrew Cooks <acooks.at.bda@gmail.com>2024-07-18 12:56:14 +1000
committerAndrew Cooks <acooks.at.bda@gmail.com>2024-09-16 18:38:16 +1000
commitd0366de57c11a7698945acc1dfaf8a6bead1f6f5 (patch)
treeba30a659bcfc254368c3dd56fe12226e7f188de3 /ospf6d/ospf6_gr_helper.c
parent1bb4955371b234e3833fbe8421bf31838d9aae7b (diff)
ospf6d: replace TLV_HDR_TOP macro with lsdesc_start function
The original TLV_HDR_TOP implementation only worked for Graceful Restart LSAs, because they had no "LSA body". This change introduces a body size lookup table and changes the macro to a function that accounts for the LSA body for all LSA types, and provides type checking on the provided pointer before arithmetic. It also removes the open type casting and pointer arithmetic. The introduced lsdesc_start() is used to find the start of a descriptor, and will be used for TLVs in E-LSAs as well as old LSA. Signed-off-by: Andrew Cooks <acooks.at.bda@gmail.com>
Diffstat (limited to 'ospf6d/ospf6_gr_helper.c')
-rw-r--r--ospf6d/ospf6_gr_helper.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ospf6d/ospf6_gr_helper.c b/ospf6d/ospf6_gr_helper.c
index e02a841d00..639d56e273 100644
--- a/ospf6d/ospf6_gr_helper.c
+++ b/ospf6d/ospf6_gr_helper.c
@@ -145,7 +145,7 @@ static int ospf6_extract_grace_lsa_fields(struct ospf6_lsa *lsa,
length = ntohs(lsah->length) - OSPF6_LSA_HEADER_SIZE;
- for (tlvh = TLV_HDR_TOP(lsah); sum < length && tlvh;
+ for (tlvh = lsdesc_start(lsah); sum < length && tlvh;
tlvh = TLV_HDR_NEXT(tlvh)) {
/* Check TLV len against overall LSA */
@@ -1241,7 +1241,7 @@ static int ospf6_grace_lsa_show_info(struct vty *vty, struct ospf6_lsa *lsa,
zlog_debug(" TLV info:");
}
- for (tlvh = TLV_HDR_TOP(lsah); sum < length && tlvh;
+ for (tlvh = lsdesc_start(lsah); sum < length && tlvh;
tlvh = TLV_HDR_NEXT(tlvh)) {
/* Check TLV len */