aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--hicn-light/src/hicn/processor/messageProcessor.c2
-rw-r--r--lib/src/name.c14
2 files changed, 4 insertions, 12 deletions
diff --git a/hicn-light/src/hicn/processor/messageProcessor.c b/hicn-light/src/hicn/processor/messageProcessor.c
index 420863e26..7b43543a3 100644
--- a/hicn-light/src/hicn/processor/messageProcessor.c
+++ b/hicn-light/src/hicn/processor/messageProcessor.c
@@ -415,14 +415,12 @@ void processor_SetStrategy(MessageProcessor *processor, Name *prefix,
strategy_type strategy) {
FibEntry *entry = fib_Contains(processor->fib, prefix);
if (entry != NULL) {
-#ifndef WITH_POLICY
fibEntry_SetStrategy(entry, strategy);
if (strategy == SET_STRATEGY_LOADBALANCER_WITH_DELAY) {
strategyLoadBalancerWithPD_SetConnectionTable(
fibEntry_GetFwdStrategy(entry),
forwarder_GetConnectionTable(processor->forwarder));
}
-#endif /* ! WITH_POLICY */
}
}
diff --git a/lib/src/name.c b/lib/src/name.c
index ba5ff85b5..0a0da63cf 100644
--- a/lib/src/name.c
+++ b/lib/src/name.c
@@ -82,28 +82,22 @@ hicn_name_create_from_ip_address (const ip_address_t * ip_address, u32 id,
switch (ip_address->family)
{
case AF_INET:
- if (name->type == HNT_UNSPEC)
- {
- name->type = HNT_CONTIGUOUS_V4;
- }
+ name->type = HNT_CONTIGUOUS_V4;
break;
case AF_INET6:
- if (name->type == HNT_UNSPEC)
- {
- name->type = HNT_CONTIGUOUS_V6;
- }
+ name->type = HNT_CONTIGUOUS_V6;
break;
default:
return HICN_LIB_ERROR_INVALID_IP_ADDRESS;
}
- name->len = (u8) (ip_address->prefix_len);
+ name->len = (u8) ip_address_len (ip_address);
if ((name->type != HNT_CONTIGUOUS_V4) && (name->type != HNT_CONTIGUOUS_V6))
{
return HICN_LIB_ERROR_NOT_IMPLEMENTED;
}
- memcpy (name->buffer, ip_address->buffer, ip_address_len (ip_address));
+ memcpy (name->buffer, ip_address->buffer, name->len);
*(u32 *) (name->buffer + name->len) = id;
return HICN_LIB_ERROR_NONE;