• Home
Name Date Size #Lines LOC

..--

rootfs/03-May-2024-262140

.gitignoreD03-May-202424 32

Android.bpD03-May-20241.1 KiB4036

OWNERSD03-May-202435 32

READMED03-May-20242.6 KiB7851

all_tests.pyD03-May-20242.1 KiB7347

all_tests.shD03-May-20242.5 KiB11779

anycast_test.pyD03-May-20243.4 KiB12168

bpf.pyD03-May-20249.5 KiB365256

bpf_test.pyD03-May-202422 KiB601430

build_all_rootfs.shD03-May-2024776 277

build_rootfs.shD03-May-20243.8 KiB159106

csocket.pyD03-May-202411.1 KiB374255

csocket_test.pyD03-May-20242.7 KiB9558

cstruct.pyD03-May-20249.4 KiB279200

cstruct_test.pyD03-May-20247.3 KiB190138

forwarding_test.pyD03-May-20246.2 KiB173111

genetlink.pyD03-May-20243.8 KiB12471

iproute.pyD03-May-202426.9 KiB778600

leak_test.pyD03-May-20242.7 KiB8540

multinetwork_base.pyD03-May-202426 KiB764538

multinetwork_test.pyD03-May-202449.5 KiB1,315911

namespace.pyD03-May-20245.3 KiB167105

neighbour_test.pyD03-May-202414.1 KiB392268

net_test.pyD03-May-202413.5 KiB486335

net_test.shD03-May-20244.9 KiB17499

netlink.pyD03-May-20248.6 KiB282185

nf_test.pyD03-May-20242.8 KiB8642

no_testD03-May-202412 20

packets.pyD03-May-20247.2 KiB207156

parallel_tests.shD03-May-20241.4 KiB6344

parameterization_test.pyD03-May-20242.5 KiB8444

pf_key.pyD03-May-202410.4 KiB331244

pf_key_test.pyD03-May-20244 KiB10063

ping6_test.pyD03-May-202432 KiB877621

ping6_test.shD03-May-2024266 175

policy_crash_test.pyD03-May-20244.8 KiB13644

qtaguid_test.pyD03-May-20248.4 KiB229183

removed_feature_test.pyD03-May-20243.2 KiB9558

resilient_rs_test.pyD03-May-20245.5 KiB173105

run_net_test.shD03-May-202415.8 KiB462324

sock_diag.pyD03-May-202414.5 KiB434330

sock_diag_test.pyD03-May-202445.7 KiB1,179885

srcaddr_selection_test.pyD03-May-202414.9 KiB365208

sysctls_test.pyD03-May-20241.4 KiB4418

tcp_fastopen_test.pyD03-May-20244.5 KiB13386

tcp_metrics.pyD03-May-20244.4 KiB13892

tcp_nuke_addr_test.pyD03-May-20243.5 KiB11374

tcp_repair_test.pyD03-May-202411.8 KiB342245

tcp_test.pyD03-May-20244.6 KiB13889

tun_twister.pyD03-May-20247.3 KiB215159

util.pyD03-May-20242.7 KiB7237

vts_kernel_net_tests.xmlD03-May-20241.6 KiB3517

xfrm.pyD03-May-202427.4 KiB769552

xfrm_algorithm_test.pyD03-May-202415 KiB397283

xfrm_base.pyD03-May-202411 KiB326218

xfrm_test.pyD03-May-202436.9 KiB905610

xfrm_tunnel_test.pyD03-May-202442.4 KiB1,093739

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