summaryrefslogtreecommitdiffstats
path: root/ospf6d
diff options
context:
space:
mode:
Diffstat (limited to 'ospf6d')
-rw-r--r--ospf6d/ospf6_lsa.c11
-rw-r--r--ospf6d/ospf6_lsdb.c12
-rw-r--r--ospf6d/ospf6_route.c5
3 files changed, 11 insertions, 17 deletions
diff --git a/ospf6d/ospf6_lsa.c b/ospf6d/ospf6_lsa.c
index 07d9f91e..c1db3741 100644
--- a/ospf6d/ospf6_lsa.c
+++ b/ospf6d/ospf6_lsa.c
@@ -256,7 +256,7 @@ ospf6_lsa_premature_aging (struct ospf6_lsa *lsa)
int
ospf6_lsa_compare (struct ospf6_lsa *a, struct ospf6_lsa *b)
{
- signed long seqnuma, seqnumb;
+ int seqnuma, seqnumb;
u_int16_t cksuma, cksumb;
u_int16_t agea, ageb;
@@ -264,16 +264,13 @@ ospf6_lsa_compare (struct ospf6_lsa *a, struct ospf6_lsa *b)
assert (b && b->header);
assert (OSPF6_LSA_IS_SAME (a, b));
- seqnuma = ((signed long) ntohl (a->header->seqnum))
- - (signed long) INITIAL_SEQUENCE_NUMBER;
- seqnumb = ((signed long) ntohl (b->header->seqnum))
- - (signed long) INITIAL_SEQUENCE_NUMBER;
+ seqnuma = (int) ntohl (a->header->seqnum);
+ seqnumb = (int) ntohl (b->header->seqnum);
/* compare by sequence number */
- /* XXX, LS sequence number wrapping */
if (seqnuma > seqnumb)
return -1;
- else if (seqnuma < seqnumb)
+ if (seqnuma < seqnumb)
return 1;
/* Checksum */
diff --git a/ospf6d/ospf6_lsdb.c b/ospf6d/ospf6_lsdb.c
index b839d16e..d2e3e04c 100644
--- a/ospf6d/ospf6_lsdb.c
+++ b/ospf6d/ospf6_lsdb.c
@@ -258,9 +258,6 @@ ospf6_lsdb_lookup (u_int16_t type, u_int32_t id, u_int32_t adv_router,
return (struct ospf6_lsa *) node->info;
}
-/* Macro version of check_bit (). */
-#define CHECK_BIT(X,P) ((((u_char *)(X))[(P) / 8]) >> (7 - ((P) % 8)) & 1)
-
struct ospf6_lsa *
ospf6_lsdb_lookup_next (u_int16_t type, u_int32_t id, u_int32_t adv_router,
struct ospf6_lsdb *lsdb)
@@ -291,7 +288,7 @@ ospf6_lsdb_lookup_next (u_int16_t type, u_int32_t id, u_int32_t adv_router,
prefix_match (&node->p, p))
{
matched = node;
- node = node->link[CHECK_BIT(&p->u.prefix, node->p.prefixlen)];
+ node = node->link[prefix_bit(&p->u.prefix, node->p.prefixlen)];
}
if (matched)
@@ -384,7 +381,7 @@ ospf6_lsdb_type_router_head (u_int16_t type, u_int32_t adv_router,
/* Walk down tree. */
while (node && node->p.prefixlen <= key.prefixlen &&
prefix_match (&node->p, (struct prefix *) &key))
- node = node->link[CHECK_BIT(&key.prefix, node->p.prefixlen)];
+ node = node->link[prefix_bit(&key.prefix, node->p.prefixlen)];
if (node)
route_lock_node (node);
@@ -438,7 +435,7 @@ ospf6_lsdb_type_head (u_int16_t type, struct ospf6_lsdb *lsdb)
node = lsdb->table->top;
while (node && node->p.prefixlen <= key.prefixlen &&
prefix_match (&node->p, (struct prefix *) &key))
- node = node->link[CHECK_BIT(&key.prefix, node->p.prefixlen)];
+ node = node->link[prefix_bit(&key.prefix, node->p.prefixlen)];
if (node)
route_lock_node (node);
@@ -553,7 +550,10 @@ ospf6_new_ls_id (u_int16_t type, u_int32_t adv_router,
if (ntohl (lsa->header->id) < id)
continue;
if (ntohl (lsa->header->id) > id)
+ {
+ ospf6_lsa_unlock (lsa);
break;
+ }
id++;
}
diff --git a/ospf6d/ospf6_route.c b/ospf6d/ospf6_route.c
index 9832f570..1e1f4fb5 100644
--- a/ospf6d/ospf6_route.c
+++ b/ospf6d/ospf6_route.c
@@ -706,9 +706,6 @@ ospf6_route_best_next (struct ospf6_route *route)
return next;
}
-/* Macro version of check_bit (). */
-#define CHECK_BIT(X,P) ((((u_char *)(X))[(P) / 8]) >> (7 - ((P) % 8)) & 1)
-
struct ospf6_route *
ospf6_route_match_head (struct prefix *prefix,
struct ospf6_route_table *table)
@@ -720,7 +717,7 @@ ospf6_route_match_head (struct prefix *prefix,
node = table->table->top;
while (node && node->p.prefixlen < prefix->prefixlen &&
prefix_match (&node->p, prefix))
- node = node->link[CHECK_BIT(&prefix->u.prefix, node->p.prefixlen)];
+ node = node->link[prefix_bit(&prefix->u.prefix, node->p.prefixlen)];
if (node)
route_lock_node (node);