Jeremy Link | 28 Jul 21:51 2014

using netconn_recv() and netconn_accept() in two different threads

I'm running FreeRTOS 8.1 and LwIP 1.3.2.

I have 2 sockets: one has a UDP listener and the other is TCP for a Telnet server.

The UDP listener will bind to and listen for packets on a specific port.

The Telnet server will just listen for a connection on a different port. Once it is established, command/responses are passed back and forth.

If  I run them independently, then no problems.

I I run both threads, then the TCP listener will Hard Fault inside the netconn_accept() call.

Any ideas?

Thanks.


-Jeremy

_______________________________________________
lwip-users mailing list
lwip-users@...
https://lists.nongnu.org/mailman/listinfo/lwip-users
Ivan Delamer | 28 Jul 19:47 2014

Re: IPV6 Porting

struct netif stores an array of ipv6 adresses in netif->ip6_addr[i]

You can also access those addresses via macro netif_ip6_addr(netif, i)

You may set any of those addresses manually, keeping in mind that index 
0 should be a link-local address.

One way to do it is to set a local variable and then copy it to netif. 
Or you can set it directly on netif struct.

Remember that addresses must be stored in network byte order, for that 
reason it helps to use macros that take care of byte ordering. Otherwise 
you can use htonl().

For example, to set fe80::1, do this

{
   ip6_addr_t my_addr;

   IP6_ADDR(&my_addr, 0, 0xFE, 0x80, 0x00, 0x00);
   IP6_ADDR(&my_addr, 1, 0x00, 0x00, 0x00, 0x00);
   IP6_ADDR(&my_addr, 2, 0x00, 0x00, 0x00, 0x00);
   IP6_ADDR(&my_addr, 3, 0x00, 0x00, 0x00, 0x01);

   ip6_addr_copy(netif->ip6_addr[0], my_addr);

   netif_ip6_addr_set_state(netif, 0, IP6_ADDR_TENTATIVE);
}

The last step, setting the state, is important for ND6 protocol to 
validate the address (e.g. no duplicate address in network).

You could use this process to set any address, if it is not link local 
use an index other than 0 in netif.

Cheers
Ivan

> Date: Sun, 27 Jul 2014 16:35:03 +0800
> From: "=?ISO-8859-1?B?ZmZkZHlieg==?=" <184453147@...>
> To: "=?ISO-8859-1?B?TWFpbGluZyBsaXN0IGZvciBsd0lQIHVzZXJz?="
> 	<lwip-users@...>,	"=?ISO-8859-1?B?bHdpcC11c2Vycw==?="
> 	<lwip-users@...>
> Subject: Re: [lwip-users] IPV6 Porting
> Message-ID: <tencent_27699797242C823A728E8845@...>
> Content-Type: text/plain; charset="iso-8859-1"
> 
> Thank you for your reply. I succeed in testing IPV6 via ND6 protocol.
> But I also want to test it using static IPV6 address, the process of
> doing this, I created linklocal address, then I use IP6_ADDR macro to
> add address to struct ip6addr, I use function netif_get_ip6_addr_match
> to bind struct netif and struct ip6_addr, Then you tell me using macro
> netif_ip6_addr_set_state. But I can't create IPV6 address, and struct
> netif did not contain any information about IPV6 address. Am I doing
> right?
> 
> 
> 
> 
> ------------------ Original ------------------
> From: "Ivan Delamer";
> Date: Tuesday, Jul 22, 2014 2:20 AM
> To: "lwip-users";
> Subject: Re: [lwip-users] IPV6 Porting
> 
> 
> 
> This used to be in one of the LwIP Wikia pages but now it is gone ...
> ??
> 
> The netif has some placeholders for IPv6 addresses:
> my_netif->ip6_addr[xx]. The number of addresses is configurable in
> lwipopts.h, usually 3 is a good number.
> 
> Usually address [0] is reserved for the link-local address. If your
> netif has a hw_addr configured you can use
> netif_create_ip6_linklocal_address() to create the address. You can
> manually create the rest of the adresses, or if you have adress
> auto-configuration enabled you can let the ND6 protocol generate the
> rest of the adresses with help from your IPv6 router. you should set
> netif->ip6_autoconfig_enabled = 1; and make sure it is enabled in
> lwipopts.h
> 
> Any address you manually configure, you should use the macro
> netif_ip6_addr_set_state(netif, addr_index, IP6_ADDR_TENTATIVE) to let
> ND6 protocol validate it.
> 
> That is all you need to get set up.
> 
> If you have any other questions just ask.
> 
> Cheers
> Ivan
> 
> 
> 
>> Date: Sun, 20 Jul 2014 15:22:12 +0800
>> From: "=?ISO-8859-1?B?ZmZkZHlieg==?=" <184453147@...>
>> To: "=?ISO-8859-1?B?bHdpcC11c2Vycw==?=" <lwip-users@...>
>> Subject: [lwip-users] IPV6 Porting
>> Message-ID: <tencent_0ABEC6691C9F864130DCBAE2@...>
>> Content-Type: text/plain; charset="iso-8859-1"
>> 
>> Hi,everyone. I try to port lwip-master to RT-Thread Operating
>> System(An embedded Real-Time open source system form china).I succeed
>> in running IPV4 application, but the main purpose for me is porting
>> IPV6 to it.
>> The wiki said that when you using ipv6 you can add macro LWIP_IPV6 in
>> lwipopts.h
>> But I don't know how to call some functions to set static IPV6
>> address. Is there any documents talking about it?
> 
> 
> _______________________________________________
> lwip-users mailing list
> lwip-users@...
> https://lists.nongnu.org/mailman/listinfo/lwip-users
Weaver, Tyler [GCS] | 25 Jul 20:13 2014

accepts_pending overflow with pcb's stuck in ESTABLISHED state

Hello,

 

accepts_pending never seems to decrement and connections get stuck in ESTABLISHED and never exit.  Eventually, the 256th attempt to connect fails.  What could cause this? 

 

Our current workaround is to call tcp_shutdown in the EXTABLISHED state with TF_GOT_FIN in the switch statement in tcp_process.  Then in tcp_bcb_purge the if statement that checks for SYN_RCVD is removed so that code executes every time, decrementing accepts_pending.

 

Thank you.

_______________________________________________
lwip-users mailing list
lwip-users@...
https://lists.nongnu.org/mailman/listinfo/lwip-users
ALP-Schoof | 22 Jul 09:53 2014

Can't connect through netconn API

Hello,

I'm using Netconn API (LWIP 1.4.1) and FreeRTOS to implement an FTP server.
When I want to make a listening connection
  struct netconn *ftp_listener = netconn_new(NETCONN_TCP);
  netconn_bind(ftp_listener, IPADDR_ANY, 21);
  netconn_listen(ftp_listener);
  netconn_accept(ftp_listener, &commandConnection);
everything will work fine, I can create a connection and send/receive data
through
  netconn_write(conn, data, length, NETCONN_COPY);
  netconn_recv(conn, &rcvBuff);

However when I want to connect to a server, I get an error. 

  struct netconn* nc = netconn_new(NETCONN_TCP);
  err_t err = netconn_connect(nc, &server, serverPort);
>>>>>>> err is -10 (ERR_ABRT) at this point
  for(; ; )
  {
    netconn_write(nc, "test", 5 , NETCONN_COPY);
    vTaskDelay(1000);
  }
I've checked all communications with Wireshark, but it appears LWIP doesn't
send any connection requests.

Cheers!

--
View this message in context: http://lwip.100.n7.nabble.com/Can-t-connect-through-netconn-API-tp22930.html
Sent from the lwip-users mailing list archive at Nabble.com.
Ivan Delamer | 21 Jul 20:20 2014

Re: IPV6 Porting

This used to be in one of the LwIP Wikia pages but now it is gone ... 
??

The netif has some placeholders for IPv6 addresses: 
my_netif->ip6_addr[xx]. The number of addresses is configurable in 
lwipopts.h, usually 3 is a good number.

Usually address [0] is reserved for the link-local address. If your 
netif has a hw_addr configured you can use 
netif_create_ip6_linklocal_address() to create the address. You can 
manually create the rest of the adresses, or if you have adress 
auto-configuration enabled you can let the ND6 protocol generate the 
rest of the adresses with help from your IPv6 router. you should set 
netif->ip6_autoconfig_enabled = 1; and make sure it is enabled in 
lwipopts.h

Any address you manually configure, you should use the macro 
netif_ip6_addr_set_state(netif, addr_index, IP6_ADDR_TENTATIVE) to let 
ND6 protocol validate it.

That is all you need to get set up.

If you have any other questions just ask.

Cheers
Ivan

> Date: Sun, 20 Jul 2014 15:22:12 +0800
> From: "=?ISO-8859-1?B?ZmZkZHlieg==?=" <184453147@...>
> To: "=?ISO-8859-1?B?bHdpcC11c2Vycw==?=" <lwip-users@...>
> Subject: [lwip-users] IPV6 Porting
> Message-ID: <tencent_0ABEC6691C9F864130DCBAE2@...>
> Content-Type: text/plain; charset="iso-8859-1"
> 
> Hi,everyone. I try to port lwip-master to RT-Thread Operating
> System(An embedded Real-Time open source system form china).I succeed
> in running IPV4 application, but the main purpose for me is porting
> IPV6 to it.
> The wiki said that when you using ipv6 you can add macro LWIP_IPV6 in 
> lwipopts.h
> But I don't know how to call some functions to set static IPV6
> address. Is there any documents talking about it?
Geppo | 21 Jul 09:59 2014
Picon

New stable release

Hello,
I'd like to know when the next stable release will be available.

Thanks in advance,
Giuseppe
_______________________________________________
lwip-users mailing list
lwip-users@...
https://lists.nongnu.org/mailman/listinfo/lwip-users
Rainer Thaden | 21 Jul 12:13 2014

lwip PPP malloc problem

Dear all,

I am using lwIP 1.3.2 on a Stellaris LM3S6965 processor together with
FreeRTOS for UDP communication over ethernet.
lwIP is configured not to use malloc, so is FreeRTOS. Both use their own
heap implementation.
Everything is running as it should up to this point.

Since I need to communicate over serial ports, too, I activated PPP
support in lwipopts.h.
Now, the linker complains about undefined references to _sbrk which (to
me) is a sign for a call to malloc in the libc somewhere.
I do not use malloc anywhere else, so I didn't provide my own
implementation of _sbrk.
If I deactivate PPP support again, the complaints are gone.

I couldn't find any direct malloc call in the PPP sources. I also looked
through the c-preprocessed sources to have all macro substitutions done
before searching, but couldn't find it.
The linker map file also doesn't provide any clue.

Any ideas how to get rid of this?

Thanks in advance,

Rainer
ffddybz | 20 Jul 09:22 2014

IPV6 Porting

Hi,everyone. I try to port lwip-master to RT-Thread Operating System(An embedded Real-Time open source system form china).

I succeed in running IPV4 application, but the main purpose for me is porting IPV6 to it.
The wiki said that when you using ipv6 you can add macro LWIP_IPV6 in lwipopts.h
But I don't know how to call some functions to set static IPV6 address. Is there any documents talking about it? 
_______________________________________________
lwip-users mailing list
lwip-users@...
https://lists.nongnu.org/mailman/listinfo/lwip-users
ske | 18 Jul 19:10 2014
Picon

Change CONFIG_LINKSPEED_AUTODETECT to CONFIG_LINKSPEED

Hello all,

In the board support package i can change the value for
temac_adapter_options from 
CONFIG_LINKSPEED_AUTODETECT to CONFIG_LINKSPEED100. Then i can see in the
haeder file, that
<#define CONFIG_LINKSPEED_AUTODETECT  1> is changed with <#define
CONFIG_LINKSPEED100 1>. But in the function <unsigned Phy_Setup (XEmacPs
*xemacpsp) in xemacpsif_physpeed this compiler switch doesen't work. The
code for &lt;#ifdef  CONFIG_LINKSPEED_AUTODETECT&lt; is always aktiv.
I had regenarte the board support package and compiled the lwip application.
What is wrong?

I want to use the lwip example in my project for comminicate over ethernet.
But i don't want that the application wait for &lt;Waiting for PHY to
complete autonegotiation>.
The application should also run without connection to the ethernet. What can
i do?

I have teste it with SDK 2013.4 and SDK 2014.2.

best regards
baui

--
View this message in context: http://lwip.100.n7.nabble.com/Change-CONFIG-LINKSPEED-AUTODETECT-to-CONFIG-LINKSPEED-tp22913.html
Sent from the lwip-users mailing list archive at Nabble.com.
Steffen Wolfer | 18 Jul 11:31 2014
Picon

Multi-threaded socket access once again

Dear all,

I'm trying to access a TCP socket from multiple threads. One thread is
listening for incoming data while multiple threads are submitting data.

I've learned and understood from other postings that lwIP's sockets
are not thread safe, so I protected the calls to the send routine with
a mutex.
The receiving thread, however, blocks waiting for incoming data so I
can't use the mutex for that. But without protection, the application
crashes if there is a send call from another thread while a receive
call is active.

I resolved the issue by blocking the receive thread using an
unprotected call to select(), waiting for incoming data. Then, after
the thread has unblocked, doing a protected call to recv() that
fetches the data from lwIP.

What do you think about that? It seems to work for me but is it safe?
Or might the select() call also interfere with send() in a way that
makes the application crash at some point?

Any advice is appreciated.

Thanks,
Steffen
Sebastian Subik | 18 Jul 10:30 2014

multiple timers.c in project

Dear lwip community,

 

I am using lwip on freeRTOS 7.4.2 and everything is working.

Now I would like to use additionally the freeROTS timer (defined in timers.c).

The problem is that my CrossStudio has some linking problems, I think it could not deal with two timers.c within the same project.

 

Although this is not a lwip problem, maybe anyone has faced the same?

 

I would appreciate any comments or ideas,

 

Best Regards

Sebastian

_______________________________________________
lwip-users mailing list
lwip-users@...
https://lists.nongnu.org/mailman/listinfo/lwip-users

Gmane