diff options
author | Luca Muscariello <lumuscar@cisco.com> | 2022-03-30 22:29:28 +0200 |
---|---|---|
committer | Mauro Sardara <msardara@cisco.com> | 2022-03-31 19:51:47 +0200 |
commit | c46e5df56b67bb8ea7a068d39324c640084ead2b (patch) | |
tree | eddeb17785938e09bc42eec98ee09b8a28846de6 /lib/src/protocol/ipv6.c | |
parent | 18fa668f25d3cc5463417ce7df6637e31578e898 (diff) |
feat: boostrap hicn 22.02
The current patch provides several new features, improvements,
bug fixes and also complete rewrite of entire components.
- lib
The hicn packet parser has been improved with a new packet
format fully based on UDP. The TCP header is still temporarily
supported but the UDP header will replace completely the new hicn
packet format. Improvements have been made to make sure every
packet parsing operation is made via this library. The current
new header can be used as header between the payload and the
UDP header or as trailer in the UDP surplus area to be tested
when UDP options will start to be used.
- hicn-light
The portable packet forwarder has been completely rewritten from
scratch with the twofold objective to improve performance and
code size but also to drop dependencies such as libparc which is
now removed by the current implementation.
- hicn control
the control library is the agent that is used to program the
packet forwarders via their binary API. This component has
benefited from significant improvements in terms of interaction
model which is now event driven and more robust to failures.
- VPP plugin has been updated to support VPP 22.02
- transport
Major improvement have been made to the RTC protocol, to the
support of IO modules and to the security sub system. Signed
manifests are the default data authenticity and integrity framework.
Confidentiality can be enabled by sharing the encryption key to the
prod/cons layer. The library has been tested with group key based
applications such as broadcast/multicast and real-time on-line
meetings with trusted server keys or MLS.
- testing
Unit testing has been introduced using GoogleTest. One third of
the code base is covered by unit testing with priority on
critical features. Functional testing has also been introduce
using Docker, linux bridging and Robot Framework to define
test with Less Code techniques to facilitate the extension
of the coverage.
Co-authored-by: Mauro Sardara <msardara@cisco.com>
Co-authored-by: Jordan Augé <jordan.auge+fdio@cisco.com>
Co-authored-by: Michele Papalini <micpapal@cisco.com>
Co-authored-by: Angelo Mantellini <manangel@cisco.com>
Co-authored-by: Jacques Samain <jsamain@cisco.com>
Co-authored-by: Olivier Roques <oroques+fdio@cisco.com>
Co-authored-by: Enrico Loparco <eloparco@cisco.com>
Co-authored-by: Giulio Grassi <gigrassi@cisco.com>
Change-Id: I75d0ef70f86d921e3ef503c99271216ff583c215
Signed-off-by: Luca Muscariello <muscariello@ieee.org>
Signed-off-by: Mauro Sardara <msardara@cisco.com>
Diffstat (limited to 'lib/src/protocol/ipv6.c')
-rw-r--r-- | lib/src/protocol/ipv6.c | 102 |
1 files changed, 63 insertions, 39 deletions
diff --git a/lib/src/protocol/ipv6.c b/lib/src/protocol/ipv6.c index 7ac55b2be..b3a107a13 100644 --- a/lib/src/protocol/ipv6.c +++ b/lib/src/protocol/ipv6.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019 Cisco and/or its affiliates. + * Copyright (c) 2021 Cisco and/or its affiliates. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at: @@ -33,8 +33,8 @@ ipv6_init_packet_header (hicn_type_t type, hicn_protocol_t *h) /* *INDENT-OFF* */ h->ipv6 = (_ipv6_header_t){ - .saddr = { { 0 } }, - .daddr = { { 0 } }, + .saddr = IP6_ADDRESS_EMPTY, + .daddr = IP6_ADDRESS_EMPTY, .version_class_flow = htonl ((IPV6_DEFAULT_VERSION << 28) | (IPV6_DEFAULT_TRAFFIC_CLASS << 20) | (IPV6_DEFAULT_FLOW_LABEL & 0xfffff)), @@ -48,17 +48,17 @@ ipv6_init_packet_header (hicn_type_t type, hicn_protocol_t *h) int ipv6_get_interest_locator (hicn_type_t type, const hicn_protocol_t *h, - ip46_address_t *ip_address) + ip_address_t *ip_address) { - ip_address->ip6 = h->ipv6.saddr; + ip_address->v6 = h->ipv6.saddr; return HICN_LIB_ERROR_NONE; } int ipv6_set_interest_locator (hicn_type_t type, hicn_protocol_t *h, - const ip46_address_t *ip_address) + const ip_address_t *ip_address) { - h->ipv6.saddr = ip_address->ip6; + h->ipv6.saddr = ip_address->v6; return HICN_LIB_ERROR_NONE; } @@ -66,20 +66,16 @@ int ipv6_get_interest_name (hicn_type_t type, const hicn_protocol_t *h, hicn_name_t *name) { - name->ip6.prefix_as_ip6 = h->ipv6.daddr; -#ifndef HICN_VPP_PLUGIN - name->type = HNT_CONTIGUOUS_V6; - name->len = HICN_V6_NAME_LEN; -#endif /* HICN_VPP_PLUGIN */ - return CHILD_OPS (get_interest_name_suffix, type, h, &(name->ip6.suffix)); + name->prefix.v6 = h->ipv6.daddr; + return CHILD_OPS (get_interest_name_suffix, type, h, &(name->suffix)); } int ipv6_set_interest_name (hicn_type_t type, hicn_protocol_t *h, const hicn_name_t *name) { - h->ipv6.daddr = name->ip6.prefix_as_ip6; - return CHILD_OPS (set_interest_name_suffix, type, h, &(name->ip6.suffix)); + h->ipv6.daddr = name->prefix.v6; + return CHILD_OPS (set_interest_name_suffix, type, h, &(name->suffix)); } int @@ -97,6 +93,12 @@ ipv6_set_interest_name_suffix (hicn_type_t type, hicn_protocol_t *h, } int +ipv6_is_interest (hicn_type_t type, const hicn_protocol_t *h, int *is_interest) +{ + return CHILD_OPS (is_interest, type, h, is_interest); +} + +int ipv6_mark_packet_as_interest (hicn_type_t type, hicn_protocol_t *h) { return CHILD_OPS (mark_packet_as_interest, type, h); @@ -119,17 +121,17 @@ ipv6_reset_interest_for_hash (hicn_type_t type, hicn_protocol_t *h) int ipv6_get_data_locator (hicn_type_t type, const hicn_protocol_t *h, - ip46_address_t *ip_address) + ip_address_t *ip_address) { - ip_address->ip6 = h->ipv6.daddr; + ip_address->v6 = h->ipv6.daddr; return HICN_LIB_ERROR_NONE; } int ipv6_set_data_locator (hicn_type_t type, hicn_protocol_t *h, - const ip46_address_t *ip_address) + const ip_address_t *ip_address) { - h->ipv6.daddr = ip_address->ip6; + h->ipv6.daddr = ip_address->v6; return HICN_LIB_ERROR_NONE; } @@ -137,20 +139,16 @@ int ipv6_get_data_name (hicn_type_t type, const hicn_protocol_t *h, hicn_name_t *name) { - name->ip6.prefix_as_ip6 = h->ipv6.saddr; -#ifndef HICN_VPP_PLUGIN - name->type = HNT_CONTIGUOUS_V6; - name->len = HICN_V6_NAME_LEN; -#endif /* HICN_VPP_PLUGIN */ - return CHILD_OPS (get_data_name_suffix, type, h, &(name->ip6.suffix)); + name->prefix.v6 = h->ipv6.saddr; + return CHILD_OPS (get_data_name_suffix, type, h, &(name->suffix)); } int ipv6_set_data_name (hicn_type_t type, hicn_protocol_t *h, const hicn_name_t *name) { - h->ipv6.saddr = name->ip6.prefix_as_ip6; - return CHILD_OPS (set_data_name_suffix, type, h, &(name->ip6.suffix)); + h->ipv6.saddr = name->prefix.v6; + return CHILD_OPS (set_data_name_suffix, type, h, &(name->suffix)); } int @@ -281,24 +279,23 @@ ipv6_verify_checksums (hicn_type_t type, hicn_protocol_t *h, u16 partial_csum, int ipv6_rewrite_interest (hicn_type_t type, hicn_protocol_t *h, - const ip46_address_t *addr_new, - ip46_address_t *addr_old) + const ip_address_t *addr_new, ip_address_t *addr_old) { // ASSERT(addr_old == NULL); - addr_old->ip6 = h->ipv6.saddr; - h->ipv6.saddr = addr_new->ip6; + addr_old->v6 = h->ipv6.saddr; + h->ipv6.saddr = addr_new->v6; return CHILD_OPS (rewrite_interest, type, h, addr_new, addr_old); } int ipv6_rewrite_data (hicn_type_t type, hicn_protocol_t *h, - const ip46_address_t *addr_new, ip46_address_t *addr_old, + const ip_address_t *addr_new, ip_address_t *addr_old, const hicn_faceid_t face_id, u8 reset_pl) { // ASSERT(addr_old == NULL); - addr_old->ip6 = h->ipv6.daddr; - h->ipv6.daddr = addr_new->ip6; + addr_old->v6 = h->ipv6.daddr; + h->ipv6.daddr = addr_new->v6; return CHILD_OPS (rewrite_data, type, h, addr_new, addr_old, face_id, reset_pl); @@ -357,6 +354,20 @@ ipv6_set_payload_length (hicn_type_t type, hicn_protocol_t *h, } int +ipv6_get_payload_type (hicn_type_t type, const hicn_protocol_t *h, + hicn_payload_type_t *payload_type) +{ + return CHILD_OPS (get_payload_type, type, h, payload_type); +} + +int +ipv6_set_payload_type (hicn_type_t type, hicn_protocol_t *h, + hicn_payload_type_t payload_type) +{ + return CHILD_OPS (set_payload_type, type, h, payload_type); +} + +int ipv6_get_signature_size (hicn_type_t type, const hicn_protocol_t *h, size_t *signature_size) { @@ -371,16 +382,17 @@ ipv6_set_signature_size (hicn_type_t type, hicn_protocol_t *h, } int -ipv6_set_signature_gap (hicn_type_t type, hicn_protocol_t *h, uint8_t gap) +ipv6_set_signature_padding (hicn_type_t type, hicn_protocol_t *h, + size_t padding) { - return CHILD_OPS (set_signature_gap, type, h, gap); + return CHILD_OPS (set_signature_padding, type, h, padding); } int -ipv6_get_signature_gap (hicn_type_t type, const hicn_protocol_t *h, - uint8_t *gap) +ipv6_get_signature_padding (hicn_type_t type, const hicn_protocol_t *h, + size_t *padding) { - return CHILD_OPS (get_signature_gap, type, h, gap); + return CHILD_OPS (get_signature_padding, type, h, padding); } int @@ -430,6 +442,18 @@ ipv6_get_signature (hicn_type_t type, hicn_protocol_t *h, uint8_t **signature) return CHILD_OPS (get_signature, type, h, signature); } +int +ipv6_is_last_data (hicn_type_t type, const hicn_protocol_t *h, int *is_last) +{ + return CHILD_OPS (is_last_data, type, h, is_last); +} + +int +ipv6_set_last_data (hicn_type_t type, hicn_protocol_t *h) +{ + return CHILD_OPS (set_last_data, type, h); +} + DECLARE_HICN_OPS (ipv6); /* |