vsomeip icon indicating copy to clipboard operation
vsomeip copied to clipboard

Fix network interface identification for VLAN in IPv6

Open nachtfuchs opened this issue 2 years ago • 3 comments

Attention: pull-request only tested with Linux.

The Problem

VLAN in IPv6 did not work with vsomeip 3.3.8 for communication partners that use a different SOME/IP stack than vsomeip. The problem is that the wrong network interface is used to send the message. The network interface is chosen based on the unicast-IPv6-address in the json file. The effect is that there is no 802.1Q field in the sent Ethernet frame during service discovery. Consequently, the communication partner does not talk on the same "channel". Providing a network interface to the unicast address in the json-file shows no effect, i.e. {"unicast" : "beef::1%7"}. This problem is NOT observed with IPv4.

The solution

So I chose to identify the network interface address during the configuration part when the user defined "unicast" address is fixed. The idea of the solution is to go through all network interfaces on the system and find the "unicast" address that is assigned to one of the network interfaces. Its ID is used to extend the given IPv6 unicast-address and this way create the correct socket for communication using the boost library.

The test environment

I tested this with a Xenomai 3.2.2 operating system on the one end, and a embedded ECU on the other end. The ECU runs a different SOME/IP-stack than my Xenomai machine. Xenomai is based on a Linux Kernel.

Alternative solutions

An alternative could be to to change "udp_server_endpoint_impl.cpp" and assign the correct outbound interface in "boost::asio::ip::multicast::outbound_interface" for IPv6. I did not look into it, because I thought that the IPv6 address with network interface ID might be used somewhere else during the setup of the communication.

nachtfuchs avatar Oct 31 '23 11:10 nachtfuchs

Hi @nachtfuchs, I've tested the patch on my side, and it seems to be breaking the build, can you check? error I will also a look to check if it's something wrong with the patch.

Also, please remove unnecessary debug logs. And have a look a the coding style used in the project. Mainly, I've noticed the if's and for cyles seem to have wrong brackets and spacing. Thanks

cc: @goncaloalmeida

fcmonteiro avatar Oct 31 '23 12:10 fcmonteiro

Thanks for the quick feedback. I made the changes in the browser instead of actually cloning the branch. During the process, I introduced a bug that compromised the build. I am not going to do changes in the browser in future pull-requests. I hope my changes can live up to your comments.

nachtfuchs avatar Oct 31 '23 15:10 nachtfuchs

Finished fixing the review findings from 10th November.

nachtfuchs avatar Nov 20 '23 14:11 nachtfuchs