Menu

#77 TRDP UTILS: wrong argument for vos_sockJoinMC()

1.3.0.0
closed
1393 (1)
2015-03-27
2015-03-11
No

For binding multicast, it is needed to correct the third augument to srcIP in vos_sockJoinMC().

Because, in dual homing interfaces, it is not possible to bind the second interface.

Discussion

  • Kazumasa Aiba

    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);

     

    Last edit: Kazumasa Aiba 2015-03-11
  • Kazumasa Aiba

    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);

     
  • Armin-Hagen Weiss

    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 ?

     
  • Kazumasa Aiba

    Kazumasa Aiba - 2015-03-18

    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.

     
  • Kazumasa Aiba

    Kazumasa Aiba - 2015-03-27

    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

     
  • Armin-Hagen Weiss

    • labels: --> 1393
    • status: open --> closed
    • assigned_to: Armin-Hagen Weiss
    • Milestone: 1.2.0.0 --> 1.3.0.0
     
  • Armin-Hagen Weiss

    • summary: Defect --> TRDP UTILS: wrong argument for vos_sockJoinMC()
     

Log in to post a comment.

MongoDB Logo MongoDB