- for(subnet = subnet_list[SUBNET_IPV6]; subnet != NULL; subnet = subnet->global_next)
- {
- for(i=0; i<8; i++)
- if((address.x[i] & subnet->net.ipv6.mask.x[i]) != subnet->net.ipv6.address.x[i])
- break;
- if(i == 8)
- break;
- }
-cp
- return subnet;
+ subnet.type = SUBNET_IPV6;
+ memcpy(&subnet.net.ipv6.address, address, sizeof(ipv6_t));
+ memset(&subnet.net.ipv6.mask, 0xFF, 16);
+
+ p = (subnet_t *)avl_search_closest_greater(subnet_tree, &subnet);
+
+ if(p)
+ for(i=0; i<8; i++)
+ if((address->x[i] & p->net.ipv6.address.x[i]) != p->net.ipv6.address.x[i])
+ return NULL;
+
+ return p;