Browse Source

ospf6d: fix warnings from recent prefix bit commit

* lib/prefix.h
  * prefix6_bit(): add IPv6 wrapper for prefix_bit()
* ospf6d/ospf6_lsdb.c
  * ospf6_lsdb_type_router_head(): employ prefix6_bit()
  * ospf6_lsdb_type_head(): idem
Stephen Hemminger 12 years ago
parent
commit
813f6a0064
2 changed files with 8 additions and 2 deletions
  1. 6 0
      lib/prefix.h
  2. 2 2
      ospf6d/ospf6_lsdb.c

+ 6 - 0
lib/prefix.h

@@ -137,6 +137,12 @@ prefix_bit (const u_char *prefix, const u_char prefixlen)
   return (prefix[offset] >> shift) & 1;
 }
 
+static inline unsigned int
+prefix6_bit (const struct in6_addr *prefix, const u_char prefixlen)
+{
+  return prefix_bit((const u_char *) &prefix->s6_addr, prefixlen);
+}
+
 /* Prototypes. */
 extern int afi2family (int);
 extern int family2afi (int);

+ 2 - 2
ospf6d/ospf6_lsdb.c

@@ -381,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[prefix_bit(&key.prefix, node->p.prefixlen)];
+    node = node->link[prefix6_bit(&key.prefix, node->p.prefixlen)];
 
   if (node)
     route_lock_node (node);
@@ -435,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[prefix_bit(&key.prefix, node->p.prefixlen)];
+    node = node->link[prefix6_bit(&key.prefix, node->p.prefixlen)];
 
   if (node)
     route_lock_node (node);