Menu

#1093 IP_MULTICAST_IF the interface is not selectable under WinCE7

v1.0 (example)
closed-fixed
5
2017-01-11
2017-01-10
thomas65g
No

Environment
stdsoap2.c[pp] 2.8.40
Visual Studio 2008
Windows Embedded Compact 7 (and WinCE6)
Device with multiple IP interfaces, ARM IMX6

On our WinCE device several ip interfaces exist. The application is looking for the Ethernet interface and provides the interface to the discovery service. Otherwise the discovery service cannot send its notification to the right network segment.

The original code is working, if the device has only one interface

            unsigned long iface = getInterfaceIP();
            soap->ipv4_multicast_if = (char *) &iface;

Under Win32 it goes through following lines of code in stdsoap2.cpp and for takeing the right interface. But under UNDER_CE it's disabled. We can enable it in teh code and it works

The test:

            struct soap* soap = soap_new1(SOAP_IO_UDP);

            unsigned long iface = getInterfaceIP(i->getIPAddress());
            soap->ipv4_multicast_if = (char *) &iface;

            int res = soap_wsdd_Hello(soap,
                SOAP_WSDD_ADHOC,      // mode
                "soap.udp://239.255.255.250:3702",         // address of TS
                soap_wsa_rand_uuid(soap),                   // message ID
                NULL,

and the code fragment in stdsoap2.cpp

    if ((soap->omode & SOAP_IO_UDP) && soap->ipv4_multicast_if && !soap->ipv6_multicast_if)
    { if (setsockopt(sk, IPPROTO_IP, IP_MULTICAST_IF, (char*)soap->ipv4_multicast_if, sizeof(struct in_addr)))
#ifndef WINDOWS
      { soap->errnum = soap_socket_errno(sk);
        soap_set_receiver_error(soap, tcp_error(soap), "setsockopt IP_MULTICAST_IF failed in tcp_connect()", SOAP_TCP_ERROR);
        soap->fclosesocket(soap, sk);
#ifdef WITH_IPV6
        freeaddrinfo(ressave);
#endif
        return SOAP_INVALID_SOCKET;
      }

Can we enabel the code by default? (UNDER_CE)
I was able to build it under WinCE6. If soap->ipv4_multicast_if==NULL it doesn't matter anyway.

Discussion

  • thomas65g

    thomas65g - 2017-01-11

    INADDR_ANY binds the socket to all available interfaces, and that's true for Win32 and Linux, but Windows Embedded Compact 7 has its limitations

     
  • Robert van Engelen

    • status: open --> open-accepted
    • assigned_to: Robert van Engelen
     
  • Robert van Engelen

    In stdsoap2.c[pp] you can fix this issue in tcp_connect() by moving the closing #endif of #ifndef UNDER_CE up to the line before #ifdef IP_MULTICAST_TTL. This enables the IP_MULTICAST_TTL code with ipv4_multicast_if settings.

    This fix will be part of 2.8.41 available soon.

     
  • Robert van Engelen

    • status: open-accepted --> pending-fixed
     
  • Robert van Engelen

    • status: pending-fixed --> closed-fixed
     

Log in to post a comment.