Add ip6 dummy address to keep data usage stats consistent.
Because of the way the tunnel pumps packets into the networking
stack, the netfilter xt_qtaguid module can't track stats
accurately: the totals don't add up.
With "clat" having an ip address, qtaguid will track stats
against it, which then can be deducted from the external iface.
Bug: 11687690
Change-Id: I22ebf26dd9249e821da87665d2bfb0e54d3cdf64
diff --git a/clatd.c b/clatd.c
index 063026d..26ecb57 100644
--- a/clatd.c
+++ b/clatd.c
@@ -205,6 +205,13 @@
exit(1);
}
+ status = add_address(tunnel->device6, AF_INET6, &Global_Clatd_Config.ipv6_local_address,
+ 64, NULL);
+ if(status < 0) {
+ logmsg(ANDROID_LOG_FATAL,"configure_tun_ip/if_address(6) failed: %s",strerror(-status));
+ exit(1);
+ }
+
if((status = if_up(tunnel->device6, Global_Clatd_Config.mtu)) < 0) {
logmsg(ANDROID_LOG_FATAL,"configure_tun_ip/if_up(6) failed: %s",strerror(-status));
exit(1);
@@ -470,7 +477,7 @@
// open the tunnel device before dropping privs
tunnel.fd6 = tun_open();
if(tunnel.fd6 < 0) {
- logmsg(ANDROID_LOG_FATAL, "tun_open failed: %s", strerror(errno));
+ logmsg(ANDROID_LOG_FATAL, "tun_open6 failed: %s", strerror(errno));
exit(1);
}