diff options
-rw-r--r-- | ospf6d/ospf6_route.c | 6 | ||||
-rw-r--r-- | ospf6d/ospf6_zebra.c | 19 | ||||
-rw-r--r-- | ospfd/ospf_memory.c | 3 | ||||
-rw-r--r-- | ospfd/ospf_memory.h | 2 | ||||
-rw-r--r-- | ospfd/ospf_zebra.c | 3 |
5 files changed, 18 insertions, 15 deletions
diff --git a/ospf6d/ospf6_route.c b/ospf6d/ospf6_route.c index a4e7af1d8..c2722a256 100644 --- a/ospf6d/ospf6_route.c +++ b/ospf6d/ospf6_route.c @@ -351,7 +351,7 @@ void ospf6_route_delete(struct ospf6_route *route) { if (route) { if (route->nh_list) - list_free(route->nh_list); + list_delete(route->nh_list); XFREE(MTYPE_OSPF6_ROUTE, route); } } @@ -630,7 +630,7 @@ struct ospf6_route *ospf6_route_add(struct ospf6_route *route, if (prev || next) { if (IS_OSPF6_DEBUG_ROUTE(MEMORY)) zlog_debug( - "%s %p: route add %p: another path: prev %p, next %p node lock %u", + "%s %p: route add %p: another path: prev %p, next %p node refcount %u", ospf6_route_table_name(table), (void *)table, (void *)route, (void *)prev, (void *)next, node->lock); @@ -758,7 +758,7 @@ void ospf6_route_remove(struct ospf6_route *route, prefix2str(&route->prefix, buf, sizeof(buf)); if (IS_OSPF6_DEBUG_ROUTE(MEMORY)) - zlog_debug("%s %p: route remove %p: %s rnode lock %u", + zlog_debug("%s %p: route remove %p: %s rnode refcount %u", ospf6_route_table_name(table), (void *)table, (void *)route, buf, route->rnode->lock); else if (IS_OSPF6_DEBUG_ROUTE(TABLE)) diff --git a/ospf6d/ospf6_zebra.c b/ospf6d/ospf6_zebra.c index e7481ba72..d33f41730 100644 --- a/ospf6d/ospf6_zebra.c +++ b/ospf6d/ospf6_zebra.c @@ -214,14 +214,14 @@ static int ospf6_zebra_read_ipv6(int command, struct zclient *zclient, struct zapi_ipv6 api; unsigned long ifindex; struct prefix p, src_p; - struct in6_addr nexthop; + struct in6_addr *nexthop; if (ospf6 == NULL) return 0; s = zclient->ibuf; ifindex = 0; - memset(&nexthop, 0, sizeof(struct in6_addr)); + nexthop = NULL; memset(&api, 0, sizeof(api)); /* Type, flags, message. */ @@ -250,7 +250,10 @@ static int ospf6_zebra_read_ipv6(int command, struct zclient *zclient, /* Nexthop, ifindex, distance, metric. */ if (CHECK_FLAG(api.message, ZAPI_MESSAGE_NEXTHOP)) { api.nexthop_num = stream_getc(s); - stream_get(&nexthop, s, IPV6_MAX_BYTELEN); + nexthop = (struct in6_addr *)malloc(api.nexthop_num + * sizeof(struct in6_addr)); + stream_get(nexthop, s, + api.nexthop_num * sizeof(struct in6_addr)); } if (CHECK_FLAG(api.message, ZAPI_MESSAGE_IFINDEX)) { api.ifindex_num = stream_getc(s); @@ -273,9 +276,9 @@ static int ospf6_zebra_read_ipv6(int command, struct zclient *zclient, if (IS_OSPF6_DEBUG_ZEBRA(RECV)) { char prefixstr[PREFIX2STR_BUFFER], nexthopstr[128]; prefix2str((struct prefix *)&p, prefixstr, sizeof(prefixstr)); - if (api.nexthop_num) - inet_ntop(AF_INET6, &nexthop, nexthopstr, - sizeof(nexthopstr)); + if (nexthop) + inet_ntop(AF_INET6, nexthop, nexthopstr, + sizeof(nexthopstr)); else snprintf(nexthopstr, sizeof(nexthopstr), "::"); @@ -289,10 +292,12 @@ static int ospf6_zebra_read_ipv6(int command, struct zclient *zclient, if (command == ZEBRA_REDISTRIBUTE_IPV6_ADD) ospf6_asbr_redistribute_add(api.type, ifindex, &p, - api.nexthop_num, &nexthop, api.tag); + api.nexthop_num, nexthop, api.tag); else ospf6_asbr_redistribute_remove(api.type, ifindex, &p); + if (CHECK_FLAG(api.message, ZAPI_MESSAGE_NEXTHOP)) + free(nexthop); return 0; } diff --git a/ospfd/ospf_memory.c b/ospfd/ospf_memory.c index 988991e35..cdc9b929f 100644 --- a/ospfd/ospf_memory.c +++ b/ospfd/ospf_memory.c @@ -53,6 +53,3 @@ DEFINE_MTYPE(OSPFD, OSPF_IF_PARAMS, "OSPF if params") DEFINE_MTYPE(OSPFD, OSPF_MESSAGE, "OSPF message") DEFINE_MTYPE(OSPFD, OSPF_MPLS_TE, "OSPF MPLS parameters") DEFINE_MTYPE(OSPFD, OSPF_PCE_PARAMS, "OSPF PCE parameters") -DEFINE_MTYPE(OSPFD, OSPF_EXTERNAL, "OSPF External route table") -DEFINE_MTYPE(OSPFD, OSPF_REDISTRIBUTE, "OSPF Redistriute") - diff --git a/ospfd/ospf_memory.h b/ospfd/ospf_memory.h index d91cbd411..5f5960eec 100644 --- a/ospfd/ospf_memory.h +++ b/ospfd/ospf_memory.h @@ -52,7 +52,5 @@ DECLARE_MTYPE(OSPF_IF_PARAMS) DECLARE_MTYPE(OSPF_MESSAGE) DECLARE_MTYPE(OSPF_MPLS_TE) DECLARE_MTYPE(OSPF_PCE_PARAMS) -DECLARE_MTYPE(OSPF_EXTERNAL) -DECLARE_MTYPE(OSPF_REDISTRIBUTE) #endif /* _QUAGGA_OSPF_MEMORY_H */ diff --git a/ospfd/ospf_zebra.c b/ospfd/ospf_zebra.c index 5839eb40e..ec8f1ee85 100644 --- a/ospfd/ospf_zebra.c +++ b/ospfd/ospf_zebra.c @@ -51,6 +51,9 @@ #include "ospfd/ospf_zebra.h" #include "ospfd/ospf_te.h" +DEFINE_MTYPE_STATIC(OSPFD, OSPF_EXTERNAL, "OSPF External route table") +DEFINE_MTYPE_STATIC(OSPFD, OSPF_REDISTRIBUTE, "OSPF Redistriute") + DEFINE_HOOK(ospf_if_update, (struct interface * ifp), (ifp)) DEFINE_HOOK(ospf_if_delete, (struct interface * ifp), (ifp)) |