• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..--

.gitignoreD22-Nov-202324 32

READMED22-Nov-20232.6 KiB7851

all_tests.shD22-Nov-20231.5 KiB6837

anycast_test.pyD22-Nov-20233 KiB11468

bpf.pyD22-Nov-20237.3 KiB297216

bpf_test.pyD22-Nov-20235.7 KiB153121

csocket.pyD22-Nov-20239.9 KiB336227

csocket_test.pyD22-Nov-20232.5 KiB8753

cstruct.pyD22-Nov-20237.2 KiB224160

cstruct_test.pyD22-Nov-20234 KiB11679

forwarding_test.pyD22-Nov-20234 KiB11974

iproute.pyD22-Nov-202318.3 KiB545405

leak_test.pyD22-Nov-20231.5 KiB5222

multinetwork_base.pyD22-Nov-202323.1 KiB676472

multinetwork_test.pyD22-Nov-202344.2 KiB1,163807

neighbour_test.pyD22-Nov-202310.4 KiB299203

net_test.pyD22-Nov-202311.8 KiB428283

net_test.shD22-Nov-2023793 2811

netlink.pyD22-Nov-20237.9 KiB261167

packets.pyD22-Nov-20236.9 KiB199151

parallel_tests.shD22-Nov-20231.3 KiB5537

ping6_test.pyD22-Nov-202331 KiB850602

ping6_test.shD22-Nov-2023266 175

removed_feature_test.pyD22-Nov-20232.1 KiB7239

run_net_test.shD22-Nov-20236.6 KiB212148

sock_diag.pyD22-Nov-202314.3 KiB430326

sock_diag_test.pyD22-Nov-202334.7 KiB908684

srcaddr_selection_test.pyD22-Nov-202314.5 KiB355204

tcp_nuke_addr_test.pyD22-Nov-20233.5 KiB11374

tcp_test.pyD22-Nov-20234 KiB12781

xfrm.pyD22-Nov-20238.4 KiB289205

xfrm_test.pyD22-Nov-202313.5 KiB322201

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