summaryrefslogtreecommitdiffstats
path: root/clatd_test.cpp
Commit message (Collapse)AuthorAgeFilesLines
* cleanup - remove tun.hMaciej Żenczykowski2020-06-021-1/+0
| | | | | | | | | | | | | | Longer term we should probably just merge the clat_config and tun_data structs, but not just yet. Test: git grep '(^|[^_])tun[.]h' comes up empty Bug: 144730808 Test: atest clatd_test netd_integration_test Signed-off-by: Maciej Żenczykowski <maze@google.com> Change-Id: I7c3a986584aa3d02519545fb928457b61247ed14
* cleanup - read_config() and ipv4_local_prefixlenMaciej Żenczykowski2020-06-021-3/+1
| | | | | | | | | | | Test: git grep 'read_config|ipv4_local_prefixlen|default_pdp_interface' comes up empty Bug: 144730808 Test: atest clatd_test netd_integration_test Signed-off-by: Maciej Żenczykowski <maze@google.com> Change-Id: I67b70fe298f69ac51dfbc5daf4078b842fb62808
* cleanup - ipv6_host_id and is_dynamic_iidMaciej Żenczykowski2020-06-021-3/+0
| | | | | | | | | | | Test: git grep 'ipv6_host_id|is_dynamic_iid' comes up empty Bug: 144730808 Test: atest clatd_test netd_integration_test Signed-off-by: Maciej Żenczykowski <maze@google.com> Change-Id: Ie3ed4583a95f15165a05412a556bae99dc07706b
* Delete the clatd code that assigns IPv4 and IPv6 addresses.Lorenzo Colitti2020-06-011-174/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | The IPv4 and IPv6 address assignment code, and its tests, were migrated to ClatdController in Q, and this code has been unused since then. This code is not only unused, it also *should* never be used, because if it were, many parts of 464xlat on Android would not work as expected. This includes 464xlat BPF offload and data usage accounting, both of which require netd to know exactly which IPv4 and IPv6 addresses are used by clatd at any given time. Most of the code is deleted, but the function to generate random checksum-neutral IIDs was moved to the tests instead. This change does not delete the configuration file parsing code. That will be done in a follow-up CL. Bug: 144730808 Bug: 150738490 Test: atest clatd_test Test: atest netd_integration_test Test: IPv6-only wifi continues to work Change-Id: I8265e9bb04d44ed1dda445fa91881fcd1601dc47
* remove ClatdTest.ConfigureIpv6Addressandroid-r-preview-1Maciej Żenczykowski2020-01-301-20/+0
| | | | | | | | | | | | | This test isn't useful, because we always select the ipv6 address within netd and pass it in via cli. (and then we rename ClatdTest.ConfigureIpv6AddressCommandLine to ClatdTest.ConfigureIpv6Address) Test: builds Bug: 144730808 Signed-off-by: Maciej Żenczykowski <maze@google.com> Change-Id: I5dbf1cd2a253a48de187faafa7c259ceab7dba67
* Derive mtu from ipv6 route to ipv4 /96 prefix instead of deviceMaciej Żenczykowski2020-01-201-4/+7
| | | | | | | | | | | | | Test: builds, atest, still needs testing on real network x86 clatd_test -------------- clatd_test (19 Tests) ... [6/19] ClatdTest#DetectMtu: PASSED (0ms) ... Bug: 147935930 Signed-off-by: Maciej Żenczykowski <maze@google.com> Change-Id: I3d11ba082dabf70089867146acd84f6436953663
* external: android-clat: fix -Wreorder-init-listNick Desaulniers2019-11-191-2/+2
| | | | | | | | | | C++20 will require members in a designated initializer to be in order unlike C99. Bug: 139945549 Test: mm Change-Id: I5d94739894a5882f571c1e0ddf069725f0c246e8 Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
* make clat checksum tests more reliableMaciej Żenczykowski2019-11-101-2/+4
| | | | | | | | | This is to allow increasing pseudochecksum returned by 0xFFFF, which is another form of 16-bit 1's complement 0 and thus irrelevant. Test: builds, atest Signed-off-by: Maciej Żenczykowski <maze@google.com> Change-Id: I8cfa04ed1c0bdde2a605cff258a12690748f3bd5
* Move checksum code from clatd to libnetutils.Lorenzo Colitti2019-01-201-1/+1
| | | | | | | | | 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
* Allow passing in the IPv4 and IPv6 addresses on the command line.Lorenzo Colitti2019-01-151-9/+103
| | | | | | | | | | | | | 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
* Drop support for updating IPv6 addresses in clatd.Lorenzo Colitti2019-01-061-3/+34
| | | | | | | | | | | | | | | | | | | | 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
* Test clatd methods that affect interface IP addresses.Lorenzo Colitti2019-01-061-2/+60
| | | | | | | | | 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
* Re-indent clatd code with clang-formatjunyulai2018-12-111-119/+117
| | | | | | | | | | | clang-format --style file -i *.{c,h,cpp} Bug: 118848635 Test: 1. browse over ipv6-only network 2. atest clatd_test 3. clang-format --style file -i *.{c,h,cpp} Change-Id: I7389426101df7745370d0ac5c55176cd8fe2b08b
* Convert a few instances of sprintf to snprintf.android-wear-n-preview-2android-wear-n-preview-1android-wear-7.1.1_r1android-n-preview-5android-n-preview-4android-n-preview-3android-n-preview-2android-n-preview-1android-n-mr1-preview-2android-n-mr1-preview-1android-n-iot-preview-2nougat-mr1-wear-releasen-iot-preview-2George Burgess IV2016-02-241-4/+4
| | | | Change-Id: Ib3cdf8c3c817adc0eea0095ca4ef5fd66c8456b0
* am fee9afb1: Android-Clatd: Remove unused variableAndreas Gampe2014-11-251-3/+0
|\ | | | | | | | | * commit 'fee9afb1a5d9f7f5df0c79e29368c61d7da16fb8': Android-Clatd: Remove unused variable
| * Android-Clatd: Remove unused variableAndreas Gampe2014-11-241-3/+0
| | | | | | | | | | | | For build-system CFLAGS clean-up, fix unused-but-set variables. Change-Id: I3fc6b0d9bec87cd54d7b5199108cff576b4be677
* | am 2596f42a: Never use a statically-configured IID on wifi.Lorenzo Colitti2014-11-181-0/+6
|\ \ | | | | | | | | | | | | * commit '2596f42a4f4c42bfb96ccbfc2700dbf70502ec75': Never use a statically-configured IID on wifi.
| * | Never use a statically-configured IID on wifi.android-cts-5.1_r9android-cts-5.1_r8android-cts-5.1_r7android-cts-5.1_r6android-cts-5.1_r5android-cts-5.1_r4android-cts-5.1_r3android-cts-5.1_r28android-cts-5.1_r27android-cts-5.1_r26android-cts-5.1_r25android-cts-5.1_r24android-cts-5.1_r23android-cts-5.1_r22android-cts-5.1_r21android-cts-5.1_r20android-cts-5.1_r2android-cts-5.1_r19android-cts-5.1_r18android-cts-5.1_r17android-cts-5.1_r16android-cts-5.1_r15android-cts-5.1_r14android-cts-5.1_r13android-cts-5.1_r10android-cts-5.1_r1android-5.1.1_r9android-5.1.1_r8android-5.1.1_r7android-5.1.1_r6android-5.1.1_r5android-5.1.1_r4android-5.1.1_r38android-5.1.1_r37android-5.1.1_r36android-5.1.1_r35android-5.1.1_r34android-5.1.1_r33android-5.1.1_r30android-5.1.1_r3android-5.1.1_r29android-5.1.1_r28android-5.1.1_r26android-5.1.1_r25android-5.1.1_r24android-5.1.1_r23android-5.1.1_r22android-5.1.1_r20android-5.1.1_r2android-5.1.1_r19android-5.1.1_r18android-5.1.1_r17android-5.1.1_r16android-5.1.1_r15android-5.1.1_r14android-5.1.1_r13android-5.1.1_r12android-5.1.1_r10android-5.1.1_r1android-5.1.0_r5android-5.1.0_r4android-5.1.0_r3android-5.1.0_r1lollipop-mr1-wfc-releaselollipop-mr1-releaselollipop-mr1-fi-releaselollipop-mr1-devlollipop-mr1-cts-releaseLorenzo Colitti2014-11-101-0/+6
| | | | | | | | | | | | | | | Bug: 12111730 Change-Id: I062d81f2b65e6e89baae0f840cbd673f8051d523
* | | am 798f9934: Use different IPv4 addresses on different clat interfaces.Lorenzo Colitti2014-11-031-0/+53
|\| | | | | | | | | | | | | | * commit '798f9934fca523dfb57136bd185cf6e9460323ad': Use different IPv4 addresses on different clat interfaces.
| * | Use different IPv4 addresses on different clat interfaces.Lorenzo Colitti2014-11-011-0/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | am 9808952b: Generate a random IID if one is not specified.Lorenzo Colitti2014-10-301-6/+204
|\| | | |/ |/| | | | | * commit '9808952bdf2fa6ce4cbd790d1967691bb95bf327': Generate a random IID if one is not specified.
| * Generate a random IID if one is not specified.Lorenzo Colitti2014-10-281-6/+204
| | | | | | | | | | | | | | | | | | | | | | | | | | - 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
| * Use a raw socket to send IPv6 packets instead of a tun.Lorenzo Colitti2014-06-111-12/+25
| | | | | | | | | | | | | | This will allow us to bind the socket to a particular network. Bug: 15340961 Change-Id: I50857d372955f2b6f7035157c2968cda72c32585
| * Make translate_packet take a fd instead of a tun header.Lorenzo Colitti2014-06-101-6/+4
| | | | | | | | | | | | | | | | This will make it easier to use separate fds for reading and writing in a future change. Bug: 15340961 Change-Id: I5b081b05765cae0488ac599be5738ce9737cae41
* | Remove unused variables.Chih-Hung Hsieh2014-08-261-2/+1
| | | | | | | | | | BUG: 17281763 Change-Id: Ia9cbda2897e46ca757910d59d0cbb6de07d55482
* | Use a raw socket to send IPv6 packets instead of a tun.Lorenzo Colitti2014-06-131-12/+25
| | | | | | | | | | | | | | | | | | This will allow us to bind the socket to a particular network. (cherry picked from commit 10e8827d636a72a7bcdfd52d15bad9342ae2a0a6) Bug: 15340961 Change-Id: I0b62ef96364a90b9c0a9e3ac3ba97b5c19c89b69
* | Make translate_packet take a fd instead of a tun header.Lorenzo Colitti2014-06-131-6/+4
|/ | | | | | | | | | This will make it easier to use separate fds for reading and writing in a future change. (cherry picked from commit 91d0f1bc6dd24e54ed3caef9b08525b332ab0adf) Bug: 15340961 Change-Id: I374b85f28ae570dc82d21e1ea82a2f072fd7fba3
* Minor code clean-up for GCC 4.9.idea133-weekly-releaseBen Cheng2014-04-031-5/+5
| | | | | | | | | - 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
* Use uint8_t not char for binary data to avoid -Wall -Werror issues on x86 buildsBrian Carlstrom2014-02-241-51/+51
| | | | Change-Id: Ib61e67f15360c27c3ebf61f870a9482217c52357
* Add a unit test for 464xlat translation code.Lorenzo Colitti2014-02-221-0/+672
Bug: 11542311 Change-Id: Ibc7f156a6abb96c9bf4983ecd63b052fe308e422