Martin Velek | 14 Apr 16:40 2014
Picon

[bug #42117] lwip_fcntl does not set errno

URL:
  <http://savannah.nongnu.org/bugs/?42117>

                 Summary: lwip_fcntl does not set errno
                 Project: lwIP - A Lightweight TCP/IP stack
            Submitted by: allew
            Submitted on: Mon 14 Apr 2014 02:40:05 PM GMT
                Category: sockets/netconn
                Severity: 3 - Normal
              Item Group: Faulty Behaviour
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: 
            lwIP version: git head

    _______________________________________________________

Details:

The function lwip_fcntl does not set errno variable if the cmd value is not
implemented.

There should be sock_set_errno(sock, ENOSYS); /* not yet implemented */
in the default: section, similarly like lwip_ioctl.

Martin

(Continue reading)

Fabian Koch | 1 Apr 18:36 2014
Picon

trying to make closing-from-different-task-while-in-accept/select/connect possible

Hey all,

disclaimer: I know that LwIP currently does not support what we want to achieve here. So if you want to answer "LwIP doesn't support this", save yourself the time. Still, I hope I can get some ideas and feedback from you guys about this because we really need it.

We have got a version running now that kind of "works". We are not sure yet, whether we have thought of everything and that is part of the reason I write this mail.

1) in the sys_arch layer, we had a very paranoid implementation that we had to losen a bit to achieve the current working behavior:
* sys_arch_mbox_fetch() and sys_arch_sem_wait() do return with SYS_ARCH_TIMEOUT when their specific resources were deleted while waiting on. (Should be a different return value to be able to react differently but works for now)

2) inside lwip_select(), where the socket->select_waiting counter is incremented, there is an assertion that fires, when the socket is suddenly gone (scenario: close() from one task while still in select() in other task).
We changed this like this:

-        LWIP_ASSERT("sock != NULL", sock != NULL);
+        if(sock == NULL) {
+          continue;        //socket has been closed while we were in the select(). Continue the loop to get out of the select() cleanly
+        }

for both for-loops where select_waiting is supposed to be increased.
Also not a clean solution/reaction but at least select() returns.

3) we encountered a problem when two tasks both did a lwip_close() on the same socket in a very short order of time.
When the close() is called the second time, while the first is still in progress, free_socket() was not called yet, so the protections in netconn_delete() and do_delconn() do not work and the close is executed a second time.
When it hits netconn_free(), the sys_sem_free() works on the already invalid semaphore and the memp_free() on the already invalid conn.
To avoid this we made the following change in netconn_free():

-  sys_sem_free(&conn->op_completed);
-  sys_sem_set_invalid(&conn->op_completed);
-
-  memp_free(MEMP_NETCONN, conn);
+  if (sys_sem_valid(&conn->op_completed)) {
+    sys_sem_free(&conn->op_completed);
+    sys_sem_set_invalid(&conn->op_completed);
+    memp_free(MEMP_NETCONN, conn);
+  }

4) in netconn_accept() we added an initialization value for the newconn pointer. Not only because it is better style to have a knwon value there, but also to cope with the fact from point 1) where we return from sys_arch_mbox_fetch() with SYS_ARCH_TIMEOUT when the socket was closed while we stuck in accept().

-  struct netconn *newconn;
+  struct netconn *newconn = NULL;

5) in the general tcpip_apimsg() call, we introduced a protection against returning possibly wrong (e.g. ERR_OK) error codes after returning from sys_arch_sem_wait() when it was closed:

<at> <at> -316,6 +316,10 <at> <at>
     msg.msg.apimsg = apimsg;
     sys_mbox_post(&mbox, &msg);
     sys_arch_sem_wait(&apimsg->msg.conn->op_completed, 0);
+    /* do a quick check if the connection is still valid after we return from sem_wait */
+    if(apimsg->msg.conn == NULL){
+      return ERR_VAL;
+    }
     return apimsg->msg.err;
   }
   return ERR_VAL;

we could have checked for SYS_ARCH_TIMEOUT here, but I feel that this hack has to end in the future and sys_arch_sem_wait() and _mbox_fetch() should return something else when their resources have been deleted...

6) We are still looking for a good solution for the problem of closing a socket that is currently blocking in connect(). Of course there are several LWIP_ASSERT() in do_delconn() but even ignoring those, the netconn_drain() call is a problem with our sys_arch layer and it gets pretty ugly from there.
I'll keep looking into that roadblock tomorrow (there is an   <at> todo TCP: abort running write/connect? comment in there, so...)

7) Doing write and read from different tasks seems to work for now. As long as there are only one tx and one rx task

I would love any notes, hints, help, comments, anything!

kind regards,
Fabian
_______________________________________________
lwip-devel mailing list
lwip-devel <at> nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-devel
TabascoEye | 27 Mar 16:41 2014
Picon

[patch #8425] netconn_free needs to check validity of semaphores

URL:
  <http://savannah.nongnu.org/patch/?8425>

                 Summary: netconn_free needs to check validity of semaphores
                 Project: lwIP - A Lightweight TCP/IP stack
            Submitted by: tabascoeye
            Submitted on: Do 27 Mär 2014 15:41:20 GMT
                Category: sockets/netconn
                Priority: 7 - High
                  Status: None
                 Privacy: Public
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: None

    _______________________________________________________

Details:

When a netconn_free() is called a second time on an already free'd netconn,
the sys_sem_free(&conn->op_completed); call is being executed without first
checking if the sem is still valid.
On my sys_arch implementation, calling sys_sem_free() on an already freed
semaphore leads to an assertion.

I propose in the attached patch that a check for validity of the semaphore
should be done before freeing and invalidating it (again).

    _______________________________________________________

File Attachments:

-------------------------------------------------------
Date: Do 27 Mär 2014 15:41:20 GMT  Name: lwip_netcon_free.patch  Size: 475B  
By: tabascoeye

<http://savannah.nongnu.org/patch/download.php?file_id=31061>

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/patch/?8425>

_______________________________________________
  Nachricht gesendet von/durch Savannah
  http://savannah.nongnu.org/

_______________________________________________
lwip-devel mailing list
lwip-devel <at> nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-devel
Frederick Baksik | 26 Mar 23:09 2014
Picon

[patch #8424] LWIP_STATS: only call stats_init() when using LWIP_STATS.

URL:
  <http://savannah.nongnu.org/patch/?8424>

                 Summary: LWIP_STATS: only call stats_init() when using
LWIP_STATS.
                 Project: lwIP - A Lightweight TCP/IP stack
            Submitted by: frodak
            Submitted on: Wed 26 Mar 2014 06:09:55 PM EDT
                Category: None
                Priority: 5 - Normal
                  Status: None
                 Privacy: Public
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: None

    _______________________________________________________

Details:

Fix linker error when LWIPS_STATS is not being used.

    _______________________________________________________

File Attachments:

-------------------------------------------------------
Date: Wed 26 Mar 2014 06:09:55 PM EDT  Name: rtl_netstack_2456.patch  Size:
549B   By: frodak

<http://savannah.nongnu.org/patch/download.php?file_id=31053>

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/patch/?8424>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/
Frederick Baksik | 26 Mar 23:06 2014
Picon

[patch #8423] #include "arch/perf.h" should be made an optional item

URL:
  <http://savannah.nongnu.org/patch/?8423>

                 Summary: #include "arch/perf.h" should be made an optional
item
                 Project: lwIP - A Lightweight TCP/IP stack
            Submitted by: frodak
            Submitted on: Wed 26 Mar 2014 06:06:30 PM EDT
                Category: None
                Priority: 5 - Normal
                  Status: None
                 Privacy: Public
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: None

    _______________________________________________________

Details:

Not all platforms may support performance testing.  Also even if a platform
supports performance testing it may not always be desirable. Therefore add
LWIP_PERF to "src/include/lwip/opt.h" to make it optional.

    _______________________________________________________

File Attachments:

-------------------------------------------------------
Date: Wed 26 Mar 2014 06:06:30 PM EDT  Name: rtl_netstack_2458.patch  Size:
3kB   By: frodak

<http://savannah.nongnu.org/patch/download.php?file_id=31052>

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/patch/?8423>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/
Frederick Baksik | 26 Mar 21:18 2014
Picon

[patch #8422] clarify use of #defines in opts.h and arch/cc.h

URL:
  <http://savannah.nongnu.org/patch/?8422>

                 Summary: clarify use of #defines  in opts.h and arch/cc.h
                 Project: lwIP - A Lightweight TCP/IP stack
            Submitted by: frodak
            Submitted on: Wed 26 Mar 2014 04:18:01 PM EDT
                Category: None
                Priority: 5 - Normal
                  Status: None
                 Privacy: Public
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: None

    _______________________________________________________

Details:

While starting a port to a new platform I ran into a few issues with missing
#defines in arch/cc.h.  The issues were discovered during linking as missing
symbols.  Instead the code is modified so that the #define is checked to exist
during compilation phase.

    _______________________________________________________

File Attachments:

-------------------------------------------------------
Date: Wed 26 Mar 2014 04:18:02 PM EDT  Name: rtl_netstack_2457.patch  Size:
697B   By: frodak

<http://savannah.nongnu.org/patch/download.php?file_id=31049>
-------------------------------------------------------
Date: Wed 26 Mar 2014 04:18:02 PM EDT  Name: rtl_netstack_2459.patch  Size:
2kB   By: frodak

<http://savannah.nongnu.org/patch/download.php?file_id=31050>
-------------------------------------------------------
Date: Wed 26 Mar 2014 04:18:01 PM EDT  Name: rtl_netstack_2454.patch  Size:
1kB   By: frodak

<http://savannah.nongnu.org/patch/download.php?file_id=31047>
-------------------------------------------------------
Date: Wed 26 Mar 2014 04:18:01 PM EDT  Name: rtl_netstack_2455.patch  Size:
1kB   By: frodak

<http://savannah.nongnu.org/patch/download.php?file_id=31048>

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/patch/?8422>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/
Bastien Allibert | 20 Mar 16:26 2014
Picon

Constraining pbuf pools location by the linker

Hi all,

I have a question regarding the pbuf pool location : in few words : is it possible, or did anybody already tried, to constrain pbuf pool location (at least payload) in memory ?

More explanations on my project : I'm currently devleoping an audio streaming receiver with lwIP and decided to go for zero-copy ethernet driver for 2 reasons : performance (no need for a data copy) and memory savings (no need for a dedicated buffer for ethernet DMA). I'm using STM32F107 and STM32F4 chip.

The problem is : in STM32F4 chip, not all of the memory can be accessed by the ethernet DMA. So, if i want to compute my DMA descriptors on-the-fly to use directly the pbuf payload, this payload has to be in an accessible location for the DMA.. (my driver works on STM32F107 which does not have this constraint).

Consequently, my question is : did somebody already have this problem ? is there some kind of macro that has been intended to handle such case and which would constrain pbuf declaration into a given linker section statement ?

Thanks for your help
Regards
Bastien
_______________________________________________
lwip-devel mailing list
lwip-devel <at> nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-devel
TabascoEye | 17 Mar 15:03 2014
Picon

[patch #8397] Typos corrected in comments and text outputs

URL:
  <http://savannah.nongnu.org/patch/?8397>

                 Summary: Typos corrected in comments and text outputs
                 Project: lwIP - A Lightweight TCP/IP stack
            Submitted by: tabascoeye
            Submitted on: Mo 17 Mär 2014 14:03:11 GMT
                Category: Documentation
                Priority: 1 - Later
                  Status: None
                 Privacy: Public
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: None

    _______________________________________________________

Details:

Attached is a patch against current git master trunk containing corrections of
many typos I found while reading LwIP source code.

I'll give this a prio of 1 but maybe it's of some use.

    _______________________________________________________

File Attachments:

-------------------------------------------------------
Date: Mo 17 Mär 2014 14:03:11 GMT  Name: lwip_typos.patch  Size: 54kB   By:
tabascoeye

<http://savannah.nongnu.org/patch/download.php?file_id=30925>

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/patch/?8397>

_______________________________________________
  Nachricht gesendet von/durch Savannah
  http://savannah.nongnu.org/

_______________________________________________
lwip-devel mailing list
lwip-devel <at> nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-devel
Simon Goldschmidt | 11 Mar 20:44 2014
Picon

[bug #41501] httpd SSI improvement

Update of bug #41501 (project lwip):

                  Status:                    None => Fixed                  
             Assigned to:                    None => goldsimon              
             Open/Closed:                    Open => Closed                 

    _______________________________________________________

Follow-up Comment #1:

Should be fixed by recent changes in httpd.

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?41501>

_______________________________________________
  Nachricht gesendet von/durch Savannah
  http://savannah.nongnu.org/
Ivan Delamer | 6 Mar 16:42 2014

Re: lwip-devel Digest, Vol 117, Issue 5

Rahul: could you post this as a bug in Savannah, so it doesn't get 
forgotten? Something like "separate netif_flag_up for IPv4/6"...

Thanks!
Ivan

> Date: Thu, 6 Mar 2014 09:16:01 +0530
> From: Rahul Gundecha <rahul.gundecha <at> gmail.com>
> To: lwip-devel <at> nongnu.org
> Subject: [lwip-devel] netif_set_up & IPv6
> Message-ID:
> 	<CAPvfifJoPTHrbwK+oWvd0208E75YhCPiiW098pQLGUo5F5SJNA <at> mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
> 
> Hi all,
> 
> I have query about the function netif_set_up() which brings an 
> interface
> up. Here is my understanding about this function.
> This function is called from DHCP state machine inside lwip, or it 
> should
> be called by netif driver while static IP address is configured.
> Lets consider a scenario where a device is configured with DHCP, 
> however
> for some reasons device do not get DHCP (IPv4) address. Irrespective 
> of the
> success/failure with DHCP (IPv4), one wants to configure link local 
> IPv6
> address for an interface and start IPv6 traffic.
> 
> One can call netif_set_up() while configuring IPv6 address. However as
> struct netif is shared by IPv4 and IPv6 both, calling netif_set_up()
> wrongly assumes that both IPv4 and IPv6 address have been configured
> successfully - hence it starts sending different kinds of IPv4 
> (Gratuitous
> ARP, IGMP, SNMP, etc.) and IPv6 (MLD, RS,etc.) traffic.
> Is there some other way of doing this task which I missing here.
> 
> Otherwise how about separating out the "NETIF_FLAG_UP" flag for IPv4 &
> IPv6? If either of IPv4 or IPv6 address is successfully configured 
> then
> only the traffic pertaining to that address need to be activated.
> 
> Also I see NETIF_FLAG_UP is checked only in IPv6 specific functions 
> and not
> used in IPv4 specific functions other than netif_set_down(). Is there 
> any
> specific reason behind this.
> 
> Thanks,
> Rahul
Nick van IJzendoorn | 6 Mar 09:40 2014
Picon

[bug #41787] DHCP Discovery is invalid when an IP is set to thet netif.

URL:
  <http://savannah.nongnu.org/bugs/?41787>

                 Summary: DHCP Discovery is invalid when an IP is set to thet
netif.
                 Project: lwIP - A Lightweight TCP/IP stack
            Submitted by: dipswitch_
            Submitted on: Thu 06 Mar 2014 08:40:21 AM GMT
                Category: None
                Severity: 3 - Normal
              Item Group: None
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: 
            lwIP version: 1.4.0

    _______________________________________________________

Details:

The DHCP client will send an invalid DHCP Discovery packet (according to
RFC2131 the ciaddr MUST be zero in the DISCOVERY phase) when the IP of the
netif is already set. For instance when you are switching from static IP to
dynamic IP.

I know you could clear the IP, subnet and gateway yourself before starting the
DHCP client. But I personally think it would be cleaner / better if LwIP
clears the IP, subnet and gateway before turning on the DHCP client.

One solution could be to patch the DHCP client like the patch provided.

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?41787>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/

Gmane