Modified
file : trdp_utils.c
function : trdp_requestSocket()
651 lines of below is added to the eye.
//if (vos_sockJoinMC(iface[lIndex].sock, mcGroup, iface[lIndex].bindAddr) != VOS_NO_ERR)
if (vos_sockJoinMC(iface[lIndex].sock, mcGroup, srcIP) != VOS_NO_ERR)
781 lines of below is added to the eye.
//err = (TRDP_ERR_T) vos_sockJoinMC(iface[lIndex].sock, mcGroup, iface[lIndex].bindAddr);
err = (TRDP_ERR_T) vos_sockJoinMC(iface[lIndex].sock, mcGroup, srcIP);
Last edit: Kazumasa Aiba 2015-03-11
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Modified
file : trdp_utils.c
function : trdp_requestSocket()
651 lines of below is added to the eye.
//if (vos_sockJoinMC(iface[lIndex].sock, mcGroup, iface[lIndex].bindAddr) != VOS_NO_ERR)
if (vos_sockJoinMC(iface[lIndex].sock, mcGroup, srcIP) != VOS_NO_ERR)
781 lines of below is added to the eye.
//err = (TRDP_ERR_T) vos_sockJoinMC(iface[lIndex].sock, mcGroup, iface[lIndex].bindAddr);
err = (TRDP_ERR_T) vos_sockJoinMC(iface[lIndex].sock, mcGroup, srcIP);
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Please be aware, that the different OS behave different. For that the function vos_determineBindAddr() in vos_sock was introduced. For Windows the use of SrcIP as bind address is always ok, for Linux the 0 has to be used for MC. As I understand Your change, for vos_sockJoinMC always SrcIP needs to be used. On which OS did you try it. Did you try it also for SrcIP == 0 ?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Sorry for late reply.
The problem is the following.
The third argument is ANY in vos_sockJoinMC().
In case of dual homing interfaces, it is not possible to set multicast IP address to the second interface separately from the first interface.
In order to set multicast IP address to the second interface individually, it needs to change the third argument from ANY to srcIP.
However, in my test environment, I use the OS other than Linux, Windows or VxWorks.
So I am going to test it again with Linux.
According to the result, I will post a comment, if necessary.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
By the test with Linux I have found the followings.
In case of dual homing, after binding a socket to ‘0’ respectively, when IGMP Join is requested to send at the interface of the socket with ‘0’ in vos_sockJoinMC(), sending Join message is unstable, or sometimes missing.
But when requested at the interface of the socket with the specified srcIp, Join message is always sent correctly.
imr_multiaddr contains the address of the multicast group the
application wants to join or leave. It must be a valid
multicast address (or setsockopt(2) fails with the error
EINVAL). imr_address is the address of the local interface
with which the system should join the multicast group; if it
is equal to INADDR_ANY, an appropriate interface is chosen by
the system.
Finally, as you said in the previous comment: for vos_sockJoinMC always SrcIP needs to be used,
I request to change the third argument from ‘0’ to srcIP in vos_sockJoinMC().
Test environment
・Linux PC
OS Version: debian 6.0.3
Kernel Version: 2.6.32-5-amd64
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Modified
file : trdp_utils.c
function : trdp_requestSocket()
651 lines of below is added to the eye.
//if (vos_sockJoinMC(iface[lIndex].sock, mcGroup, iface[lIndex].bindAddr) != VOS_NO_ERR)
if (vos_sockJoinMC(iface[lIndex].sock, mcGroup, srcIP) != VOS_NO_ERR)
781 lines of below is added to the eye.
//err = (TRDP_ERR_T) vos_sockJoinMC(iface[lIndex].sock, mcGroup, iface[lIndex].bindAddr);
err = (TRDP_ERR_T) vos_sockJoinMC(iface[lIndex].sock, mcGroup, srcIP);
Last edit: Kazumasa Aiba 2015-03-11
Modified
file : trdp_utils.c
function : trdp_requestSocket()
651 lines of below is added to the eye.
//if (vos_sockJoinMC(iface[lIndex].sock, mcGroup, iface[lIndex].bindAddr) != VOS_NO_ERR)
if (vos_sockJoinMC(iface[lIndex].sock, mcGroup, srcIP) != VOS_NO_ERR)
781 lines of below is added to the eye.
//err = (TRDP_ERR_T) vos_sockJoinMC(iface[lIndex].sock, mcGroup, iface[lIndex].bindAddr);
err = (TRDP_ERR_T) vos_sockJoinMC(iface[lIndex].sock, mcGroup, srcIP);
Please be aware, that the different OS behave different. For that the function vos_determineBindAddr() in vos_sock was introduced. For Windows the use of SrcIP as bind address is always ok, for Linux the 0 has to be used for MC. As I understand Your change, for vos_sockJoinMC always SrcIP needs to be used. On which OS did you try it. Did you try it also for SrcIP == 0 ?
Sorry for late reply.
The problem is the following.
The third argument is ANY in vos_sockJoinMC().
In case of dual homing interfaces, it is not possible to set multicast IP address to the second interface separately from the first interface.
In order to set multicast IP address to the second interface individually, it needs to change the third argument from ANY to srcIP.
However, in my test environment, I use the OS other than Linux, Windows or VxWorks.
So I am going to test it again with Linux.
According to the result, I will post a comment, if necessary.
By the test with Linux I have found the followings.
In case of dual homing, after binding a socket to ‘0’ respectively, when IGMP Join is requested to send at the interface of the socket with ‘0’ in vos_sockJoinMC(), sending Join message is unstable, or sometimes missing.
But when requested at the interface of the socket with the specified srcIp, Join message is always sent correctly.
On the other hand, referring to the Linux Programmer's Manual,
http://man7.org/linux/man-pages/man7/ip.7.html
it is said that;
Socket options:
IP_ADD_MEMBERSHIP;
imr_multiaddr contains the address of the multicast group the
application wants to join or leave. It must be a valid
multicast address (or setsockopt(2) fails with the error
EINVAL). imr_address is the address of the local interface
with which the system should join the multicast group; if it
is equal to INADDR_ANY, an appropriate interface is chosen by
the system.
Finally, as you said in the previous comment: for vos_sockJoinMC always SrcIP needs to be used,
I request to change the third argument from ‘0’ to srcIP in vos_sockJoinMC().
Test environment
・Linux PC
OS Version: debian 6.0.3
Kernel Version: 2.6.32-5-amd64