mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-30 18:47:01 +00:00
1583782446
This reverts commit ae55954919
.
155 lines
4.4 KiB
Plaintext
155 lines
4.4 KiB
Plaintext
if {![have_include power_on/qemu] ||
|
|
[have_spec foc] ||
|
|
[expr [have_spec imx53] && [have_spec trustzone]]} {
|
|
|
|
puts "Run script is not supported on this platform."
|
|
exit 0
|
|
}
|
|
|
|
|
|
proc good_dst_ip { } { return "10.0.2.2" }
|
|
proc bad_dst_ip { } { return "10.0.0.123" }
|
|
|
|
create_boot_directory
|
|
|
|
import_from_depot [depot_user]/src/[base_src] \
|
|
[depot_user]/pkg/[drivers_nic_pkg] \
|
|
[depot_user]/src/init \
|
|
[depot_user]/src/nic_router
|
|
|
|
build { app/ping test/net_flood }
|
|
|
|
install_config {
|
|
<config>
|
|
<parent-provides>
|
|
<service name="ROM"/>
|
|
<service name="RAM"/>
|
|
<service name="IRQ"/>
|
|
<service name="IO_MEM"/>
|
|
<service name="IO_PORT"/>
|
|
<service name="PD"/>
|
|
<service name="RM"/>
|
|
<service name="CPU"/>
|
|
<service name="LOG"/>
|
|
</parent-provides>
|
|
<default-route>
|
|
<any-service> <parent/> <any-child/> </any-service>
|
|
</default-route>
|
|
<default caps="100"/>
|
|
|
|
<start name="timer">
|
|
<resource name="RAM" quantum="1M"/>
|
|
<provides><service name="Timer"/></provides>
|
|
</start>
|
|
|
|
<start name="drivers" caps="1000">
|
|
<resource name="RAM" quantum="32M" constrain_phys="yes"/>
|
|
<binary name="init"/>
|
|
<route>
|
|
<service name="ROM" label="config"> <parent label="drivers.config"/> </service>
|
|
<service name="Timer"> <child name="timer"/> </service>
|
|
<any-service> <parent/> </any-service>
|
|
</route>
|
|
<provides> <service name="Nic"/> </provides>
|
|
</start>
|
|
|
|
<start name="nic_router" caps="200">
|
|
<resource name="RAM" quantum="10M"/>
|
|
<provides><service name="Nic"/></provides>
|
|
<config verbose="no"
|
|
verbose_packets="no"
|
|
verbose_packet_drop="yes"
|
|
verbose_domain_state="yes"
|
|
dhcp_discover_timeout_sec="1"
|
|
tcp_idle_timeout_sec="3600"
|
|
udp_idle_timeout_sec="3600"
|
|
icmp_idle_timeout_sec="3600">
|
|
|
|
<policy label_prefix="flood_links" domain="flood_links"/>
|
|
<policy label_prefix="ping" domain="flood_links"/>
|
|
<uplink domain="uplink"/>
|
|
|
|
<domain name="uplink" verbose_packets="no">
|
|
<nat domain="flood_links" udp-ports="16384"
|
|
tcp-ports="16384"
|
|
icmp-ids="16384"/>
|
|
</domain>
|
|
|
|
<domain name="flood_links" interface="10.0.1.1/24">
|
|
<dhcp-server ip_first="10.0.1.100"
|
|
ip_last="10.0.1.200"/>
|
|
|
|
<icmp dst="0.0.0.0/0" domain="uplink"/>
|
|
<udp dst="0.0.0.0/0"><permit-any domain="uplink"/></udp>
|
|
<tcp dst="0.0.0.0/0"><permit-any domain="uplink"/></tcp>
|
|
</domain>
|
|
|
|
</config>
|
|
<route>
|
|
<service name="Nic"> <child name="drivers"/> </service>
|
|
<any-service> <parent/> <any-child/> </any-service>
|
|
</route>
|
|
</start>
|
|
|
|
<start name="flood_links_tcp">
|
|
<binary name="test-net_flood"/>
|
|
<resource name="RAM" quantum="8M"/>
|
|
<config dst_ip="} [bad_dst_ip] {"
|
|
protocol="tcp"
|
|
verbose="no"/>
|
|
<route>
|
|
<service name="Nic"> <child name="nic_router"/> </service>
|
|
<any-service> <parent/> <any-child/> </any-service>
|
|
</route>
|
|
</start>
|
|
<start name="flood_links_udp">
|
|
<binary name="test-net_flood"/>
|
|
<resource name="RAM" quantum="8M"/>
|
|
<config dst_ip="} [bad_dst_ip] {"
|
|
protocol="udp"
|
|
verbose="no"/>
|
|
<route>
|
|
<service name="Nic"> <child name="nic_router"/> </service>
|
|
<any-service> <parent/> <any-child/> </any-service>
|
|
</route>
|
|
</start>
|
|
<start name="flood_links_icmp">
|
|
<binary name="test-net_flood"/>
|
|
<resource name="RAM" quantum="8M"/>
|
|
<config dst_ip="} [bad_dst_ip] {"
|
|
protocol="icmp"
|
|
verbose="no"/>
|
|
<route>
|
|
<service name="Nic"> <child name="nic_router"/> </service>
|
|
<any-service> <parent/> <any-child/> </any-service>
|
|
</route>
|
|
</start>
|
|
|
|
|
|
<start name="ping">
|
|
<resource name="RAM" quantum="8M"/>
|
|
<config dst_ip="} [good_dst_ip] {"
|
|
period_sec="2"
|
|
count="999"/>
|
|
<route>
|
|
<service name="Nic"> <child name="nic_router"/> </service>
|
|
<any-service> <parent/> <any-child/> </any-service>
|
|
</route>
|
|
</start>
|
|
|
|
</config>}
|
|
|
|
build_boot_image { test-net_flood ping }
|
|
|
|
proc qemu_nic_model {} {
|
|
if [have_spec x86] { return e1000 }
|
|
if [have_spec lan9118] { return lan9118 }
|
|
if [have_spec zynq] { return cadence_gem }
|
|
return nic_model_missing
|
|
}
|
|
|
|
append qemu_args " -nographic "
|
|
append qemu_args " -netdev user,id=net0 "
|
|
append qemu_args " -net nic,model=[qemu_nic_model],netdev=net0 "
|
|
|
|
run_genode_until {.*ping\] 64 bytes from 10\.0\.2\.2: icmp_seq=30 .*\n} 120 |