diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-01-25 23:03:25 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-01-25 23:03:25 +0000 |
commit | a925c1e3ff05dd7f32ff2acd9c761661e31803ba (patch) | |
tree | 7db00197cf7b4fc2bea06c3e3b020fec33e9dbba /src/tun | |
parent | 984cd842482b352da2969233f134b8c8ee565b71 (diff) | |
download | gnunet-a925c1e3ff05dd7f32ff2acd9c761661e31803ba.tar.gz gnunet-a925c1e3ff05dd7f32ff2acd9c761661e31803ba.zip |
-fix IP header length calculations for IPv6
Diffstat (limited to 'src/tun')
-rw-r--r-- | src/tun/tun.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/tun/tun.c b/src/tun/tun.c index 12781798c..5086f827e 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, | |||
89 | ip->traffic_class_l = 0; | 89 | ip->traffic_class_l = 0; |
90 | ip->flow_label = 0; | 90 | ip->flow_label = 0; |
91 | ip->next_header = protocol; | 91 | ip->next_header = protocol; |
92 | ip->payload_length = htons ((uint16_t) (payload_length + sizeof (struct GNUNET_TUN_IPv6Header))); | 92 | ip->payload_length = htons ((uint16_t) payload_length); |
93 | ip->hop_limit = FRESH_TTL; | 93 | ip->hop_limit = FRESH_TTL; |
94 | ip->destination_address = *dst; | 94 | ip->destination_address = *dst; |
95 | ip->source_address = *src; | 95 | ip->source_address = *src; |
@@ -146,7 +146,7 @@ GNUNET_TUN_calculate_tcp6_checksum (const struct GNUNET_TUN_IPv6Header *ip, | |||
146 | uint32_t sum; | 146 | uint32_t sum; |
147 | uint32_t tmp; | 147 | uint32_t tmp; |
148 | 148 | ||
149 | GNUNET_assert (payload_length + sizeof (struct GNUNET_TUN_IPv6Header) + sizeof (struct GNUNET_TUN_TcpHeader) == | 149 | GNUNET_assert (payload_length + sizeof (struct GNUNET_TUN_TcpHeader) == |
150 | ntohs (ip->payload_length)); | 150 | ntohs (ip->payload_length)); |
151 | GNUNET_assert (IPPROTO_TCP == ip->next_header); | 151 | GNUNET_assert (IPPROTO_TCP == ip->next_header); |
152 | tcp->crc = 0; | 152 | tcp->crc = 0; |
@@ -222,7 +222,7 @@ GNUNET_TUN_calculate_udp6_checksum (const struct GNUNET_TUN_IPv6Header *ip, | |||
222 | uint32_t sum; | 222 | uint32_t sum; |
223 | uint32_t tmp; | 223 | uint32_t tmp; |
224 | 224 | ||
225 | GNUNET_assert (payload_length + sizeof (struct GNUNET_TUN_IPv6Header) + sizeof (struct GNUNET_TUN_UdpHeader) == | 225 | GNUNET_assert (payload_length + sizeof (struct GNUNET_TUN_UdpHeader) == |
226 | ntohs (ip->payload_length)); | 226 | ntohs (ip->payload_length)); |
227 | GNUNET_assert (payload_length + sizeof (struct GNUNET_TUN_UdpHeader) == | 227 | GNUNET_assert (payload_length + sizeof (struct GNUNET_TUN_UdpHeader) == |
228 | ntohs (udp->len)); | 228 | ntohs (udp->len)); |