vsomeip库IPv4与IPv6服务发现行为差异排查求助
IPv6下vsomeip服务发现通信故障排查
环境配置
- vsomeip 3.3.8
- 两台Xenomai设备(Debian 11)通过交换机连接
- 两台设备部署"镜像服务":节点1提供
0x4433.0x2211服务、请求0x1234.0x5678服务;节点2则相反
现象观察
- 使用IPv4地址运行应用时,两台应用可正常交换数据
- 使用IPv6地址且关闭服务发现、硬编码客户端IPv6地址时,应用运行成功,证明设备支持IPv6通信
- 问题:启用服务发现(不硬编码服务单播地址)时,两台应用无通信(注:Wireshark可捕获服务发现通信)
- Wireshark捕获到一条ICMPv6消息,显示"Multicast Address Record Changed to exclude: ff0e::1",未手动配置该排除规则
技术问询
请问节点无法通信的原因是什么?是否存在IPv6专属配置项?
- 个人推测问题出在C++应用之外,可能与Xenomai网络配置或JSON配置文件相关
附录:节点配置与日志
节点1的JSON配置文件
{"unicast" : "4242::1", "logging" : { "level" : "trace", "console" : "true", "file" : { "enable" : "true", "path" : "/usr/cppPlayground/requestResponse2DevicesIpv6/node1.log" }, "dlt" : "false" }, "applications" : [ { "name" : "request-response", "id" : "0x1" } ], "services" : [ { "service" : "0x4433", "instance" : "0x2211", "unreliable" : "30510" } ], "routing" : "request-response", "service-discovery" : { "enable" : "true", "multicast" : "ff0e::1", "port" : "30490", "protocol" : "udp", "initial_delay_min" : "10", "initial_delay_max" : "100", "repetitions_base_delay" : "200", "repetitions_max" : "10", "ttl" : "3", "cyclic_offer_delay" : "2000", "request_response_delay" : "1500" } }
节点2的JSON配置文件
{"unicast" : "4242::2", "logging" : { "level" : "trace", "console" : "true", "file" : { "enable" : "true", "path" : "/usr/CppPlayground/requestResponseMirrored2DevicesIpv6/node2.log" }, "dlt" : "false" }, "applications" : [ { "name" : "request-response-mirrored", "id" : "0x9" } ], "services" : [ { "service" : "0x1234", "instance" : "0x5678", "unreliable" : "30509" } ], "routing" : "request-response-mirrored", "service-discovery" : { "enable" : "true", "multicast" : "ff0e::1", "port" : "30490", "protocol" : "udp", "initial_delay_min" : "10", "initial_delay_max" : "100", "repetitions_base_delay" : "200", "repetitions_max" : "10", "ttl" : "3", "cyclic_offer_delay" : "2000", "request_response_delay" : "1500" } }
节点1的日志文件(晚于节点2启动)
2023-09-15 15:35:21.279421 [info] Using configuration file: "vsomeip-local_IPv6.json". 2023-09-15 15:35:21.281261 [info] Parsed vsomeip configuration in 2ms 2023-09-15 15:35:21.281666 [info] Configuration module loaded. 2023-09-15 15:35:21.282017 [info] Initializing vsomeip (3.3.8) application "request-response". 2023-09-15 15:35:21.282568 [info] Instantiating routing manager [Host]. 2023-09-15 15:35:21.283269 [info] create_routing_root: Routing root @ /tmp/vsomeip-0 2023-09-15 15:35:21.283987 [info] Service Discovery enabled. Trying to load module. 2023-09-15 15:35:21.285998 [info] Service Discovery module loaded. 2023-09-15 15:35:21.286556 [info] Application(request-response, 0001) is initialized (11, 100). 2023-09-15 15:35:21.287161 [info] Starting vsomeip application "request-response" (0001) using 2 threads I/O nice 255 2023-09-15 15:35:21.287993 [info] Client [0001] routes unicast:4242::1, prefix:24 2023-09-15 15:35:21.287908 [info] main dispatch thread id from application: 0001 (request-response) is: 7f6d7edde700 TID: 1378 2023-09-15 15:35:21.288016 [info] shutdown thread id from application: 0001 (request-response) is: 7f6d7e5dd700 TID: 1379 2023-09-15 15:35:21.289400 [info] Watchdog is disabled! 2023-09-15 15:35:21.290087 [info] REQUEST(0001): [1234.5678:255.4294967295] 2023-09-15 15:35:21.290180 [info] io thread id from application: 0001 (request-response) is: 7f6d7d5db700 TID: 1381 2023-09-15 15:35:21.290169 [info] io thread id from application: 0001 (request-response) is: 7f6d7fedcec0 TID: 1375 2023-09-15 15:35:21.290694 [info] create_local_server: Listening @ /tmp/vsomeip-1 2023-09-15 15:35:21.292821 [info] OFFER(0001): [4433.2211:0.0] (true) 2023-09-15 15:35:21.293393 [info] vSomeIP 3.3.8 | (default) 2023-09-15 15:35:21.293815 [info] Network interface "eno1" state changed: up 2023-09-15 15:35:21.294766 [info] Route "ff00::/8 if: eno1 gw: n/a" state changed: up 2023-09-15 15:35:21.295200 [info] udp_server_endpoint_impl: SO_RCVBUF is: 212992 (1703936) local port:30490 2023-09-15 15:35:21.295432 [debug] **Joining to multicast group ff0e::1 from 4242::1** 2023-09-15 15:35:21.295805 [info] udp_server_endpoint_impl: SO_RCVBUF is: 212992 (1703936) local port:30510 2023-09-15 15:35:21.295976 [info] udp_server_endpoint_impl: SO_RCVBUF is: 212992 (1703936) local port:30490 2023-09-15 15:35:21.296000 [info] SOME/IP routing ready. 2023-09-15 15:35:22.293609 [info] OFFER(0001): [4433.2211:0.0] (true) 2023-09-15 15:35:22.294419 [warning] routing_manager_impl::handle_local_offer_service: Application: 0001 is offering: [4433.2211.0.0] offered previously by itself. 2023-09-15 15:35:23.294958 [info] OFFER(0001): [4433.2211:0.0] (true) 2023-09-15 15:35:23.295723 [warning] routing_manager_impl::handle_local_offer_service: Application: 0001 is offering: [4433.2211.0.0] offered previously by itself. *[... all the same as the two messages before...]* 2023-09-15 15:35:29.039199 [info] STOP OFFER(0001): [4433.2211:0.0] (true) 2023-09-15 15:35:29.039906 [info] RELEASE(0001): [1234.5678] 2023-09-15 15:35:30.304243 [info] Stopping vsomeip application "request-response" (0001).
IPv6操作步骤
- 添加组播路由:
sudo ip -6 route add ff0e::1 dev eno1 - 启动应用:
env VSOMIP_CONFIGURATION...
预期IPv6表现与IPv4一致,但实际启用服务发现时无法通信,已尝试多种网络配置但无明显效果
内容的提问来源于stack exchange,提问作者Igor
相关产品推荐
相关产品推荐

