TCP assert error logs


Vakul Garg <vakul.garg@...>
 

Hi

 

I have two threads on my system communicating using TCP over loopback interface.

I am getting following errors.

 

[net/tcp] [ERR] net_tcp_get_hdr: {assert: 'frag' failed}

[net/tcp] [ERR] net_tcp_send_pkt: Packet 0x20004664 does not contain TCP header

[net/tcp] [ERR] net_tcp_get_hdr: {assert: 'frag' failed}

[net/tcp] [ERR] net_tcp_send_pkt: Packet 0x20004664 does not contain TCP header

[net/tcp] [ERR] net_tcp_get_hdr: {assert: 'frag' failed}

[net/tcp] [ERR] net_tcp_send_pkt: Packet 0x20004664 does not contain TCP header

[net/buf] [ERR] net_buf_unref_debug: net_pkt_frag_unref():826: buf 0x200046a0 double free

[net/buf] [ERR] net_buf_unref_debug: net_pkt_frag_unref():826: buf 0x200046a0 double free

[net/buf] [ERR] net_buf_unref_debug: net_pkt_frag_unref():826: buf 0x20004830 double free

 

Can someone help?

 

Regards, Vakul


Paul Sokolovsky
 

Hello Vakul,

On Sat, 9 Sep 2017 06:47:35 +0000
Vakul Garg <vakul.garg@nxp.com> wrote:

Hi

I have two threads on my system communicating using TCP over loopback
interface. I am getting following errors.
To the best of my knowledge, there is (was) no loopback interface
support in Zephyr. So, I'd interested to know how to achieved the
setup above.


[net/tcp] [ERR] net_tcp_get_hdr: {assert: 'frag' failed}
[net/tcp] [ERR] net_tcp_send_pkt: Packet 0x20004664 does not contain
TCP header [net/tcp] [ERR] net_tcp_get_hdr: {assert: 'frag' failed}
[net/tcp] [ERR] net_tcp_send_pkt: Packet 0x20004664 does not contain
TCP header [net/tcp] [ERR] net_tcp_get_hdr: {assert: 'frag' failed}
[net/tcp] [ERR] net_tcp_send_pkt: Packet 0x20004664 does not contain
TCP header [net/buf] [ERR] net_buf_unref_debug:
net_pkt_frag_unref():826: buf 0x200046a0 double free [net/buf] [ERR]
net_buf_unref_debug: net_pkt_frag_unref():826: buf 0x200046a0 double
free [net/buf] [ERR] net_buf_unref_debug: net_pkt_frag_unref():826:
buf 0x20004830 double free

Can someone help?

Regards, Vakul

--
Best Regards,
Paul

Linaro.org | Open source software for ARM SoCs
Follow Linaro: http://www.facebook.com/pages/Linaro
http://twitter.com/#!/linaroorg - http://www.linaro.org/linaro-blog


Vakul Garg <vakul.garg@...>
 

I just open a TCP server socket and let it listen for new connections on 127.0.0.1 on a given server port.

Then another thread creates a TCP client socket and connects to the 127.0.0.1 on the same server port.
After connection is successful, client sends one data message on the socket.

-----Original Message-----
From: Paul Sokolovsky [mailto:paul.sokolovsky@linaro.org]
Sent: Saturday, September 09, 2017 2:57 PM
To: Vakul Garg <vakul.garg@nxp.com>
Cc: zephyr-users@lists.zephyrproject.org
Subject: Re: [Zephyr-users] TCP assert error logs

Hello Vakul,

On Sat, 9 Sep 2017 06:47:35 +0000
Vakul Garg <vakul.garg@nxp.com> wrote:

Hi

I have two threads on my system communicating using TCP over loopback
interface. I am getting following errors.
To the best of my knowledge, there is (was) no loopback interface support in Zephyr. So, I'd interested to know how to achieved the setup above.


[net/tcp] [ERR] net_tcp_get_hdr: {assert: 'frag' failed} [net/tcp]
[ERR] net_tcp_send_pkt: Packet 0x20004664 does not contain TCP header
[net/tcp] [ERR] net_tcp_get_hdr: {assert: 'frag' failed} [net/tcp]
[ERR] net_tcp_send_pkt: Packet 0x20004664 does not contain TCP header
[net/tcp] [ERR] net_tcp_get_hdr: {assert: 'frag' failed} [net/tcp]
[ERR] net_tcp_send_pkt: Packet 0x20004664 does not contain TCP header
[net/buf] [ERR] net_buf_unref_debug:
net_pkt_frag_unref():826: buf 0x200046a0 double free [net/buf] [ERR]
net_buf_unref_debug: net_pkt_frag_unref():826: buf 0x200046a0 double
free [net/buf] [ERR] net_buf_unref_debug: net_pkt_frag_unref():826:
buf 0x20004830 double free

Can someone help?

Regards, Vakul

--
Best Regards,
Paul

Linaro.org | Open source software for ARM SoCs Follow Linaro: http://www.facebook.com/pages/Linaro
http://twitter.com/#!/linaroorg - http://www.linaro.org/linaro-blog


Paul Sokolovsky
 

Hello Vakul,

On Sat, 9 Sep 2017 09:31:14 +0000
Vakul Garg <vakul.garg@nxp.com> wrote:

I just open a TCP server socket and let it listen for new connections
on 127.0.0.1 on a given server port.
Right, that might work, thanks to
https://gerrit.zephyrproject.org/r/#/c/7007/ , and if you verified, it
apparently does (I don't remember if I ever using 127.0.0.1 address,
I usually tried to use a local interface address in such cases, i.e.
192.0.2.1 by default). But just to get terminology right, there's no
explicit loopback interface in Zephyr, it's just an adhoc check for
the conventional loopback address (though this note is probably
irrelevant for your usecase, so feel free to ignore it [for now]).

Then another thread creates a TCP client socket and connects to the
127.0.0.1 on the same server port. After connection is successful,
client sends one data message on the socket.
What can I say? With such scenario, you went farther than I. Last time I
tried, it wasn't possible to establish a TCP connection under such
conditions at all: https://jira.zephyrproject.org/browse/ZEP-2001 .

I'd suggest to add some comments to the above ticket, describing your
usecase. And ultimately, we'd need a typical small testcase to
reproduce the issue, so feel free to post your code to make a step
towards progress in that direction. I faced that issue when testing
networking support in Zephyr.JS and MicroPython projects, so there're
no readily available minimal testcases.



Thanks,
Paul



-----Original Message-----
From: Paul Sokolovsky [mailto:paul.sokolovsky@linaro.org]
Sent: Saturday, September 09, 2017 2:57 PM
To: Vakul Garg <vakul.garg@nxp.com>
Cc: zephyr-users@lists.zephyrproject.org
Subject: Re: [Zephyr-users] TCP assert error logs

Hello Vakul,

On Sat, 9 Sep 2017 06:47:35 +0000
Vakul Garg <vakul.garg@nxp.com> wrote:

Hi

I have two threads on my system communicating using TCP over
loopback interface. I am getting following errors.
To the best of my knowledge, there is (was) no loopback interface
support in Zephyr. So, I'd interested to know how to achieved the
setup above.


[net/tcp] [ERR] net_tcp_get_hdr: {assert: 'frag' failed} [net/tcp]
[ERR] net_tcp_send_pkt: Packet 0x20004664 does not contain TCP
header [net/tcp] [ERR] net_tcp_get_hdr: {assert: 'frag' failed}
[net/tcp] [ERR] net_tcp_send_pkt: Packet 0x20004664 does not
contain TCP header [net/tcp] [ERR] net_tcp_get_hdr: {assert: 'frag'
failed} [net/tcp] [ERR] net_tcp_send_pkt: Packet 0x20004664 does
not contain TCP header [net/buf] [ERR] net_buf_unref_debug:
net_pkt_frag_unref():826: buf 0x200046a0 double free [net/buf] [ERR]
net_buf_unref_debug: net_pkt_frag_unref():826: buf 0x200046a0
double free [net/buf] [ERR] net_buf_unref_debug:
net_pkt_frag_unref():826: buf 0x20004830 double free

Can someone help?

Regards, Vakul

--
Best Regards,
Paul

Linaro.org | Open source software for ARM SoCs Follow Linaro:
http://www.facebook.com/pages/Linaro http://twitter.com/#!/linaroorg
- http://www.linaro.org/linaro-blog


--
Best Regards,
Paul

Linaro.org | Open source software for ARM SoCs
Follow Linaro: http://www.facebook.com/pages/Linaro
http://twitter.com/#!/linaroorg - http://www.linaro.org/linaro-blog


Vakul Garg <vakul.garg@...>
 

Hello Paul

I have attached a test case with the given ticket.

Regards

Vakul

-----Original Message-----
From: Paul Sokolovsky [mailto:paul.sokolovsky@linaro.org]
Sent: Monday, September 11, 2017 4:52 PM
To: Vakul Garg <vakul.garg@nxp.com>
Cc: zephyr-users@lists.zephyrproject.org
Subject: Re: [Zephyr-users] TCP assert error logs

Hello Vakul,

On Sat, 9 Sep 2017 09:31:14 +0000
Vakul Garg <vakul.garg@nxp.com> wrote:

I just open a TCP server socket and let it listen for new connections
on 127.0.0.1 on a given server port.
Right, that might work, thanks to
https://gerrit.zephyrproject.org/r/#/c/7007/ , and if you verified, it apparently does (I don't remember if I ever using 127.0.0.1 address, I usually tried to use a local interface address in such cases, i.e.
192.0.2.1 by default). But just to get terminology right, there's no explicit loopback interface in Zephyr, it's just an adhoc check for the conventional loopback address (though this note is probably irrelevant for your usecase, so feel free to ignore it [for now]).

Then another thread creates a TCP client socket and connects to the
127.0.0.1 on the same server port. After connection is successful,
client sends one data message on the socket.
What can I say? With such scenario, you went farther than I. Last time I tried, it wasn't possible to establish a TCP connection under such conditions at all: https://jira.zephyrproject.org/browse/ZEP-2001 .

I'd suggest to add some comments to the above ticket, describing your usecase. And ultimately, we'd need a typical small testcase to reproduce the issue, so feel free to post your code to make a step towards progress in that direction. I faced that issue when testing networking support in Zephyr.JS and MicroPython projects, so there're no readily available minimal testcases.



Thanks,
Paul



-----Original Message-----
From: Paul Sokolovsky [mailto:paul.sokolovsky@linaro.org]
Sent: Saturday, September 09, 2017 2:57 PM
To: Vakul Garg <vakul.garg@nxp.com>
Cc: zephyr-users@lists.zephyrproject.org
Subject: Re: [Zephyr-users] TCP assert error logs

Hello Vakul,

On Sat, 9 Sep 2017 06:47:35 +0000
Vakul Garg <vakul.garg@nxp.com> wrote:

Hi

I have two threads on my system communicating using TCP over
loopback interface. I am getting following errors.
To the best of my knowledge, there is (was) no loopback interface
support in Zephyr. So, I'd interested to know how to achieved the
setup above.


[net/tcp] [ERR] net_tcp_get_hdr: {assert: 'frag' failed} [net/tcp]
[ERR] net_tcp_send_pkt: Packet 0x20004664 does not contain TCP
header [net/tcp] [ERR] net_tcp_get_hdr: {assert: 'frag' failed}
[net/tcp] [ERR] net_tcp_send_pkt: Packet 0x20004664 does not contain
TCP header [net/tcp] [ERR] net_tcp_get_hdr: {assert: 'frag'
failed} [net/tcp] [ERR] net_tcp_send_pkt: Packet 0x20004664 does not
contain TCP header [net/buf] [ERR] net_buf_unref_debug:
net_pkt_frag_unref():826: buf 0x200046a0 double free [net/buf] [ERR]
net_buf_unref_debug: net_pkt_frag_unref():826: buf 0x200046a0 double
free [net/buf] [ERR] net_buf_unref_debug:
net_pkt_frag_unref():826: buf 0x20004830 double free

Can someone help?

Regards, Vakul

--
Best Regards,
Paul

Linaro.org | Open source software for ARM SoCs Follow Linaro:
http://www.facebook.com/pages/Linaro http://twitter.com/#!/linaroorg
- http://www.linaro.org/linaro-blog


--
Best Regards,
Paul

Linaro.org | Open source software for ARM SoCs Follow Linaro: http://www.facebook.com/pages/Linaro
http://twitter.com/#!/linaroorg - http://www.linaro.org/linaro-blog


Paul Sokolovsky
 

Hello Vakul,

On Tue, 12 Sep 2017 09:09:10 +0000
Vakul Garg <vakul.garg@nxp.com> wrote:

Hello Paul

I have attached a test case with the given ticket.
Thanks for that! It's on my todo list to look into that issue again,
the testcase will be helpful then. In the meantime, following may be
helpful for you:

1. UDP communication using a local interface works in Zephyr, we have
a testcase for that in tests/net/socket/udp/

2. If you need TCP communication, you would need to use HOST-Zephyr
communication. (Well, there is also a setup to allow 2 Zephyr QEMU
instances to communicate with each other, I didn't check it for a while
though).


Regards

Vakul


-----Original Message-----
From: Paul Sokolovsky [mailto:paul.sokolovsky@linaro.org]
Sent: Monday, September 11, 2017 4:52 PM
To: Vakul Garg <vakul.garg@nxp.com>
Cc: zephyr-users@lists.zephyrproject.org
Subject: Re: [Zephyr-users] TCP assert error logs

Hello Vakul,

On Sat, 9 Sep 2017 09:31:14 +0000
Vakul Garg <vakul.garg@nxp.com> wrote:

I just open a TCP server socket and let it listen for new
connections on 127.0.0.1 on a given server port.
Right, that might work, thanks to
https://gerrit.zephyrproject.org/r/#/c/7007/ , and if you verified,
it apparently does (I don't remember if I ever using 127.0.0.1
address, I usually tried to use a local interface address in such
cases, i.e. 192.0.2.1 by default). But just to get terminology right,
there's no explicit loopback interface in Zephyr, it's just an adhoc
check for the conventional loopback address (though this note is
probably irrelevant for your usecase, so feel free to ignore it [for
now]).

Then another thread creates a TCP client socket and connects to the
127.0.0.1 on the same server port. After connection is successful,
client sends one data message on the socket.
What can I say? With such scenario, you went farther than I. Last
time I tried, it wasn't possible to establish a TCP connection under
such conditions at all:
https://jira.zephyrproject.org/browse/ZEP-2001 .

I'd suggest to add some comments to the above ticket, describing your
usecase. And ultimately, we'd need a typical small testcase to
reproduce the issue, so feel free to post your code to make a step
towards progress in that direction. I faced that issue when testing
networking support in Zephyr.JS and MicroPython projects, so there're
no readily available minimal testcases.



Thanks,
Paul



-----Original Message-----
From: Paul Sokolovsky [mailto:paul.sokolovsky@linaro.org]
Sent: Saturday, September 09, 2017 2:57 PM
To: Vakul Garg <vakul.garg@nxp.com>
Cc: zephyr-users@lists.zephyrproject.org
Subject: Re: [Zephyr-users] TCP assert error logs

Hello Vakul,

On Sat, 9 Sep 2017 06:47:35 +0000
Vakul Garg <vakul.garg@nxp.com> wrote:

Hi

I have two threads on my system communicating using TCP over
loopback interface. I am getting following errors.
To the best of my knowledge, there is (was) no loopback interface
support in Zephyr. So, I'd interested to know how to achieved the
setup above.


[net/tcp] [ERR] net_tcp_get_hdr: {assert: 'frag' failed}
[net/tcp] [ERR] net_tcp_send_pkt: Packet 0x20004664 does not
contain TCP header [net/tcp] [ERR] net_tcp_get_hdr: {assert:
'frag' failed} [net/tcp] [ERR] net_tcp_send_pkt: Packet
0x20004664 does not contain TCP header [net/tcp] [ERR]
net_tcp_get_hdr: {assert: 'frag' failed} [net/tcp] [ERR]
net_tcp_send_pkt: Packet 0x20004664 does not contain TCP header
[net/buf] [ERR] net_buf_unref_debug: net_pkt_frag_unref():826:
buf 0x200046a0 double free [net/buf] [ERR] net_buf_unref_debug:
net_pkt_frag_unref():826: buf 0x200046a0 double free [net/buf]
[ERR] net_buf_unref_debug: net_pkt_frag_unref():826: buf
0x20004830 double free

Can someone help?

Regards, Vakul

--
Best Regards,
Paul

Linaro.org | Open source software for ARM SoCs Follow Linaro:
http://www.facebook.com/pages/Linaro http://twitter.com/#!/linaroorg
- http://www.linaro.org/linaro-blog


--
Best Regards,
Paul

Linaro.org | Open source software for ARM SoCs Follow Linaro:
http://www.facebook.com/pages/Linaro http://twitter.com/#!/linaroorg
- http://www.linaro.org/linaro-blog


--
Best Regards,
Paul

Linaro.org | Open source software for ARM SoCs
Follow Linaro: http://www.facebook.com/pages/Linaro
http://twitter.com/#!/linaroorg - http://www.linaro.org/linaro-blog


Vakul Garg <vakul.garg@...>
 

Hi Paul

UDP loopback works and I can make progress with it for now.

(Ultimately, I need to move to some non-networking IPC such as mailbox or pipe.
The problem I face with that now is that I cannot multiplex these zephyr IPC in POSIX poll() along with socket descriptors.)

Thanks & Regards

Vakul

-----Original Message-----
From: Paul Sokolovsky [mailto:paul.sokolovsky@linaro.org]
Sent: Wednesday, September 13, 2017 1:08 PM
To: Vakul Garg <vakul.garg@nxp.com>
Cc: zephyr-users@lists.zephyrproject.org
Subject: Re: [Zephyr-users] TCP assert error logs

Hello Vakul,

On Tue, 12 Sep 2017 09:09:10 +0000
Vakul Garg <vakul.garg@nxp.com> wrote:

Hello Paul

I have attached a test case with the given ticket.
Thanks for that! It's on my todo list to look into that issue again, the testcase will be helpful then. In the meantime, following may be helpful for you:

1. UDP communication using a local interface works in Zephyr, we have a testcase for that in tests/net/socket/udp/

2. If you need TCP communication, you would need to use HOST-Zephyr communication. (Well, there is also a setup to allow 2 Zephyr QEMU instances to communicate with each other, I didn't check it for a while though).


Regards

Vakul


-----Original Message-----
From: Paul Sokolovsky [mailto:paul.sokolovsky@linaro.org]
Sent: Monday, September 11, 2017 4:52 PM
To: Vakul Garg <vakul.garg@nxp.com>
Cc: zephyr-users@lists.zephyrproject.org
Subject: Re: [Zephyr-users] TCP assert error logs

Hello Vakul,

On Sat, 9 Sep 2017 09:31:14 +0000
Vakul Garg <vakul.garg@nxp.com> wrote:

I just open a TCP server socket and let it listen for new
connections on 127.0.0.1 on a given server port.
Right, that might work, thanks to
https://gerrit.zephyrproject.org/r/#/c/7007/ , and if you verified, it
apparently does (I don't remember if I ever using 127.0.0.1 address, I
usually tried to use a local interface address in such cases, i.e.
192.0.2.1 by default). But just to get terminology right, there's no
explicit loopback interface in Zephyr, it's just an adhoc check for
the conventional loopback address (though this note is probably
irrelevant for your usecase, so feel free to ignore it [for now]).

Then another thread creates a TCP client socket and connects to the
127.0.0.1 on the same server port. After connection is successful,
client sends one data message on the socket.
What can I say? With such scenario, you went farther than I. Last time
I tried, it wasn't possible to establish a TCP connection under such
conditions at all:
https://jira.zephyrproject.org/browse/ZEP-2001 .

I'd suggest to add some comments to the above ticket, describing your
usecase. And ultimately, we'd need a typical small testcase to
reproduce the issue, so feel free to post your code to make a step
towards progress in that direction. I faced that issue when testing
networking support in Zephyr.JS and MicroPython projects, so there're
no readily available minimal testcases.



Thanks,
Paul



-----Original Message-----
From: Paul Sokolovsky [mailto:paul.sokolovsky@linaro.org]
Sent: Saturday, September 09, 2017 2:57 PM
To: Vakul Garg <vakul.garg@nxp.com>
Cc: zephyr-users@lists.zephyrproject.org
Subject: Re: [Zephyr-users] TCP assert error logs

Hello Vakul,

On Sat, 9 Sep 2017 06:47:35 +0000
Vakul Garg <vakul.garg@nxp.com> wrote:

Hi

I have two threads on my system communicating using TCP over
loopback interface. I am getting following errors.
To the best of my knowledge, there is (was) no loopback interface
support in Zephyr. So, I'd interested to know how to achieved the
setup above.


[net/tcp] [ERR] net_tcp_get_hdr: {assert: 'frag' failed} [net/tcp]
[ERR] net_tcp_send_pkt: Packet 0x20004664 does not contain TCP
header [net/tcp] [ERR] net_tcp_get_hdr: {assert:
'frag' failed} [net/tcp] [ERR] net_tcp_send_pkt: Packet
0x20004664 does not contain TCP header [net/tcp] [ERR]
net_tcp_get_hdr: {assert: 'frag' failed} [net/tcp] [ERR]
net_tcp_send_pkt: Packet 0x20004664 does not contain TCP header
[net/buf] [ERR] net_buf_unref_debug: net_pkt_frag_unref():826:
buf 0x200046a0 double free [net/buf] [ERR] net_buf_unref_debug:
net_pkt_frag_unref():826: buf 0x200046a0 double free [net/buf]
[ERR] net_buf_unref_debug: net_pkt_frag_unref():826: buf
0x20004830 double free

Can someone help?

Regards, Vakul

--
Best Regards,
Paul

Linaro.org | Open source software for ARM SoCs Follow Linaro:
http://www.facebook.com/pages/Linaro http://twitter.com/#!/linaroorg
- http://www.linaro.org/linaro-blog


--
Best Regards,
Paul

Linaro.org | Open source software for ARM SoCs Follow Linaro:
http://www.facebook.com/pages/Linaro http://twitter.com/#!/linaroorg
- http://www.linaro.org/linaro-blog


--
Best Regards,
Paul

Linaro.org | Open source software for ARM SoCs Follow Linaro: http://www.facebook.com/pages/Linaro
http://twitter.com/#!/linaroorg - http://www.linaro.org/linaro-blog


Paul Sokolovsky
 

On Wed, 13 Sep 2017 08:50:02 +0000
Vakul Garg <vakul.garg@nxp.com> wrote:

UDP loopback works and I can make progress with it for now.

(Ultimately, I need to move to some non-networking IPC such as
mailbox or pipe. The problem I face with that now is that I cannot
multiplex these zephyr IPC in POSIX poll() along with socket
descriptors.)
Yes, POSIX bits is Zephyr are very initial and very bare so far - a bit
of threads and a bit of sockets support. There're neither
full-featured poll() implementation, nor fd's (file descriptors), nor
other POSIX IPC.

But there's definitely desire to extend POSIX support in Zephyr, so
any feedback is appreciated. (You may also want to route this feedback
via Maureen Helm, who's both on Zephyr and Linaro LITE TSCs, so with her
input, specific things may get planned and prioritized.)


Thanks & Regards

Vakul
[]

--
Best Regards,
Paul

Linaro.org | Open source software for ARM SoCs
Follow Linaro: http://www.facebook.com/pages/Linaro
http://twitter.com/#!/linaroorg - http://www.linaro.org/linaro-blog


Vakul Garg <vakul.garg@...>
 

Hi Paul

-----Original Message-----
From: Paul Sokolovsky [mailto:paul.sokolovsky@linaro.org]
Sent: Wednesday, September 13, 2017 4:51 PM
To: Vakul Garg <vakul.garg@nxp.com>
Cc: zephyr-users@lists.zephyrproject.org
Subject: Re: [Zephyr-users] TCP assert error logs

On Wed, 13 Sep 2017 08:50:02 +0000
Vakul Garg <vakul.garg@nxp.com> wrote:

UDP loopback works and I can make progress with it for now.

(Ultimately, I need to move to some non-networking IPC such as mailbox
or pipe. The problem I face with that now is that I cannot multiplex
these zephyr IPC in POSIX poll() along with socket
descriptors.)
Yes, POSIX bits is Zephyr are very initial and very bare so far - a bit of threads
and a bit of sockets support. There're neither full-featured poll()
implementation, nor fd's (file descriptors), nor other POSIX IPC.
I used TCP/UDP POSIX sockets between two local apps just because I thought I can't multiplex a
local IPC method such as mailbox/pipe with network sockets connected to a remote endpoint.

If I change my code to use net_context apis for remote networking and use mailbox/pipe between local apps,
will I be able to multiplex net_contexts with mailbox/pipes using k_poll mechanism?


But there's definitely desire to extend POSIX support in Zephyr, so any
feedback is appreciated. (You may also want to route this feedback via
Maureen Helm, who's both on Zephyr and Linaro LITE TSCs, so with her input,
specific things may get planned and prioritized.)


Thanks & Regards

Vakul
[]

--
Best Regards,
Paul

Linaro.org | Open source software for ARM SoCs Follow Linaro:
http://www.facebook.com/pages/Linaro
http://twitter.com/#!/linaroorg - http://www.linaro.org/linaro-blog


Paul Sokolovsky
 

Hello Vakul,

On Thu, 14 Sep 2017 05:14:55 +0000
Vakul Garg <vakul.garg@nxp.com> wrote:

[]

Yes, POSIX bits is Zephyr are very initial and very bare so far - a
bit of threads and a bit of sockets support. There're neither
full-featured poll() implementation, nor fd's (file descriptors),
nor other POSIX IPC.
I used TCP/UDP POSIX sockets between two local apps just because I
thought I can't multiplex a local IPC method such as mailbox/pipe
with network sockets connected to a remote endpoint.

If I change my code to use net_context apis for remote networking and
use mailbox/pipe between local apps, will I be able to multiplex
net_contexts with mailbox/pipes using k_poll mechanism?
Yes, there's k_poll() which can work with native Zephyr synchronization
primitives. But synchronization primitives is also what it's limited
to. A net context is not such. You interact with it not by using k_poll,
but by installing callbacks which will be called when something happens.

Then you can do something in a callback (put something in a queue,
release a semaphore, raise an event), and use that with k_poll. But
that's exactly how sockets are implemented!

So, there're few choices:

1. Implement more POSIX synchronization primitives. That would take
some time and effort of course.

2. If needed to be done quickly for experimentation, can use sockets'
net_context::recv_q in k_poll, with a usual warning that it's not
intended to be used like that, and is an implementation detail which can
be changed at any time.

3. The worst way (IMHO) is to duplicate what BSD Sockets already do in
some adhoc code. This way, Zephyr doesn't grow POSIX functionality,
doesn't have its sockets subsystem used, but the adhoc code is all
yours to maintain ;-).

[]

--
Best Regards,
Paul

Linaro.org | Open source software for ARM SoCs
Follow Linaro: http://www.facebook.com/pages/Linaro
http://twitter.com/#!/linaroorg - http://www.linaro.org/linaro-blog


Vakul Garg <vakul.garg@...>
 

Hi Paul

On the latest code on master branch, UDP send() on loopback address fails.

Regards

Vakul

-----Original Message-----
From: zephyr-users-bounces@lists.zephyrproject.org [mailto:zephyr-users-
bounces@lists.zephyrproject.org] On Behalf Of Vakul Garg
Sent: Wednesday, September 13, 2017 2:20 PM
To: Paul Sokolovsky <paul.sokolovsky@linaro.org>
Cc: zephyr-users@lists.zephyrproject.org
Subject: Re: [Zephyr-users] TCP assert error logs

[This sender failed our fraud detection checks and may not be who they
appear to be. Learn about spoofing at http://aka.ms/LearnAboutSpoofing]

Hi Paul

UDP loopback works and I can make progress with it for now.

(Ultimately, I need to move to some non-networking IPC such as mailbox or
pipe.
The problem I face with that now is that I cannot multiplex these zephyr IPC in
POSIX poll() along with socket descriptors.)

Thanks & Regards

Vakul


-----Original Message-----
From: Paul Sokolovsky [mailto:paul.sokolovsky@linaro.org]
Sent: Wednesday, September 13, 2017 1:08 PM
To: Vakul Garg <vakul.garg@nxp.com>
Cc: zephyr-users@lists.zephyrproject.org
Subject: Re: [Zephyr-users] TCP assert error logs

Hello Vakul,

On Tue, 12 Sep 2017 09:09:10 +0000
Vakul Garg <vakul.garg@nxp.com> wrote:

Hello Paul

I have attached a test case with the given ticket.
Thanks for that! It's on my todo list to look into that issue again, the testcase
will be helpful then. In the meantime, following may be helpful for you:

1. UDP communication using a local interface works in Zephyr, we have a
testcase for that in tests/net/socket/udp/

2. If you need TCP communication, you would need to use HOST-Zephyr
communication. (Well, there is also a setup to allow 2 Zephyr QEMU instances
to communicate with each other, I didn't check it for a while though).


Regards

Vakul


-----Original Message-----
From: Paul Sokolovsky [mailto:paul.sokolovsky@linaro.org]
Sent: Monday, September 11, 2017 4:52 PM
To: Vakul Garg <vakul.garg@nxp.com>
Cc: zephyr-users@lists.zephyrproject.org
Subject: Re: [Zephyr-users] TCP assert error logs

Hello Vakul,

On Sat, 9 Sep 2017 09:31:14 +0000
Vakul Garg <vakul.garg@nxp.com> wrote:

I just open a TCP server socket and let it listen for new
connections on 127.0.0.1 on a given server port.
Right, that might work, thanks to
https://gerrit.zephyrproject.org/r/#/c/7007/ , and if you verified, it
apparently does (I don't remember if I ever using 127.0.0.1 address, I
usually tried to use a local interface address in such cases, i.e.
192.0.2.1 by default). But just to get terminology right, there's no
explicit loopback interface in Zephyr, it's just an adhoc check for
the conventional loopback address (though this note is probably
irrelevant for your usecase, so feel free to ignore it [for now]).

Then another thread creates a TCP client socket and connects to the
127.0.0.1 on the same server port. After connection is successful,
client sends one data message on the socket.
What can I say? With such scenario, you went farther than I. Last time
I tried, it wasn't possible to establish a TCP connection under such
conditions at all:
https://jira.zephyrproject.org/browse/ZEP-2001 .

I'd suggest to add some comments to the above ticket, describing your
usecase. And ultimately, we'd need a typical small testcase to
reproduce the issue, so feel free to post your code to make a step
towards progress in that direction. I faced that issue when testing
networking support in Zephyr.JS and MicroPython projects, so there're
no readily available minimal testcases.



Thanks,
Paul



-----Original Message-----
From: Paul Sokolovsky [mailto:paul.sokolovsky@linaro.org]
Sent: Saturday, September 09, 2017 2:57 PM
To: Vakul Garg <vakul.garg@nxp.com>
Cc: zephyr-users@lists.zephyrproject.org
Subject: Re: [Zephyr-users] TCP assert error logs

Hello Vakul,

On Sat, 9 Sep 2017 06:47:35 +0000
Vakul Garg <vakul.garg@nxp.com> wrote:

Hi

I have two threads on my system communicating using TCP over
loopback interface. I am getting following errors.
To the best of my knowledge, there is (was) no loopback interface
support in Zephyr. So, I'd interested to know how to achieved the
setup above.


[net/tcp] [ERR] net_tcp_get_hdr: {assert: 'frag' failed} [net/tcp]
[ERR] net_tcp_send_pkt: Packet 0x20004664 does not contain TCP
header [net/tcp] [ERR] net_tcp_get_hdr: {assert:
'frag' failed} [net/tcp] [ERR] net_tcp_send_pkt: Packet
0x20004664 does not contain TCP header [net/tcp] [ERR]
net_tcp_get_hdr: {assert: 'frag' failed} [net/tcp] [ERR]
net_tcp_send_pkt: Packet 0x20004664 does not contain TCP header
[net/buf] [ERR] net_buf_unref_debug: net_pkt_frag_unref():826:
buf 0x200046a0 double free [net/buf] [ERR] net_buf_unref_debug:
net_pkt_frag_unref():826: buf 0x200046a0 double free [net/buf]
[ERR] net_buf_unref_debug: net_pkt_frag_unref():826: buf
0x20004830 double free

Can someone help?

Regards, Vakul

--
Best Regards,
Paul

Linaro.org | Open source software for ARM SoCs Follow Linaro:
http://www.facebook.com/pages/Linaro http://twitter.com/#!/linaroorg
- http://www.linaro.org/linaro-blog


--
Best Regards,
Paul

Linaro.org | Open source software for ARM SoCs Follow Linaro:
http://www.facebook.com/pages/Linaro http://twitter.com/#!/linaroorg
- http://www.linaro.org/linaro-blog


--
Best Regards,
Paul

Linaro.org | Open source software for ARM SoCs Follow Linaro:
http://www.facebook.com/pages/Linaro
http://twitter.com/#!/linaroorg - http://www.linaro.org/linaro-blog
_______________________________________________
Zephyr-users mailing list
Zephyr-users@lists.zephyrproject.org
https://lists.zephyrproject.org/mailman/listinfo/zephyr-users


Paul Sokolovsky
 

Hello,

On Thu, 12 Oct 2017 07:55:48 +0000
Vakul Garg <vakul.garg@nxp.com> wrote:

Hi Paul

On the latest code on master branch, UDP send() on loopback address
fails.
I submitted https://github.com/zephyrproject-rtos/zephyr/issues/4347 on
this. Feel free to submit such reports directly to the bugtracker too.


Regards

Vakul
[]

--
Best Regards,
Paul

Linaro.org | Open source software for ARM SoCs
Follow Linaro: http://www.facebook.com/pages/Linaro
http://twitter.com/#!/linaroorg - http://www.linaro.org/linaro-blog