Name Date Size #Lines LOC

..--

rootfs/H25-Apr-2025-1,295840

.gitignoreH A D25-Apr-202524 32

Android.bpH A D25-Apr-2025981 4946

OWNERSH A D25-Apr-2025221 75

READMEH A D25-Apr-20252.6 KiB7851

TEST_MAPPINGH A D25-Apr-2025152 1312

all_tests.pyH A D25-Apr-20252.7 KiB10268

all_tests.shH A D25-Apr-20252.5 KiB11779

all_tests_gki.pyH A D25-Apr-2025821 289

anycast_test.pyH A D25-Apr-20253.4 KiB12370

bpf.pyH A D25-Apr-202511.4 KiB420296

bpf_test.pyH A D25-Apr-202524.3 KiB662459

build_rootfs.shH A D25-Apr-202520.3 KiB564443

csocket.pyH A D25-Apr-202511.1 KiB374255

csocket_test.pyH A D25-Apr-20252.7 KiB9558

cstruct.pyH A D25-Apr-202510.7 KiB304211

cstruct_test.pyH A D25-Apr-20257.7 KiB197144

genetlink.pyH A D25-Apr-20253.9 KiB12571

gki.pyH A D25-Apr-2025665 191

iproute.pyH A D25-Apr-202529.3 KiB840644

kernel_feature_test.pyH A D25-Apr-20253 KiB10264

leak_test.pyH A D25-Apr-20252.7 KiB8742

multinetwork_base.pyH A D25-Apr-202527.7 KiB797567

multinetwork_test.pyH A D25-Apr-202558.1 KiB1,5471,065

namespace.pyH A D25-Apr-20255.7 KiB176111

neighbour_test.pyH A D25-Apr-202513.5 KiB384264

net_test.pyH A D25-Apr-202516.7 KiB576398

net_test.shH A D25-Apr-20255.9 KiB202117

netlink.pyH A D25-Apr-20259.6 KiB311202

netlink_test.pyH A D25-Apr-20251.3 KiB4319

nf_test.pyH A D25-Apr-20252.8 KiB8844

no_testH A D25-Apr-202512 20

packets.pyH A D25-Apr-20257.2 KiB204155

parallel_tests.shH A D25-Apr-20251.4 KiB6344

parameterization_test.pyH A D25-Apr-20252.5 KiB8444

ping6_test.pyH A D25-Apr-202532 KiB919672

ping6_test.shH A D25-Apr-2025266 175

policy_crash_test.pyH A D25-Apr-20254.9 KiB13745

resilient_rs_test.pyH A D25-Apr-20255.6 KiB178108

run_net_test.shH A D25-Apr-202517.6 KiB501343

sock_diag.pyH A D25-Apr-202514.5 KiB433328

sock_diag_test.pyH A D25-Apr-202544.4 KiB1,179883

srcaddr_selection_test.pyH A D25-Apr-202515.1 KiB379224

sysctls_test.pyH A D25-Apr-20251.6 KiB4721

tcp_fastopen_test.pyH A D25-Apr-20254.7 KiB14191

tcp_metrics.pyH A D25-Apr-20254.5 KiB13993

tcp_nuke_addr_test.pyH A D25-Apr-20253.4 KiB11273

tcp_repair_test.pyH A D25-Apr-202511.8 KiB342245

tcp_test.pyH A D25-Apr-20255.1 KiB155104

tun_twister.pyH A D25-Apr-20257.3 KiB215159

util.pyH A D25-Apr-20253.2 KiB9452

vts_kernel_net_tests.xmlH A D25-Apr-20251.4 KiB3114

xfrm.pyH A D25-Apr-202527.5 KiB772554

xfrm_algorithm_test.pyH A D25-Apr-202515.4 KiB410290

xfrm_base.pyH A D25-Apr-202511.2 KiB331222

xfrm_test.pyH A D25-Apr-202541.4 KiB1,012683

xfrm_tunnel_test.pyH A D25-Apr-202544.3 KiB1,140756

README

1                                net_test v0.1
2                                =============
3
4A simple framework for blackbox testing of kernel networking code.
5
6
7Why use it?
8===========
9
10- Fast test / boot cycle.
11- Access to host filesystem and networking via L2 bridging.
12- Full Linux userland including Python, etc.
13- Kernel bugs don't crash the system.
14
15
16How to use it
17=============
18
19cd <kerneldir>
20path/to/net_test/run_net_test.sh <test>
21
22where <test> is the name of a test binary in the net_test directory. This can
23be an x86 binary, a shell script, a Python script. etc.
24
25
26How it works
27============
28
29net_test compiles the kernel to a user-mode linux binary, which runs as a
30process on the host machine. It runs the binary to start a Linux "virtual
31machine" whose root filesystem is the supplied Debian disk image. The machine
32boots, mounts the root filesystem read-only, runs the specified test from init, and then drops to a shell.
33
34
35Access to host filesystem
36=========================
37
38The VM mounts the host filesystem at /host, so the test can be modified and
39re-run without rebooting the VM.
40
41
42Access to host networking
43=========================
44
45Access to host networking is provided by tap interfaces. On the host, the
46interfaces are named <user>TAP0, <user>TAP1, etc., where <user> is the first
4710 characters of the username running net_test. (10 characters because
48IFNAMSIZ = 16). On the guest, they are named eth0, eth1, etc.
49
50net_test does not do any networking setup beyond creating the tap interfaces.
51IP connectivity can be provided on the host side by setting up a DHCP server
52and NAT, sending IPv6 router advertisements, etc. By default, the VM has IPv6
53privacy addresses disabled, so its IPv6 addresses can be predicted using a tool
54such as ipv6calc.
55
56The provided filesystem contains a DHCPv4 client and simple networking
57utilities such as ping[6], traceroute[6], and wget.
58
59The number of tap interfaces is currently hardcoded to two. To change this
60number, modify run_net_test.sh.
61
62
63Logging into the VM, installing packages, etc.
64==============================================
65
66net_test mounts the root filesystem read-only, and runs the test from init, but
67since the filesystem contains a full Linux userland, it's possible to boot into
68userland and modify the filesystem, for example to install packages using
69apt-get install. Log in as root with no password. By default, the filesystem is
70configured to perform DHCPv4 on eth0 and listen to RAs.
71
72
73Bugs
74====
75
76Since the test mounts the filesystem read-only, tests cannot modify
77/etc/resolv.conf and the system resolver is hardcoded to 8.8.8.8.
78