summaryrefslogtreecommitdiffstats
path: root/lib/src/protocol
diff options
context:
space:
mode:
Diffstat (limited to 'lib/src/protocol')
-rw-r--r--lib/src/protocol/ah.c2
-rw-r--r--lib/src/protocol/ipv4.c2
-rw-r--r--lib/src/protocol/ipv6.c2
-rw-r--r--lib/src/protocol/tcp.c16
4 files changed, 11 insertions, 11 deletions
diff --git a/lib/src/protocol/ah.c b/lib/src/protocol/ah.c
index c1395dee8..8bd9bca83 100644
--- a/lib/src/protocol/ah.c
+++ b/lib/src/protocol/ah.c
@@ -163,7 +163,7 @@ int
ah_set_signature_size (hicn_type_t type, hicn_protocol_t * h,
const size_t signature_size)
{
- h->ah.payloadlen = signature_size >> 2;
+ h->ah.payloadlen = (u8)(signature_size >> 2);
return HICN_LIB_ERROR_NONE;
}
diff --git a/lib/src/protocol/ipv4.c b/lib/src/protocol/ipv4.c
index 4e4c47f5b..97aafaeaf 100644
--- a/lib/src/protocol/ipv4.c
+++ b/lib/src/protocol/ipv4.c
@@ -383,7 +383,7 @@ ipv4_set_payload_length (hicn_type_t type, hicn_protocol_t * h,
int rc = CHILD_OPS (get_header_length, type, h, &child_header_length);
if (rc < 0)
return rc;
- h->ipv4.len = htons (payload_length + IPV4_HDRLEN + child_header_length);
+ h->ipv4.len = htons ((u_short) (payload_length + IPV4_HDRLEN + child_header_length));
return HICN_LIB_ERROR_NONE;
}
diff --git a/lib/src/protocol/ipv6.c b/lib/src/protocol/ipv6.c
index 1cdcc75c0..7554eadf2 100644
--- a/lib/src/protocol/ipv6.c
+++ b/lib/src/protocol/ipv6.c
@@ -341,7 +341,7 @@ ipv6_set_payload_length (hicn_type_t type, hicn_protocol_t * h,
int rc = CHILD_OPS (get_header_length, type, h, &child_header_length);
if (rc < 0)
return rc;
- h->ipv6.len = htons (payload_length + child_header_length);
+ h->ipv6.len = htons ( (u_short) (payload_length + child_header_length));
return HICN_LIB_ERROR_NONE;
}
diff --git a/lib/src/protocol/tcp.c b/lib/src/protocol/tcp.c
index bbe25fc6d..08b7bde8a 100644
--- a/lib/src/protocol/tcp.c
+++ b/lib/src/protocol/tcp.c
@@ -247,10 +247,10 @@ tcp_rewrite_interest (hicn_type_t type, hicn_protocol_t * h,
* csum = ip_csum_sub_even (*tcp_checksum, h->ipv4.saddr.as_u32);
* csum = ip_csum_add_even (csum, h->ipv4.saddr.as_u32);
*/
- u16 csum = ip_csum_sub_even (*tcp_checksum, h->ipv6.saddr.as_u64[0]);
- csum = ip_csum_sub_even (csum, h->ipv6.saddr.as_u64[1]);
- csum = ip_csum_add_even (csum, h->ipv6.saddr.as_u64[0]);
- csum = ip_csum_add_even (csum, h->ipv6.saddr.as_u64[1]);
+ u16 csum = ip_csum_sub_even (*tcp_checksum, (ip_csum_t) (h->ipv6.saddr.as_u64[0]));
+ csum = ip_csum_sub_even (csum, (ip_csum_t) (h->ipv6.saddr.as_u64[1]));
+ csum = ip_csum_add_even (csum, (ip_csum_t) (h->ipv6.saddr.as_u64[0]));
+ csum = ip_csum_add_even (csum, (ip_csum_t) (h->ipv6.saddr.as_u64[1]));
*tcp_checksum = ip_csum_fold (csum);
@@ -272,10 +272,10 @@ tcp_rewrite_data (hicn_type_t type, hicn_protocol_t * h,
* csum = ip_csum_sub_even (*tcp_checksum, h->ipv4.saddr.as_u32);
* csum = ip_csum_add_even (csum, h->ipv4.saddr.as_u32);
*/
- u16 csum = ip_csum_sub_even (*tcp_checksum, addr_old->ip6.as_u64[0]);
- csum = ip_csum_sub_even (*tcp_checksum, addr_old->ip6.as_u64[1]);
- csum = ip_csum_add_even (csum, addr_new->ip6.as_u64[0]);
- csum = ip_csum_add_even (csum, addr_new->ip6.as_u64[1]);
+ u16 csum = ip_csum_sub_even (*tcp_checksum, (ip_csum_t) (addr_old->ip6.as_u64[0]));
+ csum = ip_csum_sub_even (*tcp_checksum, (ip_csum_t) (addr_old->ip6.as_u64[1]));
+ csum = ip_csum_add_even (csum, (ip_csum_t) (addr_new->ip6.as_u64[0]));
+ csum = ip_csum_add_even (csum, (ip_csum_t) (addr_new->ip6.as_u64[1]));
csum = ip_csum_sub_even (csum, h->tcp.pathlabel);
tcp_update_data_pathlabel (type, h, face_id);