summaryrefslogtreecommitdiff
path: root/ospfd/ospf_lsa.c
diff options
context:
space:
mode:
Diffstat (limited to 'ospfd/ospf_lsa.c')
-rw-r--r--ospfd/ospf_lsa.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/ospfd/ospf_lsa.c b/ospfd/ospf_lsa.c
index d50f390e30..8cf2fad92e 100644
--- a/ospfd/ospf_lsa.c
+++ b/ospfd/ospf_lsa.c
@@ -33,6 +33,7 @@
#include "hash.h"
#include "sockunion.h" /* for inet_aton() */
#include "checksum.h"
+#include "network.h"
#include "ospfd/ospfd.h"
#include "ospfd/ospf_interface.h"
@@ -123,7 +124,7 @@ int get_age(struct ospf_lsa *lsa)
one-based. */
uint16_t ospf_lsa_checksum(struct lsa_header *lsa)
{
- uint8_t *buffer = (uint8_t *)&lsa->options;
+ uint8_t *buffer = &lsa->options;
int options_offset = buffer - (uint8_t *)&lsa->ls_age; /* should be 2 */
/* Skip the AGE field */
@@ -138,7 +139,7 @@ uint16_t ospf_lsa_checksum(struct lsa_header *lsa)
int ospf_lsa_checksum_valid(struct lsa_header *lsa)
{
- uint8_t *buffer = (uint8_t *)&lsa->options;
+ uint8_t *buffer = &lsa->options;
int options_offset = buffer - (uint8_t *)&lsa->ls_age; /* should be 2 */
/* Skip the AGE field */
@@ -2845,8 +2846,7 @@ void ospf_lsa_maxage_delete(struct ospf *ospf, struct ospf_lsa *lsa)
lsa_prefix.prefixlen = sizeof(lsa_prefix.u.ptr) * CHAR_BIT;
lsa_prefix.u.ptr = (uintptr_t)lsa;
- if ((rn = route_node_lookup(ospf->maxage_lsa,
- (struct prefix *)&lsa_prefix))) {
+ if ((rn = route_node_lookup(ospf->maxage_lsa, &lsa_prefix))) {
if (rn->info == lsa) {
UNSET_FLAG(lsa->flags, OSPF_LSA_IN_MAXAGE);
ospf_lsa_unlock(&lsa); /* maxage_lsa */
@@ -2888,7 +2888,7 @@ void ospf_lsa_maxage(struct ospf *ospf, struct ospf_lsa *lsa)
lsa_prefix.prefixlen = sizeof(lsa_prefix.u.ptr) * CHAR_BIT;
lsa_prefix.u.ptr = (uintptr_t)lsa;
- rn = route_node_get(ospf->maxage_lsa, (struct prefix *)&lsa_prefix);
+ rn = route_node_get(ospf->maxage_lsa, &lsa_prefix);
if (rn->info != NULL) {
if (IS_DEBUG_OSPF(lsa, LSA_FLOODING))
zlog_debug(
@@ -3524,7 +3524,8 @@ void ospf_refresher_register_lsa(struct ospf *ospf, struct ospf_lsa *lsa)
* 1680s
* and 1740s.
*/
- delay = (random() % (max_delay - min_delay)) + min_delay;
+ delay = (frr_weak_random() % (max_delay - min_delay))
+ + min_delay;
current_index = ospf->lsa_refresh_queue.index
+ (monotime(NULL) - ospf->lsa_refresher_started)