Search code examples
ubuntuqemumulticastqnxvsomeip

vsomeip - how to discover service in QEMU-QNX guest from Ubuntu host?


I am running vsomeip service example from the Wiki page "https://github.com/COVESA/vsomeip/wiki/vsomeip-in-10-minutes#devices" inside virtual QNX guest on QEMU. Bridge networking is enabled using TAP interface. The ifup script used is as below.

modprobe dummy
ip link add eth1 type dummy
ifconfig eth1 hw ether A7:C7:3A:3E:37:4A #fudged address
ip addr add 192.168.1.100/24 brd + dev eth1
ip link set dev eth1 up

ETH1_IP=192.168.0.3
ETH1_MASK=255.255.255.0
ETH1_BCAST=192.168.0.255

ifconfig eth1 down
ifconfig eth1 0.0.0.0 promisc up
tunctl -t tap0 -u `whoami`
ifconfig tap0 0.0.0.0 promisc up

brctl addbr br0
brctl addif br0 eth1
brctl addif br0 tap0

ifconfig eth1 up
ifconfig tap0 up
ifconfig br0 up

brctl stp br0 off 
ifconfig br0 $ETH1_IP netmask $ETH1_MASK broadcast $ETH1_BCAST

I want to connect the vsomeip client from Ubuntu host. The config is same as in the examples except unicast and multicast IP.

I have added the same multicast IP on both host and guest to route. Guest

# route add -net 239.255.255.254 192.168.0.1 -ifp vt0

Host

$ sudo route add -nv 239.255.255.254 dev br0

The client is not able to detect the service. The logs are as below.

# ./service_example 
2023-07-01 02:52:31.513250 [info] Parsed vsomeip configuration in 222ms
2023-07-01 02:52:31.513420 [info] Using configuration folder: "/etc/vsomeip".
2023-07-01 02:52:31.513460 [info] Configuration module loaded.
2023-07-01 02:52:31.513480 [info] Initializing vsomeip application "World".
2023-07-01 02:52:31.513530 [info] Instantiating routing manager [Host].
2023-07-01 02:52:31.513750 [info] create_local_server Routing endpoint at /tmp/vsomeip-0
2023-07-01 02:52:31.513890 [info] Service Discovery enabled. Trying to load module.
2023-07-01 02:52:31.514290 [info] Service Discovery module loaded.
2023-07-01 02:52:31.514440 [info] Application(World, 1212) is initialized (11, 100).
2023-07-01 02:52:31.514540 [info] OFFER(1212): [1234.5678:0.0] (true)
2023-07-01 02:52:31.514810 [info] Listening at /tmp/vsomeip-1212
2023-07-01 02:52:31.514950 [info] Starting vsomeip application "World" (1212) using 2 threads I/O nice 255
2023-07-01 02:52:31.515030 [info] main dispatch thread id from application: 1212 (World) is: 3
2023-07-01 02:52:31.515040 [info] shutdown thread id from application: 1212 (World) is: 4
2023-07-01 02:52:31.515230 [warning] udp_server_endpoint_impl:: couldn't set SO_RCVBUF: No buffer space available to: 1703936 local port: 30491
2023-07-01 02:52:31.515330 [debug] Joining to multicast group 239.255.255.254 from 192.168.0.11
2023-07-01 02:52:31.515370 [warning] udp_server_endpoint_impl:: couldn't set SO_RCVBUF: No buffer space available to: 1703936 local port: 30491
2023-07-01 02:52:31.515570 [warning] udp_server_endpoint_impl:: couldn't set SO_RCVBUF: No buffer space available to: 1703936 local port: 30509
2023-07-01 02:52:31.515610 [info] SOME/IP routing ready.
2023-07-01 02:52:31.515670 [info] Watchdog is disabled!
2023-07-01 02:52:31.515750 [info] io thread id from application: 1212 (World) is: 1
2023-07-01 02:52:31.515780 [info] io thread id from application: 1212 (World) is: 6
2023-07-01 02:52:31.515850 [info] vSomeIP 3.1.20.3 | (default)
2023-07-01 02:52:41.615890 [info] vSomeIP 3.1.20.3 | (default)
2023-07-01 02:52:45.655580 [warning] Didn't receive a multicast SD message for 2200ms.
2023-07-01 02:52:45.655640 [debug] Leaving the multicast group 239.255.255.254 from 192.168.0.11
2023-07-01 02:52:45.655730 [debug] Joining to multicast group 239.255.255.254 from 192.168.0.11
2023-07-01 02:52:45.655790 [warning] udp_server_endpoint_impl:: couldn't set SO_RCVBUF: No buffer space available to: 1703936 local port: 30491

~$ client_example                                                           
2023-08-01 06:52:42.158375 [info] Using configuration file: "config_client.json".
2023-08-01 06:52:42.158831 [info] Parsed vsomeip configuration in 0ms
2023-08-01 06:52:42.158939 [info] Configuration module loaded.
2023-08-01 06:52:42.159036 [info] Initializing vsomeip (3.3.8) application "Hello".
2023-08-01 06:52:42.159270 [info] Instantiating routing manager [Host].
2023-08-01 06:52:42.160274 [info] create_routing_root: Routing root @ /tmp/vsomeip-0
2023-08-01 06:52:42.160785 [info] Service Discovery enabled. Trying to load module.
2023-08-01 06:52:42.163340 [info] Service Discovery module loaded.
2023-08-01 06:52:42.163776 [info] Application(Hello, 1313) is initialized (11, 100).
2023-08-01 06:52:42.163955 [info] REQUEST(1313): [1234.5678:255.4294967295]
2023-08-01 06:52:42.164641 [info] create_local_server: Listening @ /tmp/vsomeip-1313
2023-08-01 06:52:42.165461 [info] Starting vsomeip application "Hello" (1313) using 2 threads I/O nice 255
2023-08-01 06:52:42.166503 [info] Client [1313] routes unicast:192.168.0.3, netmask:255.255.255.0
2023-08-01 06:52:42.166331 [info] main dispatch thread id from application: 1313 (Hello) is: 7fd893ffd640 TID: 10052
2023-08-01 06:52:42.166595 [info] shutdown thread id from application: 1313 (Hello) is: 7fd8937fc640 TID: 10053
2023-08-01 06:52:42.168030 [info] Watchdog is disabled!
**CLIENT: Service [1234.5678] is NOT available.
**2023-08-01 06:52:42.168978 [info] io thread id from application: 1313 (Hello) is: 7fd8957fed80 TID: 10049
2023-08-01 06:52:42.169019 [info] io thread id from application: 1313 (Hello) is: 7fd8927fa640 TID: 10055
2023-08-01 06:52:42.170197 [info] vSomeIP 3.3.8 | (default)
2023-08-01 06:52:42.170620 [info] Network interface "br0" state changed: up
2023-08-01 06:52:42.171615 [info] Route "239.255.255.254/32 if: br0 gw: n/a" state changed: up
2023-08-01 06:52:42.172148 [info] udp_server_endpoint_impl: SO_RCVBUF is: 212992 (1703936) local port:30491
2023-08-01 06:52:42.172345 [debug] Joining to multicast group 239.255.255.254 from 192.168.0.3
2023-08-01 06:52:42.172558 [info] SOME/IP routing ready.
2023-08-01 06:52:42.173415 [info] udp_server_endpoint_impl<multicast>: SO_RCVBUF is: 212992 (1703936) local port:30491
2023-08-01 06:52:52.170617 [info] vSomeIP 3.3.8 | (default)
2023-08-01 06:53:02.171167 [info] vSomeIP 3.3.8 | (default)

I am expecting the service to be discovered but I am getting "service not available" message as seen in above log. Any pointers please?


Solution

  • The setup suspiciously ran fine on Windows QEMU using OpenVPN TAP adapter. This brought the spotlight on the Ubuntu TAP adapter as potential culprit. Hence added the original script in the question.

    Indeed the problem is with wrong subnet given in the bridge ifup.sh script. It is not matching the br0/vt0 subnet. Someone had probably left it there as a blind copy-paste. After updating it with correct subnet it worked. Below is the diff.

    - ip addr add 192.168.1.100/24 brd + dev eth1
    + ip addr add 192.168.0.1/24 brd + dev eth1
    

    Hope this helps someone working on similar problems.