summaryrefslogtreecommitdiffstats
path: root/libtransport
diff options
context:
space:
mode:
authorAlberto Compagno <acompagn+fdio@cisco.com>2019-08-22 09:48:32 +0200
committerAlberto Compagno <acompagn+fdio@cisco.com>2019-11-04 18:10:09 +0100
commitccf813e13eba7b5c71cc3090582f50f25ba7b721 (patch)
tree2316f2d00a2c6fa8dc5c4195386cf9554cc49726 /libtransport
parent6b7f4c3f9d9d26a5aa71be8f5976956aff387e8f (diff)
[HICN-262] Fix binary api to prevent byteswapping of ip addresses in vapi
Change-Id: If3f9a7db1e1310fdc08d1003b28e5e1d4006b61e Signed-off-by: Alberto Compagno <acompagn+fdio@cisco.com>
Diffstat (limited to 'libtransport')
-rw-r--r--libtransport/CMakeLists.txt2
-rw-r--r--libtransport/src/hicn/transport/core/content_object.cc6
-rw-r--r--libtransport/src/hicn/transport/core/content_object.h4
-rw-r--r--libtransport/src/hicn/transport/core/forwarder_interface.h8
-rw-r--r--libtransport/src/hicn/transport/core/hicn_binary_api.c48
-rw-r--r--libtransport/src/hicn/transport/core/hicn_binary_api.h6
-rw-r--r--libtransport/src/hicn/transport/core/interest.cc6
-rw-r--r--libtransport/src/hicn/transport/core/interest.h4
-rw-r--r--libtransport/src/hicn/transport/core/packet.h4
-rw-r--r--libtransport/src/hicn/transport/core/prefix.cc48
-rw-r--r--libtransport/src/hicn/transport/core/prefix.h4
-rw-r--r--libtransport/src/hicn/transport/core/raw_socket_interface.cc3
-rw-r--r--libtransport/src/hicn/transport/core/vpp_forwarder_interface.cc33
13 files changed, 91 insertions, 85 deletions
diff --git a/libtransport/CMakeLists.txt b/libtransport/CMakeLists.txt
index dc3409c6f..e90d3a2f4 100644
--- a/libtransport/CMakeLists.txt
+++ b/libtransport/CMakeLists.txt
@@ -138,7 +138,7 @@ list(APPEND LIBRARIES
${LIBPARC_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
${HICN_LIBRARIES}
- ${VPP_LIBRARY_VPPAPICLIENT}
+ ${VPP_LIBRARIES}
${ANDROID_LIBRARIES}
${OPENSSL_LIBRARIES}
${WINDOWS_LIBRARIES}
diff --git a/libtransport/src/hicn/transport/core/content_object.cc b/libtransport/src/hicn/transport/core/content_object.cc
index d05239372..6cbcdb29e 100644
--- a/libtransport/src/hicn/transport/core/content_object.cc
+++ b/libtransport/src/hicn/transport/core/content_object.cc
@@ -154,7 +154,7 @@ ContentObject &ContentObject::setPathLabel(uint32_t path_label) {
return *this;
}
-void ContentObject::setLocator(const ip_prefix_t &ip_address) {
+void ContentObject::setLocator(const ip_address_t &ip_address) {
if (hicn_data_set_locator(format_, packet_start_, &ip_address) < 0) {
throw errors::RuntimeException("Error setting content object locator");
}
@@ -162,8 +162,8 @@ void ContentObject::setLocator(const ip_prefix_t &ip_address) {
return;
}
-ip_prefix_t ContentObject::getLocator() const {
- ip_prefix_t ip;
+ip_address_t ContentObject::getLocator() const {
+ ip_address_t ip;
if (hicn_data_get_locator(format_, packet_start_, &ip) < 0) {
throw errors::RuntimeException("Error getting content object locator.");
diff --git a/libtransport/src/hicn/transport/core/content_object.h b/libtransport/src/hicn/transport/core/content_object.h
index ef5144c23..5af548fe4 100644
--- a/libtransport/src/hicn/transport/core/content_object.h
+++ b/libtransport/src/hicn/transport/core/content_object.h
@@ -60,9 +60,9 @@ class ContentObject : public Packet {
ContentObject &setPathLabel(uint32_t path_label);
- void setLocator(const ip_prefix_t &ip_address) override;
+ void setLocator(const ip_address_t &ip_address) override;
- ip_prefix_t getLocator() const override;
+ ip_address_t getLocator() const override;
void setLifetime(uint32_t lifetime) override;
diff --git a/libtransport/src/hicn/transport/core/forwarder_interface.h b/libtransport/src/hicn/transport/core/forwarder_interface.h
index a89ed8a3c..380ce76bd 100644
--- a/libtransport/src/hicn/transport/core/forwarder_interface.h
+++ b/libtransport/src/hicn/transport/core/forwarder_interface.h
@@ -49,10 +49,6 @@ class ForwarderInterface {
mtu_(1500),
output_interface_(""),
content_store_reserved_(standard_cs_reserved) {
- inet_address_.family = AF_INET;
- inet_address_.len = IPV4_ADDR_LEN;
- inet6_address_.family = AF_INET6;
- inet6_address_.len = IPV6_ADDR_LEN;
}
public:
@@ -135,8 +131,8 @@ class ForwarderInterface {
protected:
ConnectorType &connector_;
- ip_prefix_t inet_address_;
- ip_prefix_t inet6_address_;
+ ip_address_t inet_address_;
+ ip_address_t inet6_address_;
uint16_t mtu_;
std::string output_interface_;
uint32_t content_store_reserved_;
diff --git a/libtransport/src/hicn/transport/core/hicn_binary_api.c b/libtransport/src/hicn/transport/core/hicn_binary_api.c
index 8fde516fd..9f93953ab 100644
--- a/libtransport/src/hicn/transport/core/hicn_binary_api.c
+++ b/libtransport/src/hicn/transport/core/hicn_binary_api.c
@@ -39,6 +39,8 @@
#include <vnet/ip/format.h>
#include <vnet/ip/ip4_packet.h>
#include <vnet/ip/ip6_packet.h>
+#include <vnet/ip/ip_types_api.h>
+#include <vnet/fib/fib_types.h>
#include <vpp_plugins/hicn/error.h>
#include <vpp_plugins/hicn/hicn_api.h>
@@ -58,7 +60,6 @@
#undef vl_api_version
#undef vl_printfun
#undef vl_endianfun
-
/////////////////////////////////////////////////////
const char *HICN_ERROR_STRING[] = {
#define _(a, b, c) c,
@@ -67,6 +68,24 @@ const char *HICN_ERROR_STRING[] = {
};
/////////////////////////////////////////////////////
+/*********************** Missing Symbol in vpp libraries *************************/
+u8 *
+format_vl_api_address_union (u8 * s, va_list * args)
+{
+ const vl_api_address_union_t *addr =
+ va_arg (*args, vl_api_address_union_t *);
+ vl_api_address_family_t af = va_arg (*args, vl_api_address_family_t);
+
+ if (ADDRESS_IP6 == af)
+ s = format (s, "%U", format_ip6_address, addr->ip6);
+ else
+ s = format (s, "%U", format_ip4_address, addr->ip4);
+
+ return s;
+}
+
+/*********************************************************************************/
+
static context_store_t context_store = {
.global_pointers_map_index = 0,
};
@@ -92,13 +111,14 @@ int hicn_binary_api_register_prod_app(
CONTEXT_SAVE(context_store, api, mp)
- mp->len = (u8)input_params->prefix->len;
+ fib_prefix_t prefix;
+ memcpy(&prefix.fp_addr.as_u64, &input_params->prefix->address.as_u64, sizeof(ip46_address_t));
+ prefix.fp_len = input_params->prefix->len;
+ prefix.fp_proto = ip46_address_is_ip4(&prefix.fp_addr) ? FIB_PROTOCOL_IP4 : FIB_PROTOCOL_IP6;
+ ip_prefix_encode(&prefix, &mp->prefix);
mp->swif = clib_host_to_net_u32(input_params->swif);
mp->cs_reserved = clib_host_to_net_u32(input_params->cs_reserved);
- mp->prefix[0] = clib_host_to_net_u64(input_params->prefix->address.as_u64[0]);
- mp->prefix[1] = clib_host_to_net_u64(input_params->prefix->address.as_u64[1]);
-
return vpp_binary_api_send_request_wait_reply(api->vpp_api, mp);
}
@@ -112,8 +132,8 @@ static void vl_api_hicn_api_register_prod_app_reply_t_handler(
vpp_binary_api_set_ret_value(binary_api->vpp_api,
clib_net_to_host_u32(mp->retval));
params->cs_reserved = mp->cs_reserved;
- params->prod_addr->address.as_u64[0] = mp->prod_addr[0];
- params->prod_addr->address.as_u64[1] = mp->prod_addr[1];
+ params->prod_addr = (ip_address_t *)malloc(sizeof(ip_address_t));
+ ip_address_decode(&mp->prod_addr, (ip46_address_t *)(params->prod_addr));
params->face_id = clib_net_to_host_u32(mp->faceid);
vpp_binary_api_unlock_waiting_thread(binary_api->vpp_api);
@@ -147,9 +167,8 @@ static void vl_api_hicn_api_register_cons_app_reply_t_handler(
vpp_binary_api_set_ret_value(binary_api->vpp_api,
clib_net_to_host_u32(mp->retval));
- params->src4->address.v4.as_u32 = clib_net_to_host_u32(mp->src_addr4);
- params->src6->address.as_u64[0] = clib_net_to_host_u64(mp->src_addr6[0]);
- params->src6->address.as_u64[1] = clib_net_to_host_u64(mp->src_addr6[1]);
+ ip_address_decode(&mp->src_addr4, (ip46_address_t *)params->src4);
+ ip_address_decode(&mp->src_addr6, (ip46_address_t *)params->src6);
params->face_id = clib_host_to_net_u32(mp->faceid);
vpp_binary_api_unlock_waiting_thread(binary_api->vpp_api);
@@ -165,11 +184,10 @@ int hicn_binary_api_register_route(
M(HICN_API_ROUTE_NHOPS_ADD, mp);
CONTEXT_SAVE(context_store, api, mp)
-
- mp->prefix[0] = input_params->prefix->address.as_u64[0];
- mp->prefix[1] = input_params->prefix->address.as_u64[1];
- mp->len = input_params->prefix->len;
- mp->face_ids[0] = input_params->face_id;
+ fib_prefix_t prefix;
+ memcpy(&prefix.fp_addr.as_u64, &input_params->prefix->address.as_u64, sizeof(ip46_address_t));
+ prefix.fp_len = input_params->prefix->len;
+ mp->face_ids[0] = clib_host_to_net_u32(input_params->face_id);
mp->n_faces = 1;
return vpp_binary_api_send_request_wait_reply(api->vpp_api, mp);
diff --git a/libtransport/src/hicn/transport/core/hicn_binary_api.h b/libtransport/src/hicn/transport/core/hicn_binary_api.h
index b09b5f4a7..50590917f 100644
--- a/libtransport/src/hicn/transport/core/hicn_binary_api.h
+++ b/libtransport/src/hicn/transport/core/hicn_binary_api.h
@@ -40,13 +40,13 @@ typedef struct {
typedef struct {
uint32_t cs_reserved;
- ip_prefix_t* prod_addr;
+ ip_address_t* prod_addr;
uint32_t face_id;
} hicn_producer_output_params;
typedef struct {
- ip_prefix_t* src4;
- ip_prefix_t* src6;
+ ip_address_t* src4;
+ ip_address_t* src6;
uint32_t face_id;
} hicn_consumer_output_params;
diff --git a/libtransport/src/hicn/transport/core/interest.cc b/libtransport/src/hicn/transport/core/interest.cc
index 6465053de..166632f0a 100644
--- a/libtransport/src/hicn/transport/core/interest.cc
+++ b/libtransport/src/hicn/transport/core/interest.cc
@@ -119,7 +119,7 @@ void Interest::setName(Name &&name) {
}
}
-void Interest::setLocator(const ip_prefix_t &ip_address) {
+void Interest::setLocator(const ip_address_t &ip_address) {
if (hicn_interest_set_locator(format_, packet_start_, &ip_address) < 0) {
throw errors::RuntimeException("Error setting interest locator.");
}
@@ -127,8 +127,8 @@ void Interest::setLocator(const ip_prefix_t &ip_address) {
return;
}
-ip_prefix_t Interest::getLocator() const {
- ip_prefix_t ip;
+ip_address_t Interest::getLocator() const {
+ ip_address_t ip;
if (hicn_interest_get_locator(format_, packet_start_, &ip) < 0) {
throw errors::RuntimeException("Error getting interest locator.");
diff --git a/libtransport/src/hicn/transport/core/interest.h b/libtransport/src/hicn/transport/core/interest.h
index 12fd597e5..48c833a73 100644
--- a/libtransport/src/hicn/transport/core/interest.h
+++ b/libtransport/src/hicn/transport/core/interest.h
@@ -55,9 +55,9 @@ class Interest
void setName(Name &&name) override;
- void setLocator(const ip_prefix_t &ip_address) override;
+ void setLocator(const ip_address_t &ip_address) override;
- ip_prefix_t getLocator() const override;
+ ip_address_t getLocator() const override;
void setLifetime(uint32_t lifetime) override;
diff --git a/libtransport/src/hicn/transport/core/packet.h b/libtransport/src/hicn/transport/core/packet.h
index 825c4c9dd..4ec93205a 100644
--- a/libtransport/src/hicn/transport/core/packet.h
+++ b/libtransport/src/hicn/transport/core/packet.h
@@ -133,9 +133,9 @@ class Packet : public std::enable_shared_from_this<Packet> {
void dump() const;
- virtual void setLocator(const ip_prefix_t &locator) = 0;
+ virtual void setLocator(const ip_address_t &locator) = 0;
- virtual ip_prefix_t getLocator() const = 0;
+ virtual ip_address_t getLocator() const = 0;
void setSignatureTimestamp(const uint64_t &timestamp);
diff --git a/libtransport/src/hicn/transport/core/prefix.cc b/libtransport/src/hicn/transport/core/prefix.cc
index 6b87ccd1f..b7ddce73a 100644
--- a/libtransport/src/hicn/transport/core/prefix.cc
+++ b/libtransport/src/hicn/transport/core/prefix.cc
@@ -33,7 +33,7 @@ namespace transport {
namespace core {
-Prefix::Prefix() { std::memset(&ip_address_, 0, sizeof(ip_prefix_t)); }
+Prefix::Prefix() { std::memset(&ip_prefix_, 0, sizeof(ip_prefix_t)); }
Prefix::Prefix(const char *prefix) : Prefix(std::string(prefix)) {}
@@ -66,9 +66,9 @@ Prefix::Prefix(const core::Name &content_name, uint16_t prefix_length) {
throw errors::InvalidIpAddressException();
}
- ip_address_ = content_name.toIpAddress();
- ip_address_.len = prefix_length;
- ip_address_.family = family;
+ ip_prefix_ = content_name.toIpAddress();
+ ip_prefix_.len = prefix_length;
+ ip_prefix_.family = family;
}
void Prefix::buildPrefix(std::string &prefix, uint16_t prefix_length,
@@ -77,20 +77,20 @@ void Prefix::buildPrefix(std::string &prefix, uint16_t prefix_length,
throw errors::InvalidIpAddressException();
}
- int ret = inet_pton(family, prefix.c_str(), ip_address_.address.buffer);
+ int ret = inet_pton(family, prefix.c_str(), ip_prefix_.address.buffer);
if (ret != 1) {
throw errors::InvalidIpAddressException();
}
- ip_address_.len = prefix_length;
- ip_address_.family = family;
+ ip_prefix_.len = prefix_length;
+ ip_prefix_.family = family;
}
std::unique_ptr<Sockaddr> Prefix::toSockaddr() {
Sockaddr *ret = nullptr;
- switch (ip_address_.family) {
+ switch (ip_prefix_.family) {
case AF_INET6:
ret = (Sockaddr *)new Sockaddr6;
break;
@@ -101,39 +101,39 @@ std::unique_ptr<Sockaddr> Prefix::toSockaddr() {
throw errors::InvalidIpAddressException();
}
- if (ip_prefix_to_sockaddr(&ip_address_, ret) < 0) {
+ if (ip_prefix_to_sockaddr(&ip_prefix_, ret) < 0) {
throw errors::InvalidIpAddressException();
}
return std::unique_ptr<Sockaddr>(ret);
}
-uint16_t Prefix::getPrefixLength() { return ip_address_.len; }
+uint16_t Prefix::getPrefixLength() { return ip_prefix_.len; }
Prefix &Prefix::setPrefixLength(uint16_t prefix_length) {
- ip_address_.len = prefix_length;
+ ip_prefix_.len = prefix_length;
return *this;
}
-int Prefix::getAddressFamily() { return ip_address_.family; }
+int Prefix::getAddressFamily() { return ip_prefix_.family; }
Prefix &Prefix::setAddressFamily(int address_family) {
- ip_address_.family = address_family;
+ ip_prefix_.family = address_family;
return *this;
}
std::string Prefix::getNetwork() const {
- if (!checkPrefixLengthAndAddressFamily(ip_address_.len,
- ip_address_.family)) {
+ if (!checkPrefixLengthAndAddressFamily(ip_prefix_.len,
+ ip_prefix_.family)) {
throw errors::InvalidIpAddressException();
}
std::size_t size =
- ip_address_.family == 4 + AF_INET ? INET_ADDRSTRLEN : INET6_ADDRSTRLEN;
+ ip_prefix_.family == 4 + AF_INET ? INET_ADDRSTRLEN : INET6_ADDRSTRLEN;
std::string network(size, 0);
- if (ip_prefix_ntop_short(&ip_address_, (char *)network.c_str(), size) < 0) {
+ if (ip_prefix_ntop_short(&ip_prefix_, (char *)network.c_str(), size) < 0) {
throw errors::RuntimeException(
"Impossible to retrieve network from ip address.");
}
@@ -147,7 +147,7 @@ Name Prefix::getName() const {
}
Prefix &Prefix::setNetwork(std::string &network) {
- if (!inet_pton(AF_INET6, network.c_str(), ip_address_.address.buffer)) {
+ if (!inet_pton(AF_INET6, network.c_str(), ip_prefix_.address.buffer)) {
throw errors::RuntimeException("The network name is not valid.");
}
@@ -157,16 +157,16 @@ Prefix &Prefix::setNetwork(std::string &network) {
Name Prefix::makeRandomName() const {
srand((unsigned int)time(nullptr));
- if (ip_address_.family == AF_INET6) {
+ if (ip_prefix_.family == AF_INET6) {
std::default_random_engine eng((std::random_device())());
std::uniform_int_distribution<uint32_t> idis(
0, std::numeric_limits<uint32_t>::max());
uint64_t random_number = idis(eng);
- uint32_t hash_size_bits = IPV6_ADDR_LEN_BITS - ip_address_.len;
+ uint32_t hash_size_bits = IPV6_ADDR_LEN_BITS - ip_prefix_.len;
uint64_t ip_address[2];
- memcpy(ip_address, ip_address_.address.buffer, sizeof(uint64_t));
- memcpy(ip_address + 1, ip_address_.address.buffer + 8, sizeof(uint64_t));
+ memcpy(ip_address, ip_prefix_.address.buffer, sizeof(uint64_t));
+ memcpy(ip_address + 1, ip_prefix_.address.buffer + 8, sizeof(uint64_t));
std::string network(IPV6_ADDR_LEN * 3, 0);
// Let's do the magic ;)
@@ -179,7 +179,7 @@ Name Prefix::makeRandomName() const {
ip_address[1] |= random_number >> (sizeof(uint64_t) * 8 - shift_size);
- if (!inet_ntop(ip_address_.family, ip_address, (char *)network.c_str(),
+ if (!inet_ntop(ip_prefix_.family, ip_address, (char *)network.c_str(),
IPV6_ADDR_LEN * 3)) {
throw errors::RuntimeException(
"Impossible to retrieve network from ip address.");
@@ -208,7 +208,7 @@ bool Prefix::checkPrefixLengthAndAddressFamily(uint16_t prefix_length,
return true;
}
-ip_prefix_t &Prefix::toIpAddressStruct() { return ip_address_; }
+ip_prefix_t &Prefix::toIpPrefixStruct() { return ip_prefix_; }
} // namespace core
diff --git a/libtransport/src/hicn/transport/core/prefix.h b/libtransport/src/hicn/transport/core/prefix.h
index 022e2bec2..af7c705cf 100644
--- a/libtransport/src/hicn/transport/core/prefix.h
+++ b/libtransport/src/hicn/transport/core/prefix.h
@@ -52,7 +52,7 @@ class Prefix {
Name makeRandomName() const;
- ip_prefix_t &toIpAddressStruct();
+ ip_prefix_t &toIpPrefixStruct();
private:
static bool checkPrefixLengthAndAddressFamily(uint16_t prefix_length,
@@ -60,7 +60,7 @@ class Prefix {
void buildPrefix(std::string &prefix, uint16_t prefix_length, int family);
- ip_prefix_t ip_address_;
+ ip_prefix_t ip_prefix_;
};
} // end namespace core
diff --git a/libtransport/src/hicn/transport/core/raw_socket_interface.cc b/libtransport/src/hicn/transport/core/raw_socket_interface.cc
index ef365fce7..bb4e083e1 100644
--- a/libtransport/src/hicn/transport/core/raw_socket_interface.cc
+++ b/libtransport/src/hicn/transport/core/raw_socket_interface.cc
@@ -43,9 +43,8 @@ void RawSocketInterface::connect(bool is_consumer) {
// Get interface ip address
struct sockaddr_in6 address = {0};
utils::retrieveInterfaceAddress(output_interface_, &address);
- inet6_address_.family = address.sin6_family;
- std::memcpy(inet6_address_.address.buffer, &address.sin6_addr,
+ std::memcpy(&inet6_address_.v6.as_u8, &address.sin6_addr,
sizeof(address.sin6_addr));
connector_.connect(output_interface_, remote_mac_address_);
}
diff --git a/libtransport/src/hicn/transport/core/vpp_forwarder_interface.cc b/libtransport/src/hicn/transport/core/vpp_forwarder_interface.cc
index c8a4f9c88..598b692c9 100644
--- a/libtransport/src/hicn/transport/core/vpp_forwarder_interface.cc
+++ b/libtransport/src/hicn/transport/core/vpp_forwarder_interface.cc
@@ -87,8 +87,8 @@ uint32_t VPPForwarderInterface::getMemifConfiguration() {
void VPPForwarderInterface::consumerConnection() {
hicn_consumer_input_params input = {0};
hicn_consumer_output_params output = {0};
- ip_prefix_t ip4_address;
- ip_prefix_t ip6_address;
+ ip_address_t ip4_address;
+ ip_address_t ip6_address;
output.src4 = &ip4_address;
output.src6 = &ip6_address;
@@ -102,13 +102,9 @@ void VPPForwarderInterface::consumerConnection() {
throw errors::RuntimeException(hicn_binary_api_get_error_string(ret));
}
- inet_address_.family = AF_INET;
- inet_address_.len = output.src4->len;
- std::memcpy(inet_address_.address.buffer, output.src4->address.buffer, IPV6_ADDR_LEN);
+ std::memcpy(inet_address_.v4.as_u8, output.src4->as_u8, IPV4_ADDR_LEN);
- inet6_address_.family = AF_INET6;
- inet6_address_.len = output.src6->len;
- std::memcpy(inet6_address_.address.buffer, output.src6->address.buffer, IPV6_ADDR_LEN);
+ std::memcpy(inet6_address_.v6.as_u8, output.src6->as_u8, IPV6_ADDR_LEN);
}
void VPPForwarderInterface::producerConnection() {
@@ -141,10 +137,10 @@ void VPPForwarderInterface::connect(bool is_consumer) {
}
void VPPForwarderInterface::registerRoute(Prefix &prefix) {
- auto &addr = prefix.toIpAddressStruct();
+ ip_prefix_t &addr = prefix.toIpPrefixStruct();
- // Same ip address for input and outurt params
- ip_prefix_t ip_address;
+ ip_prefix_t producer_prefix;
+ ip_address_t producer_locator;
if (face_id_ == uint32_t(~0)) {
hicn_producer_input_params input;
@@ -153,8 +149,8 @@ void VPPForwarderInterface::registerRoute(Prefix &prefix) {
hicn_producer_output_params output;
std::memset(&output, 0, sizeof(output));
- input.prefix = &ip_address;
- output.prod_addr = &ip_address;
+ input.prefix = &producer_prefix;
+ output.prod_addr = &producer_locator;
// Here we have to ask to the actual connector what is the
// memif_id, since this function should be called after the
@@ -174,21 +170,18 @@ void VPPForwarderInterface::registerRoute(Prefix &prefix) {
}
if (addr.family == AF_INET6) {
- inet6_address_.len = output.prod_addr->len;
- inet6_address_.address.as_u64[0] = output.prod_addr->address.as_u64[0];
- inet6_address_.address.as_u64[1] = output.prod_addr->address.as_u64[1];
+ inet6_address_.v6.as_u64[0] = output.prod_addr->v6.as_u64[0];
+ inet6_address_.v6.as_u64[1] = output.prod_addr->v6.as_u64[1];
} else {
- inet_address_.len = output.prod_addr->len;
// The ipv4 is written in the last 4 bytes of the ipv6 address, so we need
// to copy from the byte 12
- inet_address_.address.as_u64[0] = output.prod_addr->address.as_u64[0];
- inet_address_.address.as_u64[1] = output.prod_addr->address.as_u64[1];
+ inet_address_.v4.as_u32 = output.prod_addr->v4.as_u32;
}
face_id_ = output.face_id;
} else {
hicn_producer_set_route_params params;
- params.prefix = &ip_address;
+ params.prefix = &producer_prefix;
params.prefix->address.as_u64[0] = addr.address.as_u64[0];
params.prefix->address.as_u64[1] = addr.address.as_u64[1];
params.prefix->family = addr.family == AF_INET6 ? AF_INET6 : AF_INET;