📄 tohost-01.testie
字号:
%infoThis test checks several ToHost properties: that a ToHost without a devicewill accept packets with a device annotation, and drop packets without suchan annotation; and that ToHost(DEVICE) sets the device annotationappropriately; and that ToHost(SNIFFERS true) sends packets to sniffers.XXX It doesn't test whether SNIFFERS true sends packets to the kernel.%require[ `whoami` = root ]%scriptclick-install KERNELCONFIGtcpdump -n -i fake0 >FAKE0 2>&1 &usleep 500000dump1=$!ping -n -i 1 -c 1 1.0.0.2 | grep transmitted | sed 's/^\([0-9]*\).*/\1/' >PING1echo 1 > /click/sw/switchping -n -i 1 -c 1 1.0.0.3 | grep transmitted | sed 's/^\([0-9]*\).*/\1/' >>PING1kill $dump1cat /click/th0/drops /click/th1/drops >DROPScat /click/c/count >COUNTclick-uninstall%file KERNELCONFIGfh1 :: FromHost(fake0, 1.0.0.1/24);th0 :: ToHost(SNIFFERS true);th1 :: ToHost(fake0);elementclass ARPer { input -> c :: Classifier(12/0806, 12/0800 23/01) -> ARPResponder(0/0 0:1:2:3:4:5) -> [0]output; c[1] -> MarkIPHeader(14) -> [1]output}fh1 -> a1 :: ARPer -> th1;a1[1] -> ICMPPingResponder -> c::Counter -> sw :: Switch;sw[0] -> th0;sw[1] -> th1;ICMPSendPings(2.0.0.2, 1.0.0.1, LIMIT 1) -> EtherEncap(0x0800, fake0, fake0) -> th0;ICMPSendPings(2.0.0.3, 1.0.0.1, LIMIT 1) -> EtherEncap(0x0800, fake0, fake0) -> th1;%ignore FAKE0.*listening on.*.*packet.*received by.*.*packet.*dropped by.*.*packet.*captured.*.*arp.*.*verbose output.*.*end of file.*%expectx -i FAKE0.* 1.0.0.1 > 1.0.0.2: icmp.* echo request.*.* 1.0.0.2 > 1.0.0.1: icmp.* echo reply.*.* 2.0.0.3 > 1.0.0.1: icmp.* echo request.*.* 1.0.0.1 > 1.0.0.3: icmp.* echo request.*.* 1.0.0.3 > 1.0.0.1: icmp.* echo reply.*%expect PING111%expect DROPS10%expect COUNT2%expect stderr
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -