Spinel UDP forward

108 views
Skip to first unread message

Armin

unread,
Sep 6, 2019, 1:02:37 AM9/6/19
to openthread-users
Hello all,

I have a question concerning the SPINEL_PROP_THREAD_UDP_FORWARD_STREAM property in spinel. I tried to send an udp message using the spinel protocol but it didn't work.
During investigation of this I also debugged the ncp to see what happens but everything looks fine; as far as I can see the message is created correctly.

Is there something else that has to be activated before it is possible to send a udp message?
What I also saw is that one must choose a port that was already allocated because otherwise the message gets dropped immediately.
Is it possible to open/bind a udp socket over Spinel protocol? I didn't find a suitable property.

What I did was:
 - send SPINEL_CMD_PROP_VALUE_SET  -  SPINEL_PROP_NET_IF_UP  -  true
 - send SPINEL_CMD_PROP_VALUE_SET  -  SPINEL_PROP_MAC_15_4_PANID  -  0xABCD
 - send SPINEL_CMD_PROP_VALUE_SET  -  SPINEL_PROP_NET_STACK_UP  -  true
 - send SPINEL_CMD_PROP_VALUE_SET  -  SPINEL_PROP_THREAD_UDP_FORWARD_STREAM  -  payload [0x04, 0x00, 0x01, 0x02, 0x03, 0x04 ], remUdpPort [0x00, 0xc0], remIPv6Addr [ 0xFF, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01], localUdpPort [0x00, 0xc0]

Am I doing something wrong?
Or do I have to add a Vendor Specific Property for this kind of stuff?

Thanks, Regards
Armin

Yakun Xu

unread,
Sep 6, 2019, 6:02:04 AM9/6/19
to openthread-users
Hi Armin,

It will be much helpful if you could provide more context. I don't understand why you need use this property to send message.
 
The UDP_FORWARD_STREAM was designed to support mapping a UdpSocket on NCP side to a socket on Host side(e.g. Linux). As a result, the UdpSocket on NCP side can receive packets from external networks, such as Wi-Fi, Ethernet and so on.

For example, the Thread border agent service listens on UDP port 49191 on NCP's stack. otbr-agent runs on Linux and also open a socket to listen to port 49191, and when a packet is received from this packet, it delivers the packet to wpantund through d-bus. wpantund then will set the SPINEL_PROP_THREAD_UDP_FORWARD_STREAM property to deliver the packet to NCP. NCP's socket finally receives this packet. The response goes the same back path.

Yakun

Armin

unread,
Oct 8, 2019, 9:40:00 AM10/8/19
to openthread-users
Hi Yakun,

I just wanted to use this property because I thought that it is the most suitable one for my usecase.
What I want to do is just to send out a UDP message. In detail that means that another microprocessor defines a port, a payload and an address and transmits this over spinel to the NCP.
Which of the properties would be suitable for doing this? I thought that the UDP_FORWARD_STREAM sounds like a good solution. Is there some better property for this case?

Regards Armin

Yakun Xu

unread,
Oct 8, 2019, 9:54:07 AM10/8/19
to Armin, openthread-users
Does the other microcontroller have network stack? If so, you should use STREAM_NET property, which tx IPv6 packets. If not, i think a new mechanism has to be added. UDP forward is not for this purpose. 

--
You received this message because you are subscribed to the Google Groups "openthread-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openthread-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openthread-users/053ed235-e941-4192-811e-18904cdda6c8%40googlegroups.com.

Armin

unread,
Oct 8, 2019, 10:53:58 AM10/8/19
to openthread-users
No, the other microcontroller does not have a network stack unfortunately. Ok, I thought that I miss something.
Good, so one option would be to use some open network stack on the host microcontroller or adding some new property that takes the necessary values. Am I right?
To unsubscribe from this group and stop receiving emails from it, send an email to openthre...@googlegroups.com.

Yakun Xu

unread,
Oct 8, 2019, 5:44:23 PM10/8/19
to Armin, openthread-users
Yes, you may consider using lwIP on the other microcontroller. If you choose to define new spinel properties to expose UDP sockets APIs, it is also doable: UDP_SOCKET_LIST to maintain list of sockets open by spinel master. UDP_SOCKET_STREAM to exchange UDP packets.

To unsubscribe from this group and stop receiving emails from it, send an email to openthread-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openthread-users/8b60dbcc-9f36-4c06-832d-41745adefa09%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages