aboutsummaryrefslogtreecommitdiff
path: root/src/tun
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-01-25 23:03:25 +0000
committerChristian Grothoff <christian@grothoff.org>2012-01-25 23:03:25 +0000
commita925c1e3ff05dd7f32ff2acd9c761661e31803ba (patch)
tree7db00197cf7b4fc2bea06c3e3b020fec33e9dbba /src/tun
parent984cd842482b352da2969233f134b8c8ee565b71 (diff)
-fix IP header length calculations for IPv6
Diffstat (limited to 'src/tun')
-rw-r--r--src/tun/tun.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/tun/tun.c b/src/tun/tun.c
index 12781798cf..5086f827ef 100644
--- a/src/tun/tun.c
+++ b/src/tun/tun.c
@@ -89,7 +89,7 @@ GNUNET_TUN_initialize_ipv6_header (struct GNUNET_TUN_IPv6Header *ip,
ip->traffic_class_l = 0;
ip->flow_label = 0;
ip->next_header = protocol;
- ip->payload_length = htons ((uint16_t) (payload_length + sizeof (struct GNUNET_TUN_IPv6Header)));
+ ip->payload_length = htons ((uint16_t) payload_length);
ip->hop_limit = FRESH_TTL;
ip->destination_address = *dst;
ip->source_address = *src;
@@ -146,7 +146,7 @@ GNUNET_TUN_calculate_tcp6_checksum (const struct GNUNET_TUN_IPv6Header *ip,
uint32_t sum;
uint32_t tmp;
- GNUNET_assert (payload_length + sizeof (struct GNUNET_TUN_IPv6Header) + sizeof (struct GNUNET_TUN_TcpHeader) ==
+ GNUNET_assert (payload_length + sizeof (struct GNUNET_TUN_TcpHeader) ==
ntohs (ip->payload_length));
GNUNET_assert (IPPROTO_TCP == ip->next_header);
tcp->crc = 0;
@@ -222,7 +222,7 @@ GNUNET_TUN_calculate_udp6_checksum (const struct GNUNET_TUN_IPv6Header *ip,
uint32_t sum;
uint32_t tmp;
- GNUNET_assert (payload_length + sizeof (struct GNUNET_TUN_IPv6Header) + sizeof (struct GNUNET_TUN_UdpHeader) ==
+ GNUNET_assert (payload_length + sizeof (struct GNUNET_TUN_UdpHeader) ==
ntohs (ip->payload_length));
GNUNET_assert (payload_length + sizeof (struct GNUNET_TUN_UdpHeader) ==
ntohs (udp->len));