sending netcat messages from mac to openthread

86 views
Skip to first unread message

TuKeZ

unread,
Jul 18, 2017, 5:00:33 AM7/18/17
to openthre...@googlegroups.com
Hello, i'm trying to send UDP messages from netcat to openthread.
i'm using command as such:
where IP6ADRESS are any of the ips listed by ipadrr at CLI and I'm able to ping6 it.

echo -n "foo" | nc -u -w1 -6 IP6ADDRESS%wpan0 10000

and I'm able to see the messages are sent with wireshark.

and my application is code is as such:

otSockAddr mSocket = {0};
otUdpSocket uSock = {0};

void init_udp(){
    otIp6SetReceiveCallback(m_app.p_ot_instance, &dataCallback, NULL);


    if(otUdpOpen(m_app.p_ot_instance, &uSock, &udpCallback, m_app.p_ot_instance) == OT_ERROR_NONE){}

    memcpy(&(mSocket.mAddress), findLocalAddr(m_app.p_ot_instance), sizeof(mSocket.mAddress));
    mSocket.mPort = 10000;
    mSocket.mScopeId = 8; //Tested 2,5,8

    if(otUdpBind(&uSock, &mSocket) == OT_ERROR_NONE){}
}

I've paired the device to the border router as per meshcop example and i'm able to receive ip address to the device.
findLocalAddr returns first entry where preferred == 1 and valid == 1 using list unicast addresses API call.

I'm able to see that i'm receiving some (crypted?) messages at dataCallback, but i'm never receiving any messages to the udpCallback.

How can I get my receive to work?

Jonathan Hui

unread,
Jul 18, 2017, 12:08:25 PM7/18/17
to TuKeZ, openthread-users
The `mScopeId` field is used to specify an interface identifier.  Currently, OpenThread supports a single interface (i.e. 8 is an invalid value).  Try setting the `mScopeId` field to 0 (to allow default interface selection) or 1 (to specify the Thread interface).

Hope that helps.

--
Jonathan Hui

On Tue, Jul 18, 2017 at 2:00 AM, TuKeZ <ltu...@gmail.com> wrote:
Hello, i'm trying to send UDP messages from netcat to openthread.
i'm using command as such:
where IP6ADRESS are any of the ips listed by ipadrr at CLI.

echo -n "foo" | nc -u -w1 -6 IP6ADDRESS%wpan0 10000

and I'm able to see the messages are sent with wireshark.

and my application is code is as such:

otSockAddr mSocket = {0};
otUdpSocket uSock = {0};

void init_udp(){
    otIp6SetReceiveCallback(m_app.p_ot_instance, &dataCallback, NULL);


    if(otUdpOpen(m_app.p_ot_instance, &uSock, &udpCallback, m_app.p_ot_instance) == OT_ERROR_NONE){}

    memcpy(&(mSocket.mAddress), findLocalAddr(m_app.p_ot_instance), sizeof(mSocket.mAddress));
    mSocket.mPort = 10000;
    mSocket.mScopeId = 8;

    if(otUdpBind(&uSock, &mSocket) == OT_ERROR_NONE){}
}

I've paired the device to the border router as per meshcop example and i'm able to receive ip address to the device.
findLocalAddr returns first entry where preferred == 1 and valid == 1 using list unicast addresses API call.

I'm able to see that i'm receiving some (crypted?) messages at dataCallback, but i'm never receiving any messages to the udpCallback.

How can I get my receive to work?

--
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-users+unsubscribe@googlegroups.com.
To post to this group, send email to openthread-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openthread-users/88ec4084-ea15-4110-87f6-d5e473ee6238%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

TuKeZ

unread,
Jul 19, 2017, 2:43:53 AM7/19/17
to openthread-users, ltu...@gmail.com, jon...@nestlabs.com
Awesome scopeid = 0 did miracles. I got confused the scope word with this
https://en.wikipedia.org/wiki/IPv6_address#Address_scopes

thank you for the help.
To unsubscribe from this group and stop receiving emails from it, send an email to openthread-use...@googlegroups.com.
To post to this group, send email to openthre...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages