mirror of
https://github.com/genodelabs/genode.git
synced 2025-05-28 05:04:24 +00:00
This patch changes the way of how the client-selected sub directory is communicated to the server. The former opaque session argument is now passed as last label element, which allows for the flexible tweaking of this argument by init's session-routing and label-rewriting mechansims. In particular, it alleviates the need for creating chroot component instances. This change requires the following four adaptations at the configuration level: - Each file-system session request must now carry a path starting with / as last session arguments. Hence, <vfs> <fs> nodes that feature a 'label' attributes must extend the attribute value with " -> /". For <fs> nodes with no label attribute, "/" is used as last label argument by default. - For matching session-routing rules at init's configuration, the matching of full labels should be replaced by 'label_prefix' matches, excluding the last (path) argument. - Wherever a label of a file-system session is rewritten by using init's 'label' attribute of a <parent> or <child> target node, the new attribute 'identity' should be used instead. This replaces the identity part of the label while preserving the client's directory argument. - Analogously to the matching of session-routing rules, server-side policy-selection rules that formerly matched a concrete 'label' must be changed to match a 'label_prefix' instead. As a good practice, 'label_prefix' values should end with " ->" if possible, which clearly delimits the identity part of the label used by the matching. Issue #5445
99 lines
3.3 KiB
Plaintext
99 lines
3.3 KiB
Plaintext
assert_spec linux
|
|
|
|
set tshark [installed_command tshark]
|
|
set trafgen [installed_command trafgen]
|
|
set lx_fs_root "internet_checksum_dir"
|
|
set lx_fs_dir "bin/$lx_fs_root"
|
|
set input_file_name "input.pcap"
|
|
set input_file "bin/$input_file_name"
|
|
|
|
rename exit run_tool_exit
|
|
proc exit {{code 0}} {
|
|
global lx_fs_dir
|
|
global input_file
|
|
if {[get_cmd_switch --autopilot]} { exec rm -rf $input_file $lx_fs_dir }
|
|
run_tool_exit $code
|
|
}
|
|
build { core init lib/ld lib/vfs test/internet_checksum server/lx_fs }
|
|
create_boot_directory
|
|
|
|
proc gen_seed { } {
|
|
set min_seed 0
|
|
set max_seed [expr 2**32]
|
|
return [expr int($min_seed + floor(rand() * $max_seed))]
|
|
}
|
|
|
|
set seed 0
|
|
if {[info exists ::env(SEED)]} {
|
|
set seed $::env(SEED)
|
|
} else {
|
|
# in some cases trafgen generates bad checksums in encapsulated packets
|
|
set bad_seeds [list 0 875727356 ]
|
|
while {[lsearch -exact $bad_seeds $seed] != -1} {
|
|
set seed [gen_seed]
|
|
}
|
|
}
|
|
puts "\nUse script with SEED=$seed in order to get reproducible results\n"
|
|
|
|
install_config {
|
|
<config verbose="yes">
|
|
|
|
<parent-provides>
|
|
<service name="ROM"/>
|
|
<service name="LOG"/>
|
|
<service name="CPU"/>
|
|
<service name="PD"/>
|
|
</parent-provides>
|
|
|
|
<start name="lx_fs" ld="no" caps="100" ram="4M">
|
|
<provides> <service name="File_system"/> </provides>
|
|
<config> <policy label_prefix="test-internet_checksum -> " root="/} $lx_fs_root {" writeable="yes"/> </config>
|
|
<route> <any-service> <parent/> </any-service> </route>
|
|
</start>
|
|
|
|
<start name="test-internet_checksum" caps="100" ram="1M">
|
|
<config seed="} $seed {"> <vfs> <fs/> </vfs> </config>
|
|
<route>
|
|
<service name="File_system"> <child name="lx_fs"/> </service>
|
|
<any-service> <parent/> </any-service>
|
|
</route>
|
|
</start>
|
|
|
|
</config> }
|
|
|
|
exec rm -rf $lx_fs_dir
|
|
exec mkdir -p $lx_fs_dir
|
|
exec $trafgen --rand --seed $seed --in [genode_dir]/repos/os/src/test/internet_checksum/trafgen.cfg --num 10000 --out $input_file
|
|
|
|
proc assert_no_bad_checksums_in {pcap_file} {
|
|
global tshark
|
|
set view_filter "ip.checksum_bad.expert || tcp.checksum_bad.expert || udp.checksum.bad || icmp.checksum_bad"
|
|
set out "<invalid>"
|
|
set out [exec $tshark -o ip.check_checksum:TRUE -o tcp.check_checksum:TRUE -o udp.check_checksum:TRUE -Y "$view_filter" -r $pcap_file]
|
|
if {$out != ""} {
|
|
puts "\nError: bad checksums found in $pcap_file\n"
|
|
exit -1
|
|
}
|
|
}
|
|
assert_no_bad_checksums_in $input_file
|
|
build_boot_image [list {*}[build_artifacts] $lx_fs_root $input_file_name]
|
|
append qemu_args " -nographic "
|
|
run_genode_until {\[init\] child "test-internet_checksum" exited.*?\n} 30
|
|
|
|
set output_file "$lx_fs_dir/output.pcap"
|
|
assert_no_bad_checksums_in $output_file
|
|
set num_checked_checksums ""
|
|
set string_buf ""
|
|
regexp {checked [0-9]+ checksums} $output string_buf
|
|
regexp {[0-9]+} $string_buf num_checked_checksums
|
|
|
|
set tmp_file "$lx_fs_dir/tmp"
|
|
exec $tshark -o ip.check_checksum:TRUE -o tcp.check_checksum:TRUE -o udp.check_checksum:TRUE -O ip,tcp,udp,icmp -r $output_file | grep -e "Checksum Status:" -e "Header checksum status:" > $tmp_file
|
|
set num_output_checksums [exec wc -l < $tmp_file]
|
|
if {$num_checked_checksums != $num_output_checksums} {
|
|
puts "\nError: number of checksums in $output_file ($num_output_checksums) differs from number of checked checksums ($num_checked_checksums)\n"
|
|
exit -1
|
|
}
|
|
grep_output {\[init\] child "test-internet_checksum" exited}
|
|
compare_output_to {[init] child "test-internet_checksum" exited with exit value 0}
|