summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ospf6d/ospf6_abr.c25
-rw-r--r--ospf6d/ospf6_asbr.c26
-rw-r--r--ospf6d/ospf6_gr.c2
-rw-r--r--ospf6d/ospf6_intra.c33
-rw-r--r--ospf6d/ospf6_lsa.c6
-rw-r--r--ospf6d/ospf6_lsa.h5
-rw-r--r--ospf6d/ospf6_lsdb.c3
-rw-r--r--ospf6d/ospf6_message.c11
-rw-r--r--ospf6d/ospf6_nssa.c21
-rw-r--r--ospf6d/ospf6_spf.c6
10 files changed, 50 insertions, 88 deletions
diff --git a/ospf6d/ospf6_abr.c b/ospf6d/ospf6_abr.c
index 0c5be29ff..343dfefce 100644
--- a/ospf6d/ospf6_abr.c
+++ b/ospf6d/ospf6_abr.c
@@ -553,8 +553,7 @@ int ospf6_abr_originate_summary_to_area(struct ospf6_route *route,
lsa_header = (struct ospf6_lsa_header *)buffer;
if (route->type == OSPF6_DEST_TYPE_ROUTER) {
- router_lsa = (struct ospf6_inter_router_lsa *)
- ospf6_lsa_header_end(lsa_header);
+ router_lsa = lsa_after_header(lsa_header);
p = (caddr_t)router_lsa + sizeof(struct ospf6_inter_router_lsa);
/* Fill Inter-Area-Router-LSA */
@@ -565,8 +564,7 @@ int ospf6_abr_originate_summary_to_area(struct ospf6_route *route,
router_lsa->router_id = ADV_ROUTER_IN_PREFIX(&route->prefix);
type = htons(OSPF6_LSTYPE_INTER_ROUTER);
} else {
- prefix_lsa = (struct ospf6_inter_prefix_lsa *)
- ospf6_lsa_header_end(lsa_header);
+ prefix_lsa = lsa_after_header(lsa_header);
p = (caddr_t)prefix_lsa + sizeof(struct ospf6_inter_prefix_lsa);
/* Fill Inter-Area-Prefix-LSA */
@@ -1016,8 +1014,7 @@ void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa)
oa->name);
}
- prefix_lsa = (struct ospf6_inter_prefix_lsa *)
- ospf6_lsa_header_end(lsa->header);
+ prefix_lsa = lsa_after_header(lsa->header);
prefix.family = AF_INET6;
prefix.prefixlen = prefix_lsa->prefix.prefix_length;
ospf6_prefix_in6_addr(&prefix.u.prefix6, prefix_lsa,
@@ -1036,8 +1033,7 @@ void ospf6_abr_examin_summary(struct ospf6_lsa *lsa, struct ospf6_area *oa)
oa->name);
}
- router_lsa = (struct ospf6_inter_router_lsa *)
- ospf6_lsa_header_end(lsa->header);
+ router_lsa = lsa_after_header(lsa->header);
ospf6_linkstate_prefix(router_lsa->router_id, htonl(0), &prefix);
if (is_debug)
inet_ntop(AF_INET, &router_lsa->router_id, buf,
@@ -1429,8 +1425,7 @@ static char *ospf6_inter_area_prefix_lsa_get_prefix_str(struct ospf6_lsa *lsa,
char tbuf[16];
if (lsa != NULL) {
- prefix_lsa = (struct ospf6_inter_prefix_lsa *)
- ospf6_lsa_header_end(lsa->header);
+ prefix_lsa = lsa_after_header(lsa->header);
ospf6_prefix_in6_addr(&in6, prefix_lsa, &prefix_lsa->prefix);
if (buf) {
@@ -1452,8 +1447,7 @@ static int ospf6_inter_area_prefix_lsa_show(struct vty *vty,
struct ospf6_inter_prefix_lsa *prefix_lsa;
char buf[INET6_ADDRSTRLEN];
- prefix_lsa = (struct ospf6_inter_prefix_lsa *)ospf6_lsa_header_end(
- lsa->header);
+ prefix_lsa = lsa_after_header(lsa->header);
if (use_json) {
json_object_int_add(
@@ -1489,9 +1483,7 @@ static char *ospf6_inter_area_router_lsa_get_prefix_str(struct ospf6_lsa *lsa,
struct ospf6_inter_router_lsa *router_lsa;
if (lsa != NULL) {
- router_lsa = (struct ospf6_inter_router_lsa *)
- ospf6_lsa_header_end(lsa->header);
-
+ router_lsa = lsa_after_header(lsa->header);
if (buf)
inet_ntop(AF_INET, &router_lsa->router_id, buf, buflen);
@@ -1508,8 +1500,7 @@ static int ospf6_inter_area_router_lsa_show(struct vty *vty,
struct ospf6_inter_router_lsa *router_lsa;
char buf[64];
- router_lsa = (struct ospf6_inter_router_lsa *)ospf6_lsa_header_end(
- lsa->header);
+ router_lsa = lsa_after_header(lsa->header);
ospf6_options_printbuf(router_lsa->options, buf, sizeof(buf));
if (use_json) {
diff --git a/ospf6d/ospf6_asbr.c b/ospf6d/ospf6_asbr.c
index caac70462..8fa85badb 100644
--- a/ospf6d/ospf6_asbr.c
+++ b/ospf6d/ospf6_asbr.c
@@ -103,8 +103,7 @@ struct ospf6_lsa *ospf6_as_external_lsa_originate(struct ospf6_route *route,
/* prepare buffer */
memset(buffer, 0, sizeof(buffer));
lsa_header = (struct ospf6_lsa_header *)buffer;
- as_external_lsa = (struct ospf6_as_external_lsa *)ospf6_lsa_header_end(
- lsa_header);
+ as_external_lsa = lsa_after_header(lsa_header);
p = (caddr_t)((caddr_t)as_external_lsa
+ sizeof(struct ospf6_as_external_lsa));
@@ -217,8 +216,7 @@ static route_tag_t ospf6_as_external_lsa_get_tag(struct ospf6_lsa *lsa)
if (!lsa)
return 0;
- external = (struct ospf6_as_external_lsa *)ospf6_lsa_header_end(
- lsa->header);
+ external = lsa_after_header(lsa->header);
if (!CHECK_FLAG(external->bits_metric, OSPF6_ASBR_BIT_T))
return 0;
@@ -521,8 +519,7 @@ void ospf6_asbr_lsa_add(struct ospf6_lsa *lsa)
type = ntohs(lsa->header->type);
oa = lsa->lsdb->data;
- external = (struct ospf6_as_external_lsa *)ospf6_lsa_header_end(
- lsa->header);
+ external = lsa_after_header(lsa->header);
if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL))
zlog_debug("Calculate AS-External route for %s", lsa->name);
@@ -726,8 +723,7 @@ void ospf6_asbr_lsa_remove(struct ospf6_lsa *lsa,
int type;
bool debug = false;
- external = (struct ospf6_as_external_lsa *)ospf6_lsa_header_end(
- lsa->header);
+ external = lsa_after_header(lsa->header);
if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL) || (IS_OSPF6_DEBUG_NSSA))
debug = true;
@@ -2425,8 +2421,7 @@ static char *ospf6_as_external_lsa_get_prefix_str(struct ospf6_lsa *lsa,
char tbuf[16];
if (lsa) {
- external = (struct ospf6_as_external_lsa *)ospf6_lsa_header_end(
- lsa->header);
+ external = lsa_after_header(lsa->header);
if (pos == 0) {
ospf6_prefix_in6_addr(&in6, external,
@@ -2460,8 +2455,7 @@ static int ospf6_as_external_lsa_show(struct vty *vty, struct ospf6_lsa *lsa,
char buf[64];
assert(lsa->header);
- external = (struct ospf6_as_external_lsa *)ospf6_lsa_header_end(
- lsa->header);
+ external = lsa_after_header(lsa->header);
/* bits */
snprintf(buf, sizeof(buf), "%c%c%c",
@@ -3028,8 +3022,7 @@ ospf6_originate_summary_lsa(struct ospf6 *ospf6,
return;
}
- external = (struct ospf6_as_external_lsa *)ospf6_lsa_header_end(
- aggr_lsa->header);
+ external = lsa_after_header(aggr_lsa->header);
metric = (unsigned long)OSPF6_ASBR_METRIC(external);
tag = ospf6_as_external_lsa_get_tag(aggr_lsa);
mtype = CHECK_FLAG(external->bits_metric,
@@ -3177,7 +3170,7 @@ ospf6_handle_external_aggr_modify(struct ospf6 *ospf6,
return OSPF6_FAILURE;
}
- asel = (struct ospf6_as_external_lsa *)ospf6_lsa_header_end(lsa->header);
+ asel = lsa_after_header(lsa->header);
metric = (unsigned long)OSPF6_ASBR_METRIC(asel);
tag = ospf6_as_external_lsa_get_tag(lsa);
mtype = CHECK_FLAG(asel->bits_metric,
@@ -3366,8 +3359,7 @@ static void ospf6_handle_aggregated_exnl_rt(struct ospf6 *ospf6,
lsa = ospf6_lsdb_lookup(htons(OSPF6_LSTYPE_AS_EXTERNAL),
htonl(info->id), ospf6->router_id, ospf6->lsdb);
if (lsa) {
- ext_lsa = (struct ospf6_as_external_lsa *)ospf6_lsa_header_end(
- lsa->header);
+ ext_lsa = lsa_after_header(lsa->header);
if (rt->prefix.prefixlen != ext_lsa->prefix.prefix_length)
return;
diff --git a/ospf6d/ospf6_gr.c b/ospf6d/ospf6_gr.c
index 543de1c9e..74a7cccd1 100644
--- a/ospf6d/ospf6_gr.c
+++ b/ospf6d/ospf6_gr.c
@@ -56,7 +56,7 @@ static int ospf6_gr_lsa_originate(struct ospf6_interface *oi,
/* prepare buffer */
memset(buffer, 0, sizeof(buffer));
lsa_header = (struct ospf6_lsa_header *)buffer;
- grace_lsa = (struct ospf6_grace_lsa *)ospf6_lsa_header_end(lsa_header);
+ grace_lsa = lsa_after_header(lsa_header);
/* Put grace period. */
grace_lsa->tlv_period.header.type = htons(TLV_GRACE_PERIOD_TYPE);
diff --git a/ospf6d/ospf6_intra.c b/ospf6d/ospf6_intra.c
index 5d9beb561..77365ac4a 100644
--- a/ospf6d/ospf6_intra.c
+++ b/ospf6d/ospf6_intra.c
@@ -243,7 +243,7 @@ void ospf6_router_lsa_originate(struct event *thread)
memset(buffer, 0, sizeof(buffer));
lsa_header = (struct ospf6_lsa_header *)buffer;
- router_lsa = (struct ospf6_router_lsa *)ospf6_lsa_header_end(lsa_header);
+ router_lsa = lsa_after_header(lsa_header);
ospf6_router_lsa_options_set(oa, router_lsa);
@@ -304,8 +304,7 @@ void ospf6_router_lsa_originate(struct event *thread)
/* Reset Buffer to fill next Router LSA */
memset(buffer, 0, sizeof(buffer));
lsa_header = (struct ospf6_lsa_header *)buffer;
- router_lsa = (struct ospf6_router_lsa *)
- ospf6_lsa_header_end(lsa_header);
+ router_lsa = lsa_after_header(lsa_header);
ospf6_router_lsa_options_set(oa, router_lsa);
@@ -564,15 +563,13 @@ void ospf6_network_lsa_originate(struct event *thread)
/* prepare buffer */
memset(buffer, 0, sizeof(buffer));
lsa_header = (struct ospf6_lsa_header *)buffer;
- network_lsa =
- (struct ospf6_network_lsa *)ospf6_lsa_header_end(lsa_header);
+ network_lsa = lsa_after_header(lsa_header);
/* Collect the interface's Link-LSAs to describe
network's optional capabilities */
type = htons(OSPF6_LSTYPE_LINK);
for (ALL_LSDB_TYPED(oi->lsdb, type, lsa)) {
- link_lsa = (struct ospf6_link_lsa *)ospf6_lsa_header_end(
- lsa->header);
+ link_lsa = lsa_after_header(lsa->header);
network_lsa->options[0] |= link_lsa->options[0];
network_lsa->options[1] |= link_lsa->options[1];
network_lsa->options[2] |= link_lsa->options[2];
@@ -796,7 +793,7 @@ void ospf6_link_lsa_originate(struct event *thread)
/* prepare buffer */
memset(buffer, 0, sizeof(buffer));
lsa_header = (struct ospf6_lsa_header *)buffer;
- link_lsa = (struct ospf6_link_lsa *)ospf6_lsa_header_end(lsa_header);
+ link_lsa = lsa_after_header(lsa_header);
/* Fill Link-LSA */
link_lsa->priority = oi->priority;
@@ -1038,8 +1035,7 @@ void ospf6_intra_prefix_lsa_originate_stub(struct event *thread)
/* prepare buffer */
memset(buffer, 0, sizeof(buffer));
lsa_header = (struct ospf6_lsa_header *)buffer;
- intra_prefix_lsa = (struct ospf6_intra_prefix_lsa *)ospf6_lsa_header_end(
- lsa_header);
+ intra_prefix_lsa = lsa_after_header(lsa_header);
/* Fill Intra-Area-Prefix-LSA */
intra_prefix_lsa->ref_type = htons(OSPF6_LSTYPE_ROUTER);
@@ -1154,8 +1150,7 @@ void ospf6_intra_prefix_lsa_originate_stub(struct event *thread)
/* Prepare next buffer */
memset(buffer, 0, sizeof(buffer));
lsa_header = (struct ospf6_lsa_header *)buffer;
- intra_prefix_lsa = (struct ospf6_intra_prefix_lsa *)
- ospf6_lsa_header_end(lsa_header);
+ intra_prefix_lsa = lsa_after_header(lsa_header);
/* Fill Intra-Area-Prefix-LSA */
intra_prefix_lsa->ref_type = htons(OSPF6_LSTYPE_ROUTER);
@@ -1262,8 +1257,7 @@ void ospf6_intra_prefix_lsa_originate_transit(struct event *thread)
/* prepare buffer */
memset(buffer, 0, sizeof(buffer));
lsa_header = (struct ospf6_lsa_header *)buffer;
- intra_prefix_lsa = (struct ospf6_intra_prefix_lsa *)ospf6_lsa_header_end(
- lsa_header);
+ intra_prefix_lsa = lsa_after_header(lsa_header);
/* Fill Intra-Area-Prefix-LSA */
intra_prefix_lsa->ref_type = htons(OSPF6_LSTYPE_NETWORK);
@@ -1659,10 +1653,7 @@ void ospf6_intra_prefix_route_ecmp_path(struct ospf6_area *oa,
}
continue;
}
- intra_prefix_lsa =
- (struct ospf6_intra_prefix_lsa *)
- ospf6_lsa_header_end(
- lsa->header);
+ intra_prefix_lsa = lsa_after_header(lsa->header);
if (intra_prefix_lsa->ref_adv_router
== oa->ospf6->router_id) {
@@ -1743,8 +1734,7 @@ void ospf6_intra_prefix_lsa_add(struct ospf6_lsa *lsa)
oa = OSPF6_AREA(lsa->lsdb->data);
- intra_prefix_lsa = (struct ospf6_intra_prefix_lsa *)ospf6_lsa_header_end(
- lsa->header);
+ intra_prefix_lsa = lsa_after_header(lsa->header);
if (intra_prefix_lsa->ref_type == htons(OSPF6_LSTYPE_ROUTER) ||
intra_prefix_lsa->ref_type == htons(OSPF6_LSTYPE_NETWORK))
ospf6_linkstate_prefix(intra_prefix_lsa->ref_adv_router,
@@ -1972,8 +1962,7 @@ void ospf6_intra_prefix_lsa_remove(struct ospf6_lsa *lsa)
oa = OSPF6_AREA(lsa->lsdb->data);
- intra_prefix_lsa = (struct ospf6_intra_prefix_lsa *)ospf6_lsa_header_end(
- lsa->header);
+ intra_prefix_lsa = lsa_after_header(lsa->header);
prefix_num = ntohs(intra_prefix_lsa->prefix_num);
start = (caddr_t)intra_prefix_lsa
diff --git a/ospf6d/ospf6_lsa.c b/ospf6d/ospf6_lsa.c
index 017751825..d8d13d4b4 100644
--- a/ospf6d/ospf6_lsa.c
+++ b/ospf6d/ospf6_lsa.c
@@ -65,7 +65,7 @@ static int ospf6_unknown_lsa_show(struct vty *vty, struct ospf6_lsa *lsa,
{
char *start, *end, *current;
- start = ospf6_lsa_header_end(lsa->header);
+ start = lsa_after_header(lsa->header);
end = ospf6_lsa_end(lsa->header);
if (use_json) {
@@ -234,8 +234,8 @@ int ospf6_lsa_is_changed(struct ospf6_lsa *lsa1, struct ospf6_lsa *lsa2)
if (length <= 0)
return 0;
- return memcmp(ospf6_lsa_header_end(lsa1->header),
- ospf6_lsa_header_end(lsa2->header), length);
+ return memcmp(lsa_after_header(lsa1->header),
+ lsa_after_header(lsa2->header), length);
}
/* ospf6 age functions */
diff --git a/ospf6d/ospf6_lsa.h b/ospf6d/ospf6_lsa.h
index d2501c42c..25955147a 100644
--- a/ospf6d/ospf6_lsa.h
+++ b/ospf6d/ospf6_lsa.h
@@ -92,6 +92,11 @@ static inline char *ospf6_lsa_header_end(struct ospf6_lsa_header *header)
return (char *)header + sizeof(struct ospf6_lsa_header);
}
+static inline void *lsa_after_header(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);
diff --git a/ospf6d/ospf6_lsdb.c b/ospf6d/ospf6_lsdb.c
index 9aca5550a..e5de30484 100644
--- a/ospf6d/ospf6_lsdb.c
+++ b/ospf6d/ospf6_lsdb.c
@@ -229,8 +229,7 @@ struct ospf6_lsa *ospf6_find_inter_prefix_lsa(struct ospf6 *ospf6,
struct ospf6_inter_prefix_lsa *prefix_lsa;
struct prefix prefix;
- prefix_lsa = (struct ospf6_inter_prefix_lsa *)
- ospf6_lsa_header_end(lsa->header);
+ prefix_lsa = lsa_after_header(lsa->header);
prefix.family = AF_INET6;
prefix.prefixlen = prefix_lsa->prefix.prefix_length;
ospf6_prefix_in6_addr(&prefix.u.prefix6, prefix_lsa,
diff --git a/ospf6d/ospf6_message.c b/ospf6d/ospf6_message.c
index e8380af5c..33d15e724 100644
--- a/ospf6d/ospf6_message.c
+++ b/ospf6d/ospf6_message.c
@@ -1304,9 +1304,7 @@ static unsigned ospf6_lsa_examin(struct ospf6_lsa_header *lsah,
4 bytes of referenced link state ID. */
if (headeronly)
break;
- as_external_lsa =
- (struct ospf6_as_external_lsa
- *)((caddr_t)lsah + OSPF6_LSA_HEADER_SIZE);
+ as_external_lsa = lsa_after_header(lsah);
exp_length =
OSPF6_LSA_HEADER_SIZE + OSPF6_AS_EXTERNAL_LSA_MIN_SIZE;
/* To find out if the last optional field (Referenced Link State
@@ -1351,8 +1349,7 @@ static unsigned ospf6_lsa_examin(struct ospf6_lsa_header *lsah,
by N>=0 IPv6 prefix blocks (with N declared beforehand). */
if (headeronly)
break;
- link_lsa = (struct ospf6_link_lsa *)((caddr_t)lsah
- + OSPF6_LSA_HEADER_SIZE);
+ link_lsa = lsa_after_header(lsah);
return ospf6_prefixes_examin(
(struct ospf6_prefix *)((caddr_t)link_lsa
+ OSPF6_LINK_LSA_MIN_SIZE),
@@ -1367,9 +1364,7 @@ static unsigned ospf6_lsa_examin(struct ospf6_lsa_header *lsah,
*/
if (headeronly)
break;
- intra_prefix_lsa =
- (struct ospf6_intra_prefix_lsa
- *)((caddr_t)lsah + OSPF6_LSA_HEADER_SIZE);
+ intra_prefix_lsa = lsa_after_header(lsah);
return ospf6_prefixes_examin(
(struct ospf6_prefix
*)((caddr_t)intra_prefix_lsa
diff --git a/ospf6d/ospf6_nssa.c b/ospf6d/ospf6_nssa.c
index ea2be20cf..8a5de468c 100644
--- a/ospf6d/ospf6_nssa.c
+++ b/ospf6d/ospf6_nssa.c
@@ -52,8 +52,7 @@ static int ospf6_abr_nssa_am_elected(struct ospf6_area *oa)
/* Verify all the router LSA to compare the router ID */
for (ALL_LSDB_TYPED(oa->lsdb, type, lsa)) {
- router_lsa = (struct ospf6_router_lsa *)ospf6_lsa_header_end(
- lsa->header);
+ router_lsa = lsa_after_header(lsa->header);
/* ignore non-ABR routers */
if (!CHECK_FLAG(router_lsa->bits, OSPF6_ROUTER_BIT_B))
@@ -414,8 +413,7 @@ static struct ospf6_lsa *ospf6_lsa_translated_nssa_new(struct ospf6_area *area,
}
/* find the translated Type-5 for this Type-7 */
- nssa = (struct ospf6_as_external_lsa *)ospf6_lsa_header_end(
- type7->header);
+ nssa = lsa_after_header(type7->header);
prefix.family = AF_INET6;
prefix.prefixlen = nssa->prefix.prefix_length;
ospf6_prefix_in6_addr(&prefix.u.prefix6, nssa, &nssa->prefix);
@@ -435,10 +433,8 @@ static struct ospf6_lsa *ospf6_lsa_translated_nssa_new(struct ospf6_area *area,
/* prepare buffer */
memset(buffer, 0, sizeof(buffer));
lsa_header = (struct ospf6_lsa_header *)buffer;
- extnew = (struct ospf6_as_external_lsa *)ospf6_lsa_header_end(
- lsa_header);
- ext = (struct ospf6_as_external_lsa *)ospf6_lsa_header_end(
- type7->header);
+ extnew = lsa_after_header(lsa_header);
+ ext = lsa_after_header(type7->header);
old_ptr =
(caddr_t)((caddr_t)ext + sizeof(struct ospf6_as_external_lsa));
new_ptr = (caddr_t)((caddr_t)extnew
@@ -546,8 +542,7 @@ struct ospf6_lsa *ospf6_translated_nssa_refresh(struct ospf6_area *area,
"%s: try to find translated Type-5 LSA for %s",
__func__, type7->name);
- ext_lsa = (struct ospf6_as_external_lsa *)ospf6_lsa_header_end(
- type7->header);
+ ext_lsa = lsa_after_header(type7->header);
prefix.family = AF_INET6;
prefix.prefixlen = ext_lsa->prefix.prefix_length;
ospf6_prefix_in6_addr(&prefix.u.prefix6, ext_lsa,
@@ -614,8 +609,7 @@ static void ospf6_abr_translate_nssa(struct ospf6_area *area,
struct ospf6 *ospf6;
ospf6 = area->ospf6;
- nssa_lsa = (struct ospf6_as_external_lsa *)ospf6_lsa_header_end(
- lsa->header);
+ nssa_lsa = lsa_after_header(lsa->header);
if (!CHECK_FLAG(nssa_lsa->prefix.prefix_options,
OSPF6_PREFIX_OPTION_P)) {
@@ -1240,8 +1234,7 @@ void ospf6_nssa_lsa_originate(struct ospf6_route *route,
/* prepare buffer */
memset(buffer, 0, sizeof(buffer));
lsa_header = (struct ospf6_lsa_header *)buffer;
- as_external_lsa = (struct ospf6_as_external_lsa *)ospf6_lsa_header_end(
- lsa_header);
+ as_external_lsa = lsa_after_header(lsa_header);
p = (caddr_t)((caddr_t)as_external_lsa
+ sizeof(struct ospf6_as_external_lsa));
diff --git a/ospf6d/ospf6_spf.c b/ospf6d/ospf6_spf.c
index 5c6c1f0f2..5f2c5a6c4 100644
--- a/ospf6d/ospf6_spf.c
+++ b/ospf6d/ospf6_spf.c
@@ -290,8 +290,7 @@ static void ospf6_nexthop_calc(struct ospf6_vertex *w, struct ospf6_vertex *v,
!= lsa->header->id)
continue;
- link_lsa = (struct ospf6_link_lsa *)ospf6_lsa_header_end(
- lsa->header);
+ link_lsa = lsa_after_header(lsa->header);
if (IS_OSPF6_DEBUG_SPF(PROCESS)) {
inet_ntop(AF_INET6, &link_lsa->linklocal_addr, buf,
sizeof(buf));
@@ -1136,8 +1135,7 @@ int ospf6_ase_calculate_route(struct ospf6 *ospf6, struct ospf6_lsa *lsa,
return 0;
}
- external = (struct ospf6_as_external_lsa *)ospf6_lsa_header_end(
- lsa->header);
+ external = lsa_after_header(lsa->header);
prefix.family = AF_INET6;
prefix.prefixlen = external->prefix.prefix_length;
ospf6_prefix_in6_addr(&prefix.u.prefix6, external, &external->prefix);