lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-users] [lwip] Connections being incorrectly reset when using sock


From: Duncan Palmer
Subject: [lwip-users] [lwip] Connections being incorrectly reset when using sockets API [patch]
Date: Thu, 09 Jan 2003 01:21:31 -0000

--Boundary_(ID_KPZs6IhktwDssWL75PtTJg)
Content-type: text/plain; charset=iso-8859-1
Content-transfer-encoding: quoted-printable

This occurs with the cvs snapshot dated 29/5

This cvs snapshot adds the element
  err_t (* accept)(void *arg, struct tcp_pcb *newpcb, err_t err);
to the end of struct tcp_pcb_listen, which causes problems as structures =
of=20
type struct tcp_pcb are expected to be able to be cast to struct=20
tcp_pcb_listen.=20

I use the BSD sockets interface, and noticed this problem when connection=
s=20
were being reset before all data was transfered. This occurs because an=20
lwip_close() results in a call to do_delconn() which calls tcp_accept(pcb=
,=20
NULL) - this call results in pcb.remote_ip getting set to 0, so incoming=20
ACK's no longer get matched with this pcb and an RST gets sent - not good=
=2E..

Patch attached. It adds a few elements to struct tcp_pcb_listen - i hope =
this=20
is ok with people who are short on memory...

Adam, i take it that this change came about in response to=20
http://www.sics.se/~adam/lwip/maillist/msg00991.html
Any chance you could reply to these sort of messages on the list if you f=
ix=20
the problem? Otherwise, we end up adding random fixes that people have po=
sted=20
to the list to our tree, and don't know what your releases do and don't f=
ix -=20
its much nicer if we know a fix has been applied and we just need to get =
the=20
next CVS snapshot to get it.

Cheers,
Dunk


--Boundary_(ID_KPZs6IhktwDssWL75PtTJg)
Content-type: text/x-c; name=lwipdiff.out; charset=iso-8859-1
Content-disposition: attachment; filename=lwipdiff.out
Content-transfer-encoding: 8bit

--- lwip-cvs-20020529/src/include/lwip/tcp.h    Wed May 29 15:00:16 2002
+++ tcpip/src/include/lwip/tcp.h        Thu Jun 13 18:00:31 2002
@@ -188,6 +188,26 @@
   u8_t prio;
   void *callback_arg;
 
+#if LWIP_CALLBACK_API
+  /* Function to be called when more send buffer space is avaliable. */
+  err_t (* sent)(void *arg, struct tcp_pcb *pcb, u16_t space);
+  
+  /* Function to be called when (in-sequence) data has arrived. */
+  err_t (* recv)(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err);
+
+  /* Function to be called when a connection has been set up. */
+  err_t (* connected)(void *arg, struct tcp_pcb *pcb, err_t err);
+
+  /* Function to call when a listener has been connected. */
+  err_t (* accept)(void *arg, struct tcp_pcb *newpcb, err_t err);
+
+  /* Function which is called periodically. */
+  err_t (* poll)(void *arg, struct tcp_pcb *pcb);
+
+  /* Function to be called whenever a fatal error occurs. */
+  void (* errf)(void *arg, err_t err);
+#endif /* LWIP_CALLBACK_API */
+
   struct ip_addr local_ip;
   u16_t local_port;
   
@@ -254,6 +274,13 @@
   struct tcp_seg *ooseq;    /* Received out of sequence segments. */
 #endif /* TCP_QUEUE_OOSEQ */
 
+};
+
+struct tcp_pcb_listen {  
+  struct tcp_pcb_listen *next;   /* for the linked list */
+  u8_t prio;
+  void *callback_arg;
+
 #if LWIP_CALLBACK_API
   /* Function to be called when more send buffer space is avaliable. */
   err_t (* sent)(void *arg, struct tcp_pcb *pcb, u16_t space);
@@ -273,20 +300,9 @@
   /* Function to be called whenever a fatal error occurs. */
   void (* errf)(void *arg, err_t err);
 #endif /* LWIP_CALLBACK_API */
-};
-
-struct tcp_pcb_listen {  
-  struct tcp_pcb_listen *next;   /* for the linked list */
-  u8_t prio;
-  void *callback_arg;
   
   struct ip_addr local_ip;
   u16_t local_port;  
-
-#if LWIP_CALLBACK_API
-  /* Function to call when a listener has been connected. */
-  err_t (* accept)(void *arg, struct tcp_pcb *newpcb, err_t err);
-#endif /* LWIP_CALLBACK_API */
 };
 
 #if LWIP_EVENT_API

--Boundary_(ID_KPZs6IhktwDssWL75PtTJg)--
[This message was sent through the lwip discussion list.]




reply via email to

[Prev in Thread] Current Thread [Next in Thread]