diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-01-17 19:39:52 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-01-17 19:39:52 +0000 |
commit | a1d0953d72d75d3fa53a308dd19e1e1bec371b53 (patch) | |
tree | 7de9ae93ccde2ec4ccaf11b590d9ec5c339e26a6 /src/vpn | |
parent | e0d8c3f1c05ab0cb218d7182c723298f7e981b58 (diff) | |
download | gnunet-a1d0953d72d75d3fa53a308dd19e1e1bec371b53.tar.gz gnunet-a1d0953d72d75d3fa53a308dd19e1e1bec371b53.zip |
-move IPv6-TCP checksum calculation to tun library
Diffstat (limited to 'src/vpn')
-rw-r--r-- | src/vpn/gnunet-service-vpn.c | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/src/vpn/gnunet-service-vpn.c b/src/vpn/gnunet-service-vpn.c index b352e216b..0d236975e 100644 --- a/src/vpn/gnunet-service-vpn.c +++ b/src/vpn/gnunet-service-vpn.c | |||
@@ -1643,20 +1643,10 @@ receive_tcp_back (void *cls GNUNET_UNUSED, struct GNUNET_MESH_Tunnel *tunnel, | |||
1643 | &ts->source_ip.v6); | 1643 | &ts->source_ip.v6); |
1644 | tcp->spt = htons (ts->destination_port); | 1644 | tcp->spt = htons (ts->destination_port); |
1645 | tcp->dpt = htons (ts->source_port); | 1645 | tcp->dpt = htons (ts->source_port); |
1646 | tcp->crc = 0; | 1646 | GNUNET_TUN_calculate_tcp6_checksum (ipv6, |
1647 | { | 1647 | tcp, |
1648 | uint32_t sum = 0; | 1648 | &tcp[1], |
1649 | uint32_t tmp; | 1649 | mlen); |
1650 | |||
1651 | sum = GNUNET_CRYPTO_crc16_step (sum, &ipv6->source_address, 2 * sizeof (struct in6_addr)); | ||
1652 | tmp = htonl (sizeof (struct GNUNET_TUN_TcpHeader) + mlen); | ||
1653 | sum = GNUNET_CRYPTO_crc16_step (sum, &tmp, sizeof (uint32_t)); | ||
1654 | tmp = htonl (IPPROTO_TCP); | ||
1655 | sum = GNUNET_CRYPTO_crc16_step (sum, &tmp, sizeof (uint32_t)); | ||
1656 | sum = GNUNET_CRYPTO_crc16_step (sum, tcp, | ||
1657 | sizeof (struct GNUNET_TUN_TcpHeader) + mlen); | ||
1658 | tcp->crc = GNUNET_CRYPTO_crc16_finish (sum); | ||
1659 | } | ||
1660 | (void) GNUNET_HELPER_send (helper_handle, | 1650 | (void) GNUNET_HELPER_send (helper_handle, |
1661 | msg, | 1651 | msg, |
1662 | GNUNET_YES, | 1652 | GNUNET_YES, |