Hi,
I'm trying to use tcp_terminal on linux. It of course prominently says:
# TODO: Add support for Linux via user-level networking (using the # tun/tap proxy driver at os/src/drivers/nic/linux)
After disabling the have_spec check, I can compile and run it. After setting the suid bit on drivers/nic/spec/linux/nic_drv to allow it to access /dev/net/tun, I get the following output:
genode build completed using 'core-linux' as 'core' using 'ld-linux.lib.so' as 'ld.lib.so' using 'linux_timer_drv' as 'timer' spawn ./core Genode 16.11-146-gc16ee83 <local changes> 17592186044415 MiB RAM assigned to init [init] parent provides [init] service "ROM" [init] service "RAM" [init] service "IRQ" [init] service "IO_MEM" [init] service "IO_PORT" [init] service "PD" [init] service "RM" [init] service "CPU" [init] service "LOG" [init] child "timer" [init] RAM quota: 798720 [init] ELF binary: timer [init] priority: 0 [init] provides service Timer [init] child "nic_drv" [init] RAM quota: 3944448 [init] ELF binary: nic_drv [init] priority: 0 [init] provides service Nic [init] child "tcp_terminal" [init] RAM quota: 2371584 [init] ELF binary: tcp_terminal [init] priority: 0 [init] provides service Terminal [init] child "test-terminal_echo" [init] RAM quota: 798720 [init] ELF binary: test-terminal_echo [init] priority: 0 [init] child "nic_drv" announces service "Nic" [init -> test-terminal_echo] Warning: using legacy main function, please convert to 'Component::construct' [init] child "timer" announces service "Timer" [init -> tcp_terminal] using the pipe libc plugin [init -> tcp_terminal] init_nic_dhcp [init -> tcp_terminal] Using DHCP for interface configuration. [init -> tcp_terminal] using the lwIP libc plugin [init -> nic_drv] no config provided, using tap0 [init -> tcp_terminal] Warning: '<config> <libc> <vfs/>' is deprecated, please move to '<config> <vfs/>' [init -> tcp_terminal] --- TCP terminal started --- [init] child "tcp_terminal" announces service "Terminal" [init -> tcp_terminal] listening on port 8888 with socket 16... [init -> tcp_terminal] adding listen sock 16 to select set
Though I can see the tap device,
15: tap0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000 link/ether c2:60:31:f8:52:fc brd ff:ff:ff:ff:ff:ff
I don't see any listening socket on port 8888.
So clearly there is some missing plumbing. What do I need to do to fill that in?
Thanks,
--prashanth
Hello Prashanth,
On Thu, Feb 02, 2017 at 05:19:46PM -0800, Prashanth Mundkur wrote:
After disabling the have_spec check, I can compile and run it. After setting the suid bit on drivers/nic/spec/linux/nic_drv to allow it to access /dev/net/tun, I get the following output:
Just a remark to prevent setting suid: I setup my tap0 device so that in can be used by my user ID like follows in /etc/rc.local on Ubuntu.
# # Setup tap device for base-linux tests # dev=tap0 user=<YOUR USER ID>
ip tuntap add dev $dev mode tap user $user ip address flush dev $dev ip address add 10.0.2.1/24 brd 10.0.2.255 dev $dev ip link set dev $dev addr 02:00:00:ca:fe:01 ip link set dev $dev up
But now to your question...
Though I can see the tap device,
15: tap0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000 link/ether c2:60:31:f8:52:fc brd ff:ff:ff:ff:ff:ff
I don't see any listening socket on port 8888.
So clearly there is some missing plumbing. What do I need to do to fill that in?
If you mean you can't see any listening program on port 8888 on your host machine that's expected. Genode is running in a virtual network behind the tap0 device. Additionally, the log states that the tcp_terminal uses DHCP for network configuration but you may not run a DHCP server on tap0. Now you have two option: Configure a DHCP server to serve a private network behind tap, e.g., 10.0.2.1/24, or (much simpler) configure tcp_terminal statically. Therefore you apply the following changes to the run script (assuming the example network above).
<start name="tcp_terminal"> - <libc stdout="/dev/log"> + <libc ip_addr="10.0.2.55" netmask="255.255.255.0" gateway="10.0.2.1" + stdout="/dev/log" stderr="/dev/log"/>
The terminal should then be accessible at 10.0.2.55:8888.
Regards