mirror of
https://github.com/FRRouting/frr.git
synced 2025-04-30 13:37:17 +02:00
ospf6d: replace ospf6_lsa_header_end()
The void * return type of the replacement enables the removal of a cast at every point of use, and the name no longer suggests that it points to the last byte of the header. Signed-off-by: Andrew Cooks <acooks.at.bda@gmail.com>
This commit is contained in:
parent
1290a06f5f
commit
1b64893e23
|
@ -553,8 +553,7 @@ int ospf6_abr_originate_summary_to_area(struct ospf6_route *route,
|
||||||
lsa_header = (struct ospf6_lsa_header *)buffer;
|
lsa_header = (struct ospf6_lsa_header *)buffer;
|
||||||
|
|
||||||
if (route->type == OSPF6_DEST_TYPE_ROUTER) {
|
if (route->type == OSPF6_DEST_TYPE_ROUTER) {
|
||||||
router_lsa = (struct ospf6_inter_router_lsa *)
|
router_lsa = lsa_after_header(lsa_header);
|
||||||
ospf6_lsa_header_end(lsa_header);
|
|
||||||
p = (caddr_t)router_lsa + sizeof(struct ospf6_inter_router_lsa);
|
p = (caddr_t)router_lsa + sizeof(struct ospf6_inter_router_lsa);
|
||||||
|
|
||||||
/* Fill Inter-Area-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);
|
router_lsa->router_id = ADV_ROUTER_IN_PREFIX(&route->prefix);
|
||||||
type = htons(OSPF6_LSTYPE_INTER_ROUTER);
|
type = htons(OSPF6_LSTYPE_INTER_ROUTER);
|
||||||
} else {
|
} else {
|
||||||
prefix_lsa = (struct ospf6_inter_prefix_lsa *)
|
prefix_lsa = lsa_after_header(lsa_header);
|
||||||
ospf6_lsa_header_end(lsa_header);
|
|
||||||
p = (caddr_t)prefix_lsa + sizeof(struct ospf6_inter_prefix_lsa);
|
p = (caddr_t)prefix_lsa + sizeof(struct ospf6_inter_prefix_lsa);
|
||||||
|
|
||||||
/* Fill Inter-Area-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);
|
oa->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
prefix_lsa = (struct ospf6_inter_prefix_lsa *)
|
prefix_lsa = lsa_after_header(lsa->header);
|
||||||
ospf6_lsa_header_end(lsa->header);
|
|
||||||
prefix.family = AF_INET6;
|
prefix.family = AF_INET6;
|
||||||
prefix.prefixlen = prefix_lsa->prefix.prefix_length;
|
prefix.prefixlen = prefix_lsa->prefix.prefix_length;
|
||||||
ospf6_prefix_in6_addr(&prefix.u.prefix6, prefix_lsa,
|
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);
|
oa->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
router_lsa = (struct ospf6_inter_router_lsa *)
|
router_lsa = lsa_after_header(lsa->header);
|
||||||
ospf6_lsa_header_end(lsa->header);
|
|
||||||
ospf6_linkstate_prefix(router_lsa->router_id, htonl(0), &prefix);
|
ospf6_linkstate_prefix(router_lsa->router_id, htonl(0), &prefix);
|
||||||
if (is_debug)
|
if (is_debug)
|
||||||
inet_ntop(AF_INET, &router_lsa->router_id, buf,
|
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];
|
char tbuf[16];
|
||||||
|
|
||||||
if (lsa != NULL) {
|
if (lsa != NULL) {
|
||||||
prefix_lsa = (struct ospf6_inter_prefix_lsa *)
|
prefix_lsa = lsa_after_header(lsa->header);
|
||||||
ospf6_lsa_header_end(lsa->header);
|
|
||||||
|
|
||||||
ospf6_prefix_in6_addr(&in6, prefix_lsa, &prefix_lsa->prefix);
|
ospf6_prefix_in6_addr(&in6, prefix_lsa, &prefix_lsa->prefix);
|
||||||
if (buf) {
|
if (buf) {
|
||||||
|
@ -1452,8 +1447,7 @@ static int ospf6_inter_area_prefix_lsa_show(struct vty *vty,
|
||||||
struct ospf6_inter_prefix_lsa *prefix_lsa;
|
struct ospf6_inter_prefix_lsa *prefix_lsa;
|
||||||
char buf[INET6_ADDRSTRLEN];
|
char buf[INET6_ADDRSTRLEN];
|
||||||
|
|
||||||
prefix_lsa = (struct ospf6_inter_prefix_lsa *)ospf6_lsa_header_end(
|
prefix_lsa = lsa_after_header(lsa->header);
|
||||||
lsa->header);
|
|
||||||
|
|
||||||
if (use_json) {
|
if (use_json) {
|
||||||
json_object_int_add(
|
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;
|
struct ospf6_inter_router_lsa *router_lsa;
|
||||||
|
|
||||||
if (lsa != NULL) {
|
if (lsa != NULL) {
|
||||||
router_lsa = (struct ospf6_inter_router_lsa *)
|
router_lsa = lsa_after_header(lsa->header);
|
||||||
ospf6_lsa_header_end(lsa->header);
|
|
||||||
|
|
||||||
|
|
||||||
if (buf)
|
if (buf)
|
||||||
inet_ntop(AF_INET, &router_lsa->router_id, buf, buflen);
|
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;
|
struct ospf6_inter_router_lsa *router_lsa;
|
||||||
char buf[64];
|
char buf[64];
|
||||||
|
|
||||||
router_lsa = (struct ospf6_inter_router_lsa *)ospf6_lsa_header_end(
|
router_lsa = lsa_after_header(lsa->header);
|
||||||
lsa->header);
|
|
||||||
|
|
||||||
ospf6_options_printbuf(router_lsa->options, buf, sizeof(buf));
|
ospf6_options_printbuf(router_lsa->options, buf, sizeof(buf));
|
||||||
if (use_json) {
|
if (use_json) {
|
||||||
|
|
|
@ -103,8 +103,7 @@ struct ospf6_lsa *ospf6_as_external_lsa_originate(struct ospf6_route *route,
|
||||||
/* prepare buffer */
|
/* prepare buffer */
|
||||||
memset(buffer, 0, sizeof(buffer));
|
memset(buffer, 0, sizeof(buffer));
|
||||||
lsa_header = (struct ospf6_lsa_header *)buffer;
|
lsa_header = (struct ospf6_lsa_header *)buffer;
|
||||||
as_external_lsa = (struct ospf6_as_external_lsa *)ospf6_lsa_header_end(
|
as_external_lsa = lsa_after_header(lsa_header);
|
||||||
lsa_header);
|
|
||||||
p = (caddr_t)((caddr_t)as_external_lsa
|
p = (caddr_t)((caddr_t)as_external_lsa
|
||||||
+ sizeof(struct ospf6_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)
|
if (!lsa)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
external = (struct ospf6_as_external_lsa *)ospf6_lsa_header_end(
|
external = lsa_after_header(lsa->header);
|
||||||
lsa->header);
|
|
||||||
|
|
||||||
if (!CHECK_FLAG(external->bits_metric, OSPF6_ASBR_BIT_T))
|
if (!CHECK_FLAG(external->bits_metric, OSPF6_ASBR_BIT_T))
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -521,8 +519,7 @@ void ospf6_asbr_lsa_add(struct ospf6_lsa *lsa)
|
||||||
type = ntohs(lsa->header->type);
|
type = ntohs(lsa->header->type);
|
||||||
oa = lsa->lsdb->data;
|
oa = lsa->lsdb->data;
|
||||||
|
|
||||||
external = (struct ospf6_as_external_lsa *)ospf6_lsa_header_end(
|
external = lsa_after_header(lsa->header);
|
||||||
lsa->header);
|
|
||||||
|
|
||||||
if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL))
|
if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL))
|
||||||
zlog_debug("Calculate AS-External route for %s", lsa->name);
|
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;
|
int type;
|
||||||
bool debug = false;
|
bool debug = false;
|
||||||
|
|
||||||
external = (struct ospf6_as_external_lsa *)ospf6_lsa_header_end(
|
external = lsa_after_header(lsa->header);
|
||||||
lsa->header);
|
|
||||||
|
|
||||||
if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL) || (IS_OSPF6_DEBUG_NSSA))
|
if (IS_OSPF6_DEBUG_EXAMIN(AS_EXTERNAL) || (IS_OSPF6_DEBUG_NSSA))
|
||||||
debug = true;
|
debug = true;
|
||||||
|
@ -2425,8 +2421,7 @@ static char *ospf6_as_external_lsa_get_prefix_str(struct ospf6_lsa *lsa,
|
||||||
char tbuf[16];
|
char tbuf[16];
|
||||||
|
|
||||||
if (lsa) {
|
if (lsa) {
|
||||||
external = (struct ospf6_as_external_lsa *)ospf6_lsa_header_end(
|
external = lsa_after_header(lsa->header);
|
||||||
lsa->header);
|
|
||||||
|
|
||||||
if (pos == 0) {
|
if (pos == 0) {
|
||||||
ospf6_prefix_in6_addr(&in6, external,
|
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];
|
char buf[64];
|
||||||
|
|
||||||
assert(lsa->header);
|
assert(lsa->header);
|
||||||
external = (struct ospf6_as_external_lsa *)ospf6_lsa_header_end(
|
external = lsa_after_header(lsa->header);
|
||||||
lsa->header);
|
|
||||||
|
|
||||||
/* bits */
|
/* bits */
|
||||||
snprintf(buf, sizeof(buf), "%c%c%c",
|
snprintf(buf, sizeof(buf), "%c%c%c",
|
||||||
|
@ -3028,8 +3022,7 @@ ospf6_originate_summary_lsa(struct ospf6 *ospf6,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
external = (struct ospf6_as_external_lsa *)ospf6_lsa_header_end(
|
external = lsa_after_header(aggr_lsa->header);
|
||||||
aggr_lsa->header);
|
|
||||||
metric = (unsigned long)OSPF6_ASBR_METRIC(external);
|
metric = (unsigned long)OSPF6_ASBR_METRIC(external);
|
||||||
tag = ospf6_as_external_lsa_get_tag(aggr_lsa);
|
tag = ospf6_as_external_lsa_get_tag(aggr_lsa);
|
||||||
mtype = CHECK_FLAG(external->bits_metric,
|
mtype = CHECK_FLAG(external->bits_metric,
|
||||||
|
@ -3177,7 +3170,7 @@ ospf6_handle_external_aggr_modify(struct ospf6 *ospf6,
|
||||||
return OSPF6_FAILURE;
|
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);
|
metric = (unsigned long)OSPF6_ASBR_METRIC(asel);
|
||||||
tag = ospf6_as_external_lsa_get_tag(lsa);
|
tag = ospf6_as_external_lsa_get_tag(lsa);
|
||||||
mtype = CHECK_FLAG(asel->bits_metric,
|
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),
|
lsa = ospf6_lsdb_lookup(htons(OSPF6_LSTYPE_AS_EXTERNAL),
|
||||||
htonl(info->id), ospf6->router_id, ospf6->lsdb);
|
htonl(info->id), ospf6->router_id, ospf6->lsdb);
|
||||||
if (lsa) {
|
if (lsa) {
|
||||||
ext_lsa = (struct ospf6_as_external_lsa *)ospf6_lsa_header_end(
|
ext_lsa = lsa_after_header(lsa->header);
|
||||||
lsa->header);
|
|
||||||
|
|
||||||
if (rt->prefix.prefixlen != ext_lsa->prefix.prefix_length)
|
if (rt->prefix.prefixlen != ext_lsa->prefix.prefix_length)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -56,7 +56,7 @@ static int ospf6_gr_lsa_originate(struct ospf6_interface *oi,
|
||||||
/* prepare buffer */
|
/* prepare buffer */
|
||||||
memset(buffer, 0, sizeof(buffer));
|
memset(buffer, 0, sizeof(buffer));
|
||||||
lsa_header = (struct ospf6_lsa_header *)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. */
|
/* Put grace period. */
|
||||||
grace_lsa->tlv_period.header.type = htons(TLV_GRACE_PERIOD_TYPE);
|
grace_lsa->tlv_period.header.type = htons(TLV_GRACE_PERIOD_TYPE);
|
||||||
|
|
|
@ -243,7 +243,7 @@ void ospf6_router_lsa_originate(struct event *thread)
|
||||||
|
|
||||||
memset(buffer, 0, sizeof(buffer));
|
memset(buffer, 0, sizeof(buffer));
|
||||||
lsa_header = (struct ospf6_lsa_header *)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);
|
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 */
|
/* Reset Buffer to fill next Router LSA */
|
||||||
memset(buffer, 0, sizeof(buffer));
|
memset(buffer, 0, sizeof(buffer));
|
||||||
lsa_header = (struct ospf6_lsa_header *)buffer;
|
lsa_header = (struct ospf6_lsa_header *)buffer;
|
||||||
router_lsa = (struct ospf6_router_lsa *)
|
router_lsa = lsa_after_header(lsa_header);
|
||||||
ospf6_lsa_header_end(lsa_header);
|
|
||||||
|
|
||||||
ospf6_router_lsa_options_set(oa, router_lsa);
|
ospf6_router_lsa_options_set(oa, router_lsa);
|
||||||
|
|
||||||
|
@ -564,15 +563,13 @@ void ospf6_network_lsa_originate(struct event *thread)
|
||||||
/* prepare buffer */
|
/* prepare buffer */
|
||||||
memset(buffer, 0, sizeof(buffer));
|
memset(buffer, 0, sizeof(buffer));
|
||||||
lsa_header = (struct ospf6_lsa_header *)buffer;
|
lsa_header = (struct ospf6_lsa_header *)buffer;
|
||||||
network_lsa =
|
network_lsa = lsa_after_header(lsa_header);
|
||||||
(struct ospf6_network_lsa *)ospf6_lsa_header_end(lsa_header);
|
|
||||||
|
|
||||||
/* Collect the interface's Link-LSAs to describe
|
/* Collect the interface's Link-LSAs to describe
|
||||||
network's optional capabilities */
|
network's optional capabilities */
|
||||||
type = htons(OSPF6_LSTYPE_LINK);
|
type = htons(OSPF6_LSTYPE_LINK);
|
||||||
for (ALL_LSDB_TYPED(oi->lsdb, type, lsa)) {
|
for (ALL_LSDB_TYPED(oi->lsdb, type, lsa)) {
|
||||||
link_lsa = (struct ospf6_link_lsa *)ospf6_lsa_header_end(
|
link_lsa = lsa_after_header(lsa->header);
|
||||||
lsa->header);
|
|
||||||
network_lsa->options[0] |= link_lsa->options[0];
|
network_lsa->options[0] |= link_lsa->options[0];
|
||||||
network_lsa->options[1] |= link_lsa->options[1];
|
network_lsa->options[1] |= link_lsa->options[1];
|
||||||
network_lsa->options[2] |= link_lsa->options[2];
|
network_lsa->options[2] |= link_lsa->options[2];
|
||||||
|
@ -796,7 +793,7 @@ void ospf6_link_lsa_originate(struct event *thread)
|
||||||
/* prepare buffer */
|
/* prepare buffer */
|
||||||
memset(buffer, 0, sizeof(buffer));
|
memset(buffer, 0, sizeof(buffer));
|
||||||
lsa_header = (struct ospf6_lsa_header *)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 */
|
/* Fill Link-LSA */
|
||||||
link_lsa->priority = oi->priority;
|
link_lsa->priority = oi->priority;
|
||||||
|
@ -1038,8 +1035,7 @@ void ospf6_intra_prefix_lsa_originate_stub(struct event *thread)
|
||||||
/* prepare buffer */
|
/* prepare buffer */
|
||||||
memset(buffer, 0, sizeof(buffer));
|
memset(buffer, 0, sizeof(buffer));
|
||||||
lsa_header = (struct ospf6_lsa_header *)buffer;
|
lsa_header = (struct ospf6_lsa_header *)buffer;
|
||||||
intra_prefix_lsa = (struct ospf6_intra_prefix_lsa *)ospf6_lsa_header_end(
|
intra_prefix_lsa = lsa_after_header(lsa_header);
|
||||||
lsa_header);
|
|
||||||
|
|
||||||
/* Fill Intra-Area-Prefix-LSA */
|
/* Fill Intra-Area-Prefix-LSA */
|
||||||
intra_prefix_lsa->ref_type = htons(OSPF6_LSTYPE_ROUTER);
|
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 */
|
/* Prepare next buffer */
|
||||||
memset(buffer, 0, sizeof(buffer));
|
memset(buffer, 0, sizeof(buffer));
|
||||||
lsa_header = (struct ospf6_lsa_header *)buffer;
|
lsa_header = (struct ospf6_lsa_header *)buffer;
|
||||||
intra_prefix_lsa = (struct ospf6_intra_prefix_lsa *)
|
intra_prefix_lsa = lsa_after_header(lsa_header);
|
||||||
ospf6_lsa_header_end(lsa_header);
|
|
||||||
|
|
||||||
/* Fill Intra-Area-Prefix-LSA */
|
/* Fill Intra-Area-Prefix-LSA */
|
||||||
intra_prefix_lsa->ref_type = htons(OSPF6_LSTYPE_ROUTER);
|
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 */
|
/* prepare buffer */
|
||||||
memset(buffer, 0, sizeof(buffer));
|
memset(buffer, 0, sizeof(buffer));
|
||||||
lsa_header = (struct ospf6_lsa_header *)buffer;
|
lsa_header = (struct ospf6_lsa_header *)buffer;
|
||||||
intra_prefix_lsa = (struct ospf6_intra_prefix_lsa *)ospf6_lsa_header_end(
|
intra_prefix_lsa = lsa_after_header(lsa_header);
|
||||||
lsa_header);
|
|
||||||
|
|
||||||
/* Fill Intra-Area-Prefix-LSA */
|
/* Fill Intra-Area-Prefix-LSA */
|
||||||
intra_prefix_lsa->ref_type = htons(OSPF6_LSTYPE_NETWORK);
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
intra_prefix_lsa =
|
intra_prefix_lsa = lsa_after_header(lsa->header);
|
||||||
(struct ospf6_intra_prefix_lsa *)
|
|
||||||
ospf6_lsa_header_end(
|
|
||||||
lsa->header);
|
|
||||||
|
|
||||||
if (intra_prefix_lsa->ref_adv_router
|
if (intra_prefix_lsa->ref_adv_router
|
||||||
== oa->ospf6->router_id) {
|
== oa->ospf6->router_id) {
|
||||||
|
@ -1743,8 +1734,7 @@ void ospf6_intra_prefix_lsa_add(struct ospf6_lsa *lsa)
|
||||||
|
|
||||||
oa = OSPF6_AREA(lsa->lsdb->data);
|
oa = OSPF6_AREA(lsa->lsdb->data);
|
||||||
|
|
||||||
intra_prefix_lsa = (struct ospf6_intra_prefix_lsa *)ospf6_lsa_header_end(
|
intra_prefix_lsa = lsa_after_header(lsa->header);
|
||||||
lsa->header);
|
|
||||||
if (intra_prefix_lsa->ref_type == htons(OSPF6_LSTYPE_ROUTER) ||
|
if (intra_prefix_lsa->ref_type == htons(OSPF6_LSTYPE_ROUTER) ||
|
||||||
intra_prefix_lsa->ref_type == htons(OSPF6_LSTYPE_NETWORK))
|
intra_prefix_lsa->ref_type == htons(OSPF6_LSTYPE_NETWORK))
|
||||||
ospf6_linkstate_prefix(intra_prefix_lsa->ref_adv_router,
|
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);
|
oa = OSPF6_AREA(lsa->lsdb->data);
|
||||||
|
|
||||||
intra_prefix_lsa = (struct ospf6_intra_prefix_lsa *)ospf6_lsa_header_end(
|
intra_prefix_lsa = lsa_after_header(lsa->header);
|
||||||
lsa->header);
|
|
||||||
|
|
||||||
prefix_num = ntohs(intra_prefix_lsa->prefix_num);
|
prefix_num = ntohs(intra_prefix_lsa->prefix_num);
|
||||||
start = (caddr_t)intra_prefix_lsa
|
start = (caddr_t)intra_prefix_lsa
|
||||||
|
|
|
@ -65,7 +65,7 @@ static int ospf6_unknown_lsa_show(struct vty *vty, struct ospf6_lsa *lsa,
|
||||||
{
|
{
|
||||||
char *start, *end, *current;
|
char *start, *end, *current;
|
||||||
|
|
||||||
start = ospf6_lsa_header_end(lsa->header);
|
start = lsa_after_header(lsa->header);
|
||||||
end = ospf6_lsa_end(lsa->header);
|
end = ospf6_lsa_end(lsa->header);
|
||||||
|
|
||||||
if (use_json) {
|
if (use_json) {
|
||||||
|
@ -234,8 +234,8 @@ int ospf6_lsa_is_changed(struct ospf6_lsa *lsa1, struct ospf6_lsa *lsa2)
|
||||||
if (length <= 0)
|
if (length <= 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return memcmp(ospf6_lsa_header_end(lsa1->header),
|
return memcmp(lsa_after_header(lsa1->header),
|
||||||
ospf6_lsa_header_end(lsa2->header), length);
|
lsa_after_header(lsa2->header), length);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ospf6 age functions */
|
/* ospf6 age functions */
|
||||||
|
|
|
@ -92,6 +92,11 @@ static inline char *ospf6_lsa_header_end(struct ospf6_lsa_header *header)
|
||||||
return (char *)header + sizeof(struct ospf6_lsa_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)
|
static inline char *ospf6_lsa_end(struct ospf6_lsa_header *header)
|
||||||
{
|
{
|
||||||
return (char *)header + ntohs(header->length);
|
return (char *)header + ntohs(header->length);
|
||||||
|
|
|
@ -229,8 +229,7 @@ struct ospf6_lsa *ospf6_find_inter_prefix_lsa(struct ospf6 *ospf6,
|
||||||
struct ospf6_inter_prefix_lsa *prefix_lsa;
|
struct ospf6_inter_prefix_lsa *prefix_lsa;
|
||||||
struct prefix prefix;
|
struct prefix prefix;
|
||||||
|
|
||||||
prefix_lsa = (struct ospf6_inter_prefix_lsa *)
|
prefix_lsa = lsa_after_header(lsa->header);
|
||||||
ospf6_lsa_header_end(lsa->header);
|
|
||||||
prefix.family = AF_INET6;
|
prefix.family = AF_INET6;
|
||||||
prefix.prefixlen = prefix_lsa->prefix.prefix_length;
|
prefix.prefixlen = prefix_lsa->prefix.prefix_length;
|
||||||
ospf6_prefix_in6_addr(&prefix.u.prefix6, prefix_lsa,
|
ospf6_prefix_in6_addr(&prefix.u.prefix6, prefix_lsa,
|
||||||
|
|
|
@ -1304,9 +1304,7 @@ static unsigned ospf6_lsa_examin(struct ospf6_lsa_header *lsah,
|
||||||
4 bytes of referenced link state ID. */
|
4 bytes of referenced link state ID. */
|
||||||
if (headeronly)
|
if (headeronly)
|
||||||
break;
|
break;
|
||||||
as_external_lsa =
|
as_external_lsa = lsa_after_header(lsah);
|
||||||
(struct ospf6_as_external_lsa
|
|
||||||
*)((caddr_t)lsah + OSPF6_LSA_HEADER_SIZE);
|
|
||||||
exp_length =
|
exp_length =
|
||||||
OSPF6_LSA_HEADER_SIZE + OSPF6_AS_EXTERNAL_LSA_MIN_SIZE;
|
OSPF6_LSA_HEADER_SIZE + OSPF6_AS_EXTERNAL_LSA_MIN_SIZE;
|
||||||
/* To find out if the last optional field (Referenced Link State
|
/* 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). */
|
by N>=0 IPv6 prefix blocks (with N declared beforehand). */
|
||||||
if (headeronly)
|
if (headeronly)
|
||||||
break;
|
break;
|
||||||
link_lsa = (struct ospf6_link_lsa *)((caddr_t)lsah
|
link_lsa = lsa_after_header(lsah);
|
||||||
+ OSPF6_LSA_HEADER_SIZE);
|
|
||||||
return ospf6_prefixes_examin(
|
return ospf6_prefixes_examin(
|
||||||
(struct ospf6_prefix *)((caddr_t)link_lsa
|
(struct ospf6_prefix *)((caddr_t)link_lsa
|
||||||
+ OSPF6_LINK_LSA_MIN_SIZE),
|
+ OSPF6_LINK_LSA_MIN_SIZE),
|
||||||
|
@ -1367,9 +1364,7 @@ static unsigned ospf6_lsa_examin(struct ospf6_lsa_header *lsah,
|
||||||
*/
|
*/
|
||||||
if (headeronly)
|
if (headeronly)
|
||||||
break;
|
break;
|
||||||
intra_prefix_lsa =
|
intra_prefix_lsa = lsa_after_header(lsah);
|
||||||
(struct ospf6_intra_prefix_lsa
|
|
||||||
*)((caddr_t)lsah + OSPF6_LSA_HEADER_SIZE);
|
|
||||||
return ospf6_prefixes_examin(
|
return ospf6_prefixes_examin(
|
||||||
(struct ospf6_prefix
|
(struct ospf6_prefix
|
||||||
*)((caddr_t)intra_prefix_lsa
|
*)((caddr_t)intra_prefix_lsa
|
||||||
|
|
|
@ -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 */
|
/* Verify all the router LSA to compare the router ID */
|
||||||
for (ALL_LSDB_TYPED(oa->lsdb, type, lsa)) {
|
for (ALL_LSDB_TYPED(oa->lsdb, type, lsa)) {
|
||||||
router_lsa = (struct ospf6_router_lsa *)ospf6_lsa_header_end(
|
router_lsa = lsa_after_header(lsa->header);
|
||||||
lsa->header);
|
|
||||||
|
|
||||||
/* ignore non-ABR routers */
|
/* ignore non-ABR routers */
|
||||||
if (!CHECK_FLAG(router_lsa->bits, OSPF6_ROUTER_BIT_B))
|
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 */
|
/* find the translated Type-5 for this Type-7 */
|
||||||
nssa = (struct ospf6_as_external_lsa *)ospf6_lsa_header_end(
|
nssa = lsa_after_header(type7->header);
|
||||||
type7->header);
|
|
||||||
prefix.family = AF_INET6;
|
prefix.family = AF_INET6;
|
||||||
prefix.prefixlen = nssa->prefix.prefix_length;
|
prefix.prefixlen = nssa->prefix.prefix_length;
|
||||||
ospf6_prefix_in6_addr(&prefix.u.prefix6, nssa, &nssa->prefix);
|
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 */
|
/* prepare buffer */
|
||||||
memset(buffer, 0, sizeof(buffer));
|
memset(buffer, 0, sizeof(buffer));
|
||||||
lsa_header = (struct ospf6_lsa_header *)buffer;
|
lsa_header = (struct ospf6_lsa_header *)buffer;
|
||||||
extnew = (struct ospf6_as_external_lsa *)ospf6_lsa_header_end(
|
extnew = lsa_after_header(lsa_header);
|
||||||
lsa_header);
|
ext = lsa_after_header(type7->header);
|
||||||
ext = (struct ospf6_as_external_lsa *)ospf6_lsa_header_end(
|
|
||||||
type7->header);
|
|
||||||
old_ptr =
|
old_ptr =
|
||||||
(caddr_t)((caddr_t)ext + sizeof(struct ospf6_as_external_lsa));
|
(caddr_t)((caddr_t)ext + sizeof(struct ospf6_as_external_lsa));
|
||||||
new_ptr = (caddr_t)((caddr_t)extnew
|
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",
|
"%s: try to find translated Type-5 LSA for %s",
|
||||||
__func__, type7->name);
|
__func__, type7->name);
|
||||||
|
|
||||||
ext_lsa = (struct ospf6_as_external_lsa *)ospf6_lsa_header_end(
|
ext_lsa = lsa_after_header(type7->header);
|
||||||
type7->header);
|
|
||||||
prefix.family = AF_INET6;
|
prefix.family = AF_INET6;
|
||||||
prefix.prefixlen = ext_lsa->prefix.prefix_length;
|
prefix.prefixlen = ext_lsa->prefix.prefix_length;
|
||||||
ospf6_prefix_in6_addr(&prefix.u.prefix6, ext_lsa,
|
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;
|
struct ospf6 *ospf6;
|
||||||
|
|
||||||
ospf6 = area->ospf6;
|
ospf6 = area->ospf6;
|
||||||
nssa_lsa = (struct ospf6_as_external_lsa *)ospf6_lsa_header_end(
|
nssa_lsa = lsa_after_header(lsa->header);
|
||||||
lsa->header);
|
|
||||||
|
|
||||||
if (!CHECK_FLAG(nssa_lsa->prefix.prefix_options,
|
if (!CHECK_FLAG(nssa_lsa->prefix.prefix_options,
|
||||||
OSPF6_PREFIX_OPTION_P)) {
|
OSPF6_PREFIX_OPTION_P)) {
|
||||||
|
@ -1240,8 +1234,7 @@ void ospf6_nssa_lsa_originate(struct ospf6_route *route,
|
||||||
/* prepare buffer */
|
/* prepare buffer */
|
||||||
memset(buffer, 0, sizeof(buffer));
|
memset(buffer, 0, sizeof(buffer));
|
||||||
lsa_header = (struct ospf6_lsa_header *)buffer;
|
lsa_header = (struct ospf6_lsa_header *)buffer;
|
||||||
as_external_lsa = (struct ospf6_as_external_lsa *)ospf6_lsa_header_end(
|
as_external_lsa = lsa_after_header(lsa_header);
|
||||||
lsa_header);
|
|
||||||
p = (caddr_t)((caddr_t)as_external_lsa
|
p = (caddr_t)((caddr_t)as_external_lsa
|
||||||
+ sizeof(struct ospf6_as_external_lsa));
|
+ sizeof(struct ospf6_as_external_lsa));
|
||||||
|
|
||||||
|
|
|
@ -290,8 +290,7 @@ static void ospf6_nexthop_calc(struct ospf6_vertex *w, struct ospf6_vertex *v,
|
||||||
!= lsa->header->id)
|
!= lsa->header->id)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
link_lsa = (struct ospf6_link_lsa *)ospf6_lsa_header_end(
|
link_lsa = lsa_after_header(lsa->header);
|
||||||
lsa->header);
|
|
||||||
if (IS_OSPF6_DEBUG_SPF(PROCESS)) {
|
if (IS_OSPF6_DEBUG_SPF(PROCESS)) {
|
||||||
inet_ntop(AF_INET6, &link_lsa->linklocal_addr, buf,
|
inet_ntop(AF_INET6, &link_lsa->linklocal_addr, buf,
|
||||||
sizeof(buf));
|
sizeof(buf));
|
||||||
|
@ -1136,8 +1135,7 @@ int ospf6_ase_calculate_route(struct ospf6 *ospf6, struct ospf6_lsa *lsa,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
external = (struct ospf6_as_external_lsa *)ospf6_lsa_header_end(
|
external = lsa_after_header(lsa->header);
|
||||||
lsa->header);
|
|
||||||
prefix.family = AF_INET6;
|
prefix.family = AF_INET6;
|
||||||
prefix.prefixlen = external->prefix.prefix_length;
|
prefix.prefixlen = external->prefix.prefix_length;
|
||||||
ospf6_prefix_in6_addr(&prefix.u.prefix6, external, &external->prefix);
|
ospf6_prefix_in6_addr(&prefix.u.prefix6, external, &external->prefix);
|
||||||
|
|
Loading…
Reference in a new issue