File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2121
2222using namespace net ;
2323
24+ void verify () {
25+ static int i = 0 ;
26+ if (++i == 4 )
27+ printf (" SUCCESS\n " );
28+ }
2429
2530void ip_forward (Inet<IP4>& stack, IP4::IP_packet_ptr pckt) {
2631 stack.ip_obj ().ship (std::move (pckt));
@@ -49,19 +54,23 @@ void Service::start()
4954
5055 internet_host.tcp ().listen (80 , [](auto conn) {
5156 printf (" Internet page received a new connection! (%s)\n " , conn->to_string ().c_str ());
57+ verify ();
5258 });
5359
5460 laptop1.tcp ().connect ({ internet_host.ip_addr (), 80 }, [](auto conn) {
5561 printf (" Laptop1 connected to internet web page! (%s)\n " , conn->to_string ().c_str ());
62+ verify ();
5663 });
5764
5865 nat.add_entry (8080 , { laptop1.ip_addr (), 80 });
5966
6067 laptop1.tcp ().listen (80 , [](auto conn) {
6168 printf (" Laptop1 received a new connection! (%s)\n " , conn->to_string ().c_str ());
69+ verify ();
6270 });
6371
6472 internet_client.tcp ().connect ({ laptop1.ip_addr (), 80 }, [](auto conn) {
6573 printf (" Bob (internet) connected to Laptop1! (%s)\n " , conn->to_string ().c_str ());
74+ verify ();
6675 });
6776}
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env python
2+
3+ import sys
4+ import os
5+
6+ includeos_src = os .environ .get ('INCLUDEOS_SRC' ,
7+ os .path .realpath (os .path .join (os .getcwd (), os .path .dirname (__file__ ))).split ('/test' )[0 ])
8+ sys .path .insert (0 ,includeos_src )
9+
10+ from vmrunner import vmrunner
11+ vmrunner .vms [0 ].cmake ().boot (10 ).clean ()
Original file line number Diff line number Diff line change 11{
2- "image" : " test_dhcp_server .img" ,
2+ "image" : " test_nat .img" ,
33 "net" : [{"device" : " virtio" , "mac" : " c0:01:0a:00:00:2a" },
44 {"device" : " virtio" , "mac" : " c0:01:0a:00:00:2f" },
55 {"device" : " virtio" , "mac" : " c0:01:0a:00:00:20" },
You can’t perform that action at this time.
0 commit comments