summaryrefslogtreecommitdiffstats
path: root/lib/src
diff options
context:
space:
mode:
Diffstat (limited to 'lib/src')
-rw-r--r--lib/src/name.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/src/name.c b/lib/src/name.c
index a623341fe..6c7945a18 100644
--- a/lib/src/name.c
+++ b/lib/src/name.c
@@ -83,17 +83,18 @@ hicn_name_create_from_ip_prefix (const ip_prefix_t * prefix, u32 id,
name->type = HNT_CONTIGUOUS_V4;
memcpy (name->buffer, prefix->address.v4.buffer,
ip_address_len(prefix->family));
+ name->len = IPV4_ADDR_LEN;
break;
case AF_INET6:
name->type = HNT_CONTIGUOUS_V6;
memcpy (name->buffer, prefix->address.v6.buffer,
ip_address_len(prefix->family));
+ name->len = IPV6_ADDR_LEN;
break;
default:
return HICN_LIB_ERROR_INVALID_IP_ADDRESS;
}
- name->len = (u8) (prefix->len);
*(u32 *) (name->buffer + name->len) = id;
return HICN_LIB_ERROR_NONE;