Fix prefix-map build code logic.

This commit is contained in:
Simon Kelley
2012-03-08 13:24:17 +00:00
parent 3803437dcc
commit e25d1a2ea2

View File

@@ -443,9 +443,12 @@ static int add_subnet(struct in6_addr *local, int prefix,
is_same_net6(local, &context->end6, prefix)) is_same_net6(local, &context->end6, prefix))
{ {
for (map = *subnets; map; map = map->next) for (map = *subnets; map; map = map->next)
if (map->iface == 0) if (map->iface == 0 ||
(map->iface == if_index && is_same_net6(local, &map->subnet, prefix)))
break; break;
else if (map->iface == if_index && is_same_net6(local, &map->subnet, prefix))
/* It's there already */
if (map && map->iface != 0)
continue; continue;
if (!map && (map = whine_malloc(sizeof(struct subnet_map)))) if (!map && (map = whine_malloc(sizeof(struct subnet_map))))
@@ -478,6 +481,7 @@ struct subnet_map *build_subnet_map(void)
if ((context->flags & CONTEXT_RA_NAME)) if ((context->flags & CONTEXT_RA_NAME))
break; break;
/* no ra-names, no need to go further. */
if (!context) if (!context)
return NULL; return NULL;