summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaciej Żenczykowski <maze@google.com>2020-04-01 21:09:13 +0000
committerMaciej Zenczykowski <maze@google.com>2020-04-02 00:10:09 +0000
commit073e80cb39fb1408edacdd413d8c5f3f889d69fb (patch)
tree0a6dc948192340a8bc774defa8bba3c56e9f9a62
parent947fe52a8bfb68409d22b198b6ea0bdf4175c706 (diff)
downloadplatform_external_android-clat-073e80cb39fb1408edacdd413d8c5f3f889d69fb.tar.gz
platform_external_android-clat-073e80cb39fb1408edacdd413d8c5f3f889d69fb.tar.bz2
platform_external_android-clat-073e80cb39fb1408edacdd413d8c5f3f889d69fb.zip
clatd: don't 'pretend' to disable IPV6_CHECKSUM
This code is not needed. The comment doesn't match the functionality as implemented: 0 means *ON* at offset 0 - not clear when this would make sense. 2 means on at offset 2 - this would be correct for IPPROTO_ICMPV6 4 means on at offset 4 - thus would be correct for IPPROTO_MH -1 would actually mean off, but that's also the socket creation default. In practice this doesn't even matter, because this socket is used only for transmit and sockets like this one which are created via socket(AF_INET6, SOCK_RAW, IPPROTO_RAW) default to having IPV6_HDRINCL enabled which doesn't even support transmit checksum calculation. This is because on a header inclusive RAW6 socket rawv6_sendmsg (which is the core implementation for all write operations on AF_INET6 raw sockets) calls into rawv6_send_hdrinc instead of ip6_append_data and ip6_flush_pending_frames/rawv6_push_pending_frames and simply never even references the socket field that the IPV6_CHECKSUM socket option changes (easy to check by checking accesses to raw6_sk(sk)->checksum). Also: it would be hard to make it support it due to checksum offset being protocol dependent and thus not even a constant on all protocol capable (ie. IPPROTO_RAW) sockets. Test: built, flashed to flame verified ipv4 clat functionality with no offload Bug: 150730674 Signed-off-by: Maciej Żenczykowski <maze@google.com> Change-Id: I62990f427c24cf62a38bd63d5c9d9dea4f0dc2f6 Merged-In: I62990f427c24cf62a38bd63d5c9d9dea4f0dc2f6
-rw-r--r--clatd.c4
1 files changed, 0 insertions, 4 deletions
diff --git a/clatd.c b/clatd.c
index 82df63d..54fc2f7 100644
--- a/clatd.c
+++ b/clatd.c
@@ -237,10 +237,6 @@ void open_sockets(struct tun_data *tunnel, uint32_t mark) {
exit(1);
}
- int off = 0;
- if (setsockopt(rawsock, SOL_IPV6, IPV6_CHECKSUM, &off, sizeof(off)) < 0) {
- logmsg(ANDROID_LOG_WARN, "could not disable checksum on raw socket: %s", strerror(errno));
- }
if (mark != MARK_UNSET && setsockopt(rawsock, SOL_SOCKET, SO_MARK, &mark, sizeof(mark)) < 0) {
logmsg(ANDROID_LOG_ERROR, "could not set mark on raw socket: %s", strerror(errno));
}