diff options
author | Tobias Brunner <tobias@strongswan.org> | 2014-07-22 11:10:59 +0200 |
---|---|---|
committer | Tobias Brunner <tobias@strongswan.org> | 2014-07-22 11:14:00 +0200 |
commit | 1ddc1ec0b37355be22d55728557b88cde83292e6 (patch) | |
tree | 0c2eb284b44c121ca1b49d3d30dc71f9f42bf412 /src/libstrongswan/utils/chunk.h | |
parent | 32109a535f3f0ae3e234ebfefc7c69dfc2327c67 (diff) | |
parent | ffff7219ef6af21c9497af8db49bfb3c1c9a3036 (diff) | |
download | strongswan-1ddc1ec0b37355be22d55728557b88cde83292e6.tar.bz2 strongswan-1ddc1ec0b37355be22d55728557b88cde83292e6.tar.xz |
Merge branch 'android-dns-proxy'
Adds a DNS proxy feature that uses VPN-protected sockets to resolve the
VPN gateway's hostname while reestablishing the IKE_SA, which is
required because we keep the TUN device up to avoid leaking plaintext
traffic.
The TUN device is recreated without DNS servers before reestablishing in
case the VPN server pushed DNS servers to the client that are only
reachable via VPN.
Fixes #622.
Diffstat (limited to 'src/libstrongswan/utils/chunk.h')
-rw-r--r-- | src/libstrongswan/utils/chunk.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/libstrongswan/utils/chunk.h b/src/libstrongswan/utils/chunk.h index 9951ff31f..0daa2e1d0 100644 --- a/src/libstrongswan/utils/chunk.h +++ b/src/libstrongswan/utils/chunk.h @@ -412,6 +412,31 @@ u_int32_t chunk_hash_static_inc(chunk_t chunk, u_int32_t hash); u_int64_t chunk_mac(chunk_t chunk, u_char *key); /** + * Calculate the Internet Checksum according to RFC 1071 for the given chunk. + * + * If the result is used with chunk_internet_checksum_inc() and the data length + * is not a multiple of 16 bit the checksum bytes have to be swapped to + * compensate the even/odd alignment. + * + * @param chunk data to process + * @return checksum (one's complement, network order) + */ +u_int16_t chunk_internet_checksum(chunk_t data); + +/** + * Extend the given Internet Checksum (one's complement, in network byte order) + * with the given data. + * + * If data is not a multiple of 16 bits the checksum may have to be swapped to + * compensate even/odd alignment (see chunk_internet_checksum()). + * + * @param chunk data to process + * @param checksum previous checksum (one's complement, network order) + * @return checksum (one's complement, network order) + */ +u_int16_t chunk_internet_checksum_inc(chunk_t data, u_int16_t checksum); + +/** * printf hook function for chunk_t. * * Arguments are: |