[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-users] Router issues with lwip
From: |
Martin Glunz |
Subject: |
[lwip-users] Router issues with lwip |
Date: |
Fri, 18 Jun 2004 08:18:20 +0200 |
Hi folks
I've got some problem with lwip and external routers.
Lwip is running as part of a embedded system and I'm routing
from some PC through the internet to the system. Setting
the default gw in lwip and some NAT/port forwarding settings
on the router does the job.
Now I'm using a Netgear RP614v2 Router. An incoming TCP
connection is forwarded to the lwip device, data are sent.
OK so far. When the lwip device ends the connection, everything
works fine. If the other side (PC routed via internet) closes
the connection before all of the data are sent, the socket on the
lwip device hangs.
I've found the following to cause the hang:
lwip sends data packet
PC sends TCP_FIN packet
lwip sends data packet
PC sends TCP_RST packet
This packet is not accepted by tcp_process() in tcp_in.c
because the sequence number check:
if (TCP_SEQ_GEQ(seqno, pcb->rcv_nxt) &&
TCP_SEQ_LEQ(seqno, pcb->rcv_nxt + pcb->rcv_wnd)) {
fails. The "seqno" variable is one less (in this case)
than "pcb->rcv_nxt", so the RST is discarded and the
connection will not close on the lwip side.
I've done a simple (and obvious) workaround:
if (TCP_SEQ_GEQ(seqno, pcb->rcv_nxt - pcb->rcv_wnd) && //
workaround for rp614v2
TCP_SEQ_LEQ(seqno, pcb->rcv_nxt + pcb->rcv_wnd)) {
Any comments?
Another issue appears using a linux box as router:
The lwip device sends TCP packets with the Don'f Fragment flag set. If
the TCP mss is too large for the internet connection the linux router
won't forward the packet and sends a ICMP message back to lwip. lwip
discards this message and keeps trying to send packets.
I've resolved this by not setting the DF in the IP Headers:
IPH_OFFSET_SET(iphdr, htons(IP_DF));
changed to
IPH_OFFSET_SET(iphdr, htons(0));
(in p_output_if() in ip.c
Any comments?
---
Martin Glunz
fortune says today:
There is no TRUTH. There is no REALITY. There is no CONSISTENCY.
There are no ABSOLUTE STATEMENTS I'm very probably wrong.
WANTED: Schrödinger's Cat. Dead or Alive.
Isn't vi that text editor with two modes... one that beeps and one that
corrupts your file?
- Re: [lwip-users] Problems with ASSERTION in tcp_in and tcp_out, (continued)
- Re: [lwip-users] Problems with ASSERTION in tcp_in and tcp_out, Justin Bayles, 2004/06/10
- Re: [lwip-users] Problems with ASSERTION in tcp_in and tcp_out, Justin Bayles, 2004/06/15
- Re: [lwip-users] Problems with ASSERTION in tcp_in and tcp_out, Justin Bayles, 2004/06/16
- Re: [lwip-users] Problems with ASSERTION in tcp_in and tcp_out, Justin Bayles, 2004/06/16
- Re: [lwip-users] Problems with ASSERTION in tcp_in and tcp_out, Justin Bayles, 2004/06/17
- Re: [lwip-users] Problems with ASSERTION in tcp_in and tcp_out, Justin Bayles, 2004/06/17
- [lwip-users] Router issues with lwip,
Martin Glunz <=
- Re: [lwip-users] Router issues with lwip, K.J. Mansley, 2004/06/21
- Re: [lwip-users] Router issues with lwip, Martin Glunz, 2004/06/22
- Re: [lwip-users] Router issues with lwip, K.J. Mansley, 2004/06/23
- Re: [lwip-users] Router issues with lwip, Leon Woestenberg, 2004/06/23
- Re: [lwip-users] Router issues with lwip, Martin Glunz, 2004/06/24
- Re: [lwip-users] Router issues with lwip, Leon Woestenberg, 2004/06/24
- Re: [lwip-users] Router issues with lwip, Martin . Glunz, 2004/06/24
- Re: [lwip-users] Router issues with lwip, Leon Woestenberg, 2004/06/24
- Re: [lwip-users] Router issues with lwip, Martin Glunz, 2004/06/28
- Re: [lwip-users] Router issues with lwip, K.J. Mansley, 2004/06/25