This allows us to use it elsewhere, for example, in netd.
Bug: 65674744
Test: builds, boots
Test: atest clatd_test clatd_microbenchmark
Change-Id: Ic2cea1cd658ffd23ba9fbe45cb6b28e3b5312005
Lorenzo Colitticommited 2019-01-20 12:08:33 +09:00
This allows the address to be determined by netd and passed in,
which makes it possible for the rest of the OS to know what the
clatd IPv6 address is.
Bug: 65674744
Test: atest clatd_test
Test: IPv4 on IPv6-only networks continues to work
Test: clatd continues to avoid existing IPv4 addresses in 192.0.0.0/29
Test: passing NAT64 prefix, IPv4/IPv6 addresses on command line works
Change-Id: I8519c2f01b44022ef036c80aa0df32cd76003055
Lorenzo Colitticommited 2019-01-15 13:33:36 +09:00
Currently, when clatd detects that the IPv6 address on its
interface has changed, it updates its configuration accordingly.
This complicates the code, and it prevents us from determining
the IPv6 address in netd instead of clatd.
Stop doing this, and simply exit instead. The framework will
notice that the interface is gone and restart clatd, which will
then have the correct configuration (and, unlike current code,
the correct NAT64 prefix, if that has changed as well).
This change also allows us to drop CAP_NET_ADMIN and run clatd
as an unprivileged user with no capabilities.
Test: atest clatd_test
Test: changing IPv6 address on interface causes clatd to exit
Test: "adb shell cat /proc/$(adb shell pidof clatd)/status | grep Cap"
Change-Id: I296dcb185f603f685223b24ffefdf7a5c22b66e6
Lorenzo Colitticommited 2019-01-06 11:22:16 +09:00
Depend on tun_interface so we can add tests to clatd_test that
use a real interface instead of mocking everything out. Add a
simple test for determining the clat IPv6 address.
Test: atest clatd_test
Change-Id: I1f10c372388a7c663bebab3c45b206036a264673
Lorenzo Colitticommited 2019-01-06 11:22:16 +09:00
Previously the code would use 192.0.0.4 on all clat interfaces.
This works, but it has the problem when a clat interface goes
down, we do not reset TCP connections on its IP address if there
is another clat interface up.
Fix this by assigning every clat interface its own IP address in
192.0.0.0/29.
Bug: 12111730
Change-Id: I28c831acd93b0980efea8e90c1cdf8b607beac68
Lorenzo Colitticommited 2014-11-01 01:17:22 +09:00
- Add code to generate a random IPv6 address that's
checksum-neutral with the NAT64 prefix and clat IPv4 address.
- Only calculate the IP address after the NAT64 prefix is known.
- Because the clat IPv6 address is no longer determinisitic,
modify interface_poll so it checks whether the prefix has
changed instead of checking whether the IPv6 address has
changed.
- Add/update unit tests.
Change-Id: Ia53716ca5315ebdd0eaa3ad3a07552bf18e9dd5c
Lorenzo Colitticommited 2014-10-28 15:30:45 +09:00
This will allow us to bind the socket to a particular network.
(cherry picked from commit 10e8827d63)
Bug: 15340961
Change-Id: I0b62ef96364a90b9c0a9e3ac3ba97b5c19c89b69
Lorenzo Colitticommited 2014-06-13 11:47:50 +09:00
This will make it easier to use separate fds for reading and
writing in a future change.
(cherry picked from commit 91d0f1bc6d)
Bug: 15340961
Change-Id: I374b85f28ae570dc82d21e1ea82a2f072fd7fba3
Lorenzo Colitticommited 2014-06-13 11:47:42 +09:00
This will make it easier to use separate fds for reading and
writing in a future change.
Bug: 15340961
Change-Id: I5b081b05765cae0488ac599be5738ce9737cae41
Lorenzo Colitticommited 2014-06-10 21:32:52 +09:00
- Tidy up "signed vs unsigned" comparison
- Unconditionally initialize the "protocol" variable. This is a
false-positive warning as protocol is indeed initialized when used,
but GCC failed to detect the dependency between protocol and ip6.
Change-Id: I8146898d91d45531c3de73403e0df3330c0a2043