diff --git a/ospf6d/ospf6_lsa.h b/ospf6d/ospf6_lsa.h index 29a86c71c596..156b95645a54 100644 --- a/ospf6d/ospf6_lsa.h +++ b/ospf6d/ospf6_lsa.h @@ -116,6 +116,19 @@ inline uint16_t ospf6_lsa_size(struct ospf6_lsa_header *header) #define OSPF6_LSA_IS_CHANGED(L1, L2) ospf6_lsa_is_changed (L1, L2) #define OSPF6_LSA_IS_SEQWRAP(L) ((L)->header->seqnum == htonl(OSPF_MAX_SEQUENCE_NUMBER + 1)) +#define lsa_from_container(type, container) \ + ((struct type *)((char *)container->header + \ + sizeof(struct ospf6_lsa_header))) + +#define lsdesc_start(lsdesc_type, lsa) \ + ((struct lsdesc_type *)((char *)lsa + sizeof(*lsa))) + +#define for_each_lsdesc(current, lsa_type, lsdesc_type, lsa_container) \ + for (current = \ + lsdesc_start(lsdesc_type, \ + lsa_from_container(lsa_type, lsa_container)); \ + (char *)(current + 1) <= ospf6_lsa_end(lsa_container->header); \ + current++) struct ospf6_lsa { char name[64]; /* dump string */