}
start = (char *)link_lsa + sizeof(struct ospf6_link_lsa);
- end = (char *)lsa->header + ntohs(lsa->header->length);
+ end = ospf6_lsa_end(lsa->header);
+
for (current = start; current < end;
current += OSPF6_PREFIX_SIZE(prefix)) {
prefix = (struct ospf6_prefix *)current;
start = (char *)intra_prefix_lsa
+ sizeof(struct ospf6_intra_prefix_lsa);
- end = (char *)lsa->header + ntohs(lsa->header->length);
+ end = ospf6_lsa_end(lsa->header);
current = start;
while (current + sizeof(struct ospf6_prefix) <= end) {
start = (char *)intra_prefix_lsa
+ sizeof(struct ospf6_intra_prefix_lsa);
- end = (char *)lsa->header + ntohs(lsa->header->length);
+ end = ospf6_lsa_end(lsa->header);
+
for (current = start; current < end;
current += OSPF6_PREFIX_SIZE(prefix)) {
prefix = (struct ospf6_prefix *)current;
prefix_num = (unsigned short)ntohl(link_lsa->prefix_num);
start = (char *)link_lsa + sizeof(struct ospf6_link_lsa);
- end = (char *)lsa->header + ntohs(lsa->header->length);
+ end = ospf6_lsa_end(lsa->header);
+
for (current = start; current < end && prefix_num;
current += OSPF6_PREFIX_SIZE(op)) {
op = (struct ospf6_prefix *)current;
prefix_num = ntohs(intra_prefix_lsa->prefix_num);
start = (caddr_t)intra_prefix_lsa
+ sizeof(struct ospf6_intra_prefix_lsa);
- end = OSPF6_LSA_END(lsa->header);
+ end = ospf6_lsa_end(lsa->header);
for (current = start; current < end; current += OSPF6_PREFIX_SIZE(op)) {
op = (struct ospf6_prefix *)current;
if (prefix_num == 0)
prefix_num = ntohs(intra_prefix_lsa->prefix_num);
start = (caddr_t)intra_prefix_lsa
+ sizeof(struct ospf6_intra_prefix_lsa);
- end = OSPF6_LSA_END(lsa->header);
+ end = ospf6_lsa_end(lsa->header);
for (current = start; current < end; current += OSPF6_PREFIX_SIZE(op)) {
op = (struct ospf6_prefix *)current;
if (prefix_num == 0)
char *start, *end, *current;
start = ospf6_lsa_header_end(lsa->header);
- end = (char *)lsa->header + ntohs(lsa->header->length);
+ end = ospf6_lsa_end(lsa->header);
if (use_json) {
json_object_string_add(json_obj, "lsaType", "unknown");
json_object *json = NULL;
start = (uint8_t *)lsa->header;
- end = (uint8_t *)lsa->header + ntohs(lsa->header->length);
+ end = (uint8_t *)ospf6_lsa_end(lsa->header);
if (use_json) {
json = json_object_new_object();
};
#define OSPF6_LSA_SIZE(h) (ntohs(((struct ospf6_lsa_header *)(h))->length))
-#define OSPF6_LSA_END(h) \
- ((caddr_t)(h) + ntohs(((struct ospf6_lsa_header *)(h))->length))
static inline char *ospf6_lsa_header_end(struct ospf6_lsa_header *header)
{
return (char *)header + sizeof(struct ospf6_lsa_header);
}
+static inline char *ospf6_lsa_end(struct ospf6_lsa_header *header)
+{
+ return (char *)header + ntohs(header->length);
+}
+
#define OSPF6_LSA_IS_TYPE(t, L) \
((L)->header->type == htons(OSPF6_LSTYPE_##t) ? 1 : 0)
#define OSPF6_LSA_IS_SAME(L1, L2) \
? sizeof(struct ospf6_router_lsdesc)
: sizeof(struct ospf6_network_lsdesc));
for (backlink = ospf6_lsa_header_end(lsa->header) + 4;
- backlink + size <= OSPF6_LSA_END(lsa->header); backlink += size) {
+ backlink + size <= ospf6_lsa_end(lsa->header); backlink += size) {
assert(!(OSPF6_LSA_IS_TYPE(NETWORK, lsa)
&& VERTEX_IS_TYPE(NETWORK, v)));
? sizeof(struct ospf6_router_lsdesc)
: sizeof(struct ospf6_network_lsdesc));
for (lsdesc = ospf6_lsa_header_end(v->lsa->header) + 4;
- lsdesc + size <= OSPF6_LSA_END(v->lsa->header);
+ lsdesc + size <= ospf6_lsa_end(v->lsa->header);
lsdesc += size) {
lsa = ospf6_lsdesc_lsa(lsdesc, v);
if (lsa == NULL)