This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC1312R7: Multicast using wfantund and linux applications

Part Number: CC1312R7

Tool/software:

Hi All,

I'm working on a system which runs on a linux host with a CC1312R7 based radio for communication with a Wi-SUN network. I would like to use multicast CoAP messages to trigger behaviour in my fleet of devices.

My FAN devices support multicast and have successfully received and processed multicasts sent using pyspinel. The `udp` command worked out of the box for multicast. I was able to get the `coap` command to send a multicast GET after porting some multicast handling logic from the the `udp` command. Specifically, I needed to add the following code block and add the resulting _extension_headers to the generated packet. 

        if ipaddress.IPv6Address(dst).is_multicast:
            # Tunnel the IPv6 header + frame (containing the multicast address)
            _extension_headers = [ipv6.HopByHop(options=[
                                 ipv6.HopByHopOption(ipv6.HopByHopOptionHeader(_type=0x6d),
                                 ipv6.MPLOption(S=3, M=0, V=0, sequence=self._get_next_mpl_seq_number(),
                                 seed_id=ipaddress.ip_address(src).packed))])]
            _extension_headers.append(ipv6.IPv6Header(source_address=src,
                                                      destination_address=dst,
                                                      hop_limit=hop_limit))
            dst = "ff03::fc" # Use the realm-all-forwarders address for the outer ipv6 header

Next, I tried to switch to `wfantund` so that I can use network sockets from various user space applications. When I do this, the devices do not receive the multicast messages. I've tried multicast pings (`ping6 -I wfan0 ff03::1` for example) as well as CoAP using libcoap and aiocoap in python. In the case of the ping, I also get a response from the BR, but none of the connected devices. In all cases, I can see the multicast packet in wireshark on the wfan0 interface.  This indicates that the packet is being sent to the linux side of the interface. I can also see this in the logs when I set the log level to `all`. I don't seem to see code in wfantund that handled this either.

When I reference other vendors documentation on sending multicast through their border router implementations they set the IPV6_MULTICAST_HOPS and SO_BINDTODEVICE socket options. I've also tried IPV6_MULTICAST_IF instead of SO_BINDTODEVICE. I've also tried joining the multicast group I'm sending to before I send the message.

What is the right way to enable an application to send multicasts via the linux socket interface (raw sockets aren't an option here as we need to be able to use libraries on top). Is there a change that should happen to wfantund or some other utility like a multicast routing daemon that I'm missing?

Thanks

  • For clarity, the pyspinel application that I'm using is from https://github.com/TexasInstruments/ti-wisunfan-pyspinel, specifically commit `7f528ccc42a977e042348f457615ae6253499730` (the current release branch). For wfantund, I'm using 1.00.07.

  • Hi David,

    I was able to reproduce the error that you are seeing.
    A workaround that I see with wfantund is to use the IPv6 library to generate the packet and send it to the border router.

    I opened an internal discussion with R&D to get their input for a high level solution and will update the thread after our discussion.

    Kind regards,
    Theo

  • Thanks Theo, I'm glad to hear you can reproduce the problem. The workaround you mentioned sounds like the raw sockets approach that I mentioned. This approach isn't acceptable as it wouldn't integrate with existing apps & libraries (eg libcoap, aiocoap). Maintaining a modified version of core libraries like this is not something that I'm currently looking to explore as it adds significant overhead.

    Ideally it would work by just specifying the interface the mutlicast is sent on. If some sort of configuration in wfantund of addresses which were allowed to be forwarded this way needed to be made I think we could make that work (ie, add it to the config file, use wfanctl or use the dbus interface to set it).

  • Hi David,

    yes exactly. The workaround is building and transmitting the raw IP packet and this procedure could be simplified using the IPv6 library. The conversion could also be implemented in wfanctl by adding a new command.

    The only "highlevel" workaround that I see is adding a new spinel command that you use to pass the information to the border router. Then you could use the CoAP library on the border router to build the packet.

    I already forwarded the request to R&D and will continue the discussion. 

    Kind regards,
    Theo

  • Hi David,

    we have found the root cause for this issue and work on providing you a fix soon.

    Kind regards,
    Theo

  • Thanks Theo, I look forward to testing the fix.

  • Hi David, 

    I reached out to you by mail providing the patch that we developed.

    If someone else also needs this patch please reach out on e2e referring to this thread.

    Kind regards,
    Theo