diff options
author | Alberto Compagno <acompagn+fdio@cisco.com> | 2019-02-08 12:00:25 +0100 |
---|---|---|
committer | Alberto Compagno <acompagn+fdio@cisco.com> | 2019-02-08 12:04:36 +0100 |
commit | 1e1d08d94bb39e2de79d7182e5598fc5fa5e9fce (patch) | |
tree | 6bef6d8f845b4fb979901f5b58174a210020eeac | |
parent | db1afad8749fce983636456c16c9df9c24d73af4 (diff) |
[HICN-43] Fixed packet lifetime and setting AH flag when a data packet carries a signature
Change-Id: I5e14716bc9bfcd8ffc3ab8cda8aa9ba0ca5c6d82
Signed-off-by: Alberto Compagno <acompagn+fdio@cisco.com>
-rw-r--r-- | lib/src/base.h | 4 | ||||
-rw-r--r-- | lib/src/compat.c | 2 | ||||
-rw-r--r-- | lib/src/protocol/tcp.c | 8 | ||||
-rw-r--r-- | libtransport/src/hicn/transport/core/packet.cc | 4 | ||||
-rw-r--r-- | libtransport/src/hicn/transport/interfaces/socket_options_default_values.h | 6 |
5 files changed, 14 insertions, 10 deletions
diff --git a/lib/src/base.h b/lib/src/base.h index 0fcf2a9c2..d8a79a9c2 100644 --- a/lib/src/base.h +++ b/lib/src/base.h @@ -30,9 +30,9 @@ typedef u32 hicn_faceid_t; typedef u8 hicn_pathlabel_t; typedef u32 hicn_lifetime_t; -#define HICN_MAX_LIFETIME HICN_MAX_LIFETIME_SCALED << HICN_MAX_LIFETIME_MULTIPLIER #define HICN_MAX_LIFETIME_SCALED 0xFFFF -#define HICN_MAX_LIFETIME_MULTIPLIER 0xF /* 4 bits */ +#define HICN_MAX_LIFETIME_MULTIPLIER 0x0F /* 4 bits */ +#define HICN_MAX_LIFETIME HICN_MAX_LIFETIME_SCALED << HICN_MAX_LIFETIME_MULTIPLIER /** * @brief hICN packet format type diff --git a/lib/src/compat.c b/lib/src/compat.c index 56504fe5e..fba826ab0 100644 --- a/lib/src/compat.c +++ b/lib/src/compat.c @@ -1137,7 +1137,7 @@ int hicn_data_reset_for_hash (hicn_format_t format, hicn_header_t * packet) { hicn_type_t type = hicn_format_to_type (format); - return hicn_ops_vft[type.l1]->reset_interest_for_hash (type, + return hicn_ops_vft[type.l1]->reset_data_for_hash (type, &packet->protocol); } diff --git a/lib/src/protocol/tcp.c b/lib/src/protocol/tcp.c index 08a1c73ef..92ded5c29 100644 --- a/lib/src/protocol/tcp.c +++ b/lib/src/protocol/tcp.c @@ -58,6 +58,10 @@ tcp_init_packet_header (hicn_type_t type, hicn_protocol_t * h) TCP_DEFAULT_SYN << 1 | TCP_DEFAULT_FIN << 0,.window = htons (TCP_DEFAULT_WINDOW_SIZE),.csum = 0,.urg_ptr = 65000,}; + uint8_t ah_flag = type.l2 == IPPROTO_AH ? AH_FLAG : ~AH_FLAG; + + h->tcp.flags |= ah_flag; + return CHILD_OPS (init_packet_header, type, h); } @@ -166,7 +170,7 @@ tcp_set_lifetime (hicn_type_t type, hicn_protocol_t * h, h->tcp.urg_ptr = htons (HICN_MAX_LIFETIME_SCALED); h->tcp.data_offset_and_reserved = (h-> - tcp.data_offset_and_reserved & ~0xF) | HICN_MAX_LIFETIME_MULTIPLIER; + tcp.data_offset_and_reserved & ~0x0F) | HICN_MAX_LIFETIME_MULTIPLIER; return HICN_LIB_ERROR_NONE; } @@ -179,7 +183,7 @@ tcp_set_lifetime (hicn_type_t type, hicn_protocol_t * h, h->tcp.urg_ptr = htons (lifetime_scaled); h->tcp.data_offset_and_reserved = - (h->tcp.data_offset_and_reserved & ~0xF) | multiplier; + (h->tcp.data_offset_and_reserved & ~0x0F) | multiplier; return HICN_LIB_ERROR_NONE; } diff --git a/libtransport/src/hicn/transport/core/packet.cc b/libtransport/src/hicn/transport/core/packet.cc index 3872510ec..cbfe082d3 100644 --- a/libtransport/src/hicn/transport/core/packet.cc +++ b/libtransport/src/hicn/transport/core/packet.cc @@ -58,7 +58,7 @@ Packet::Packet(MemBufPtr &&buffer) auto header_size = getHeaderSizeFromFormat(format_, signature_size); - auto payload_length = packet_->length() - header_size - signature_size; + auto payload_length = packet_->length() - header_size; if (!payload_length) { return; @@ -69,7 +69,7 @@ Packet::Packet(MemBufPtr &&buffer) if (payload_length) { auto payload = packet_->cloneOne(); payload_head_ = payload.get(); - payload_head_->advance(header_size + signature_size); + payload_head_->advance(header_size); payload_head_->append(payload_length); packet_->prependChain(std::move(payload)); packet_->append(header_size); diff --git a/libtransport/src/hicn/transport/interfaces/socket_options_default_values.h b/libtransport/src/hicn/transport/interfaces/socket_options_default_values.h index 5fae1c484..b4ff44f1e 100644 --- a/libtransport/src/hicn/transport/interfaces/socket_options_default_values.h +++ b/libtransport/src/hicn/transport/interfaces/socket_options_default_values.h @@ -15,6 +15,7 @@ #pragma once +#include <hicn/base.h> #include <chrono> #include <cstdint> @@ -25,8 +26,8 @@ namespace interface { namespace default_values { const uint32_t interest_lifetime = 1001; // milliseconds -const uint32_t content_object_expiry_time = - 0xffff; // milliseconds -> 50 seconds +const uint32_t never_expire_time = HICN_MAX_LIFETIME; +const uint32_t content_object_expiry_time = never_expire_time; // milliseconds -> 50 seconds const uint32_t content_object_packet_size = 1500; // The ethernet MTU const uint32_t producer_socket_input_buffer_size = 150000; // Interests const uint32_t producer_socket_output_buffer_size = 150000; // Content Object @@ -38,7 +39,6 @@ const uint32_t min_window_size = 1; // Interests const uint32_t max_window_size = 128000; // Interests const uint32_t digest_size = 34; // bytes const uint32_t max_out_of_order_segments = 3; // content object -const uint32_t never_expire_time = 0x0000ffff << 0x0f; // RAAQM const int sample_number = 30; |