Bug 531914 - [4.6] TCP conntrack doesn't handle half-open state connection correctly
Summary: [4.6] TCP conntrack doesn't handle half-open state connection correctly
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: kernel
Version: 4.6
Hardware: All
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Jiri Pirko
QA Contact: Red Hat Kernel QE team
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-10-29 20:19 UTC by Flavio Leitner
Modified: 2018-11-14 20:31 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-02-16 16:01:39 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Patch fixing conntrack tcp (850 bytes, patch)
2009-10-29 20:25 UTC, Flavio Leitner
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2011:0263 0 normal SHIPPED_LIVE Important: Red Hat Enterprise Linux 4.9 kernel security and bug fix update 2011-02-16 15:14:55 UTC

Description Flavio Leitner 2009-10-29 20:19:42 UTC
Description of problem:

If an ICMP error is received in the middle of a connection opening phase,
the port redirection fails and no redirection is performed.

Here is an example of a testing system.

client                        server
10.33.140.104                 10.33.140.110
+-----------------+           +-----------------------------+
|      +--------+ |           | +--------+      +--------+  |
|port: |iptables| | --------> | |iptables|----->| httpd  |  |
| 41292|  (1)   | |           | |  (2)   |      |port:80 |  |
|      |        | |           | |port:   |      |        |  |
|      |        | | <-------- | |  8089  |<-----|        |  |
|      +--------+ |           | +--------+      +--------+  |
+-----------------+           +-----------------------------+

1. Configure the iptables of the client so that the client sends error
   packets of the network to the server.

The iptables marked as (1) in the above figure is configured as follows.
 # iptables -F
 # iptables -A INPUT -p tcp -m tcp --sport 8089 -j REJECT --reject-with icmp-host-unreachable
 # iptables -P INPUT ACCEPT
 # iptables -P OUTPUT ACCEPT
 # service iptables save
 # service iptables restart

2. Configure the iptables of the server.

The iptables marked as (2) in the above figure is configured as follows.
 # iptables -F
 # iptables -t nat -A PREROUTING  -p tcp -m tcp --dport 8089 -j REDIRECT --to-ports 80
 # iptables -P INPUT ACCEPT
 # iptables -P OUTPUT ACCEPT
 # service iptables save
 # service iptables restart


3. Start httpd on server.
 # service httpd start


4. Run the tcpdump on the client to capture packets which both the source
   address and the destination address are the server's IP address.
e.g.)
 # tcpdump -i eth0 -s 256 src 10.33.140.110 or dst 10.33.140.110


5. Access from the client to the port 8089 in the server.
e.g.)
 # telnet <server's-IP-address> 8089
 
6. Confirm that the server directly responds from the port 80 to the client
   after a network error (Destination unreachable) occurs.

   10.33.140.104 10.33.140.110 TCP 41292 > 8089 [SYN] Seq=0 Win=5840 Len=0 MSS=1460 TSV=65644314 TSER=0 WS=7
   10.33.140.110 10.33.140.104 TCP 8089 > 41292 [SYN, ACK] Seq=0 Ack=1 Win=5792 Len=0 MSS=1460 TSV=81687816 TSER=65644314 WS=2
   10.33.140.104 10.33.140.110 ICMP Destination unreachable (Host unreachable)[Packet size limited during capture]
   10.33.140.104 10.33.140.110 TCP 41292 > 8089 [SYN] Seq=0 Win=5840 Len=0 MSS=1460 TSV=65647314 TSER=0 WS=7
   10.33.140.110 10.33.140.104 TCP 80 > 41292 [SYN, ACK] Seq=0 Ack=0 Win=5792 Len=0 MSS=1460 TSV=81690816 TSER=65647314 WS=2
   10.33.140.104 10.33.140.110 TCP 41292 > 80 [RST] Seq=0 Win=0 Len=0
   10.33.140.104 10.33.140.110 TCP 41292 > 8089 [SYN] Seq=0 Win=5840 Len=0 MSS=1460 TSV=65653314 TSER=0 WS=7


Version-Release number of selected component (if applicable):
kernel-2.6.9-67.EL & newer

How reproducible:
Always

Comment 1 Flavio Leitner 2009-10-29 20:25:02 UTC
Created attachment 366708 [details]
Patch fixing conntrack tcp

This patch fixes iptables TCP conntrack to handle the half-opened 
connection correctly.

The brew build url with the patch applied is:
https://brewweb.devel.redhat.com/taskinfo?taskID=2038812

The test kernel works on my local test system and on customer's system too.

Flavio Leitner

Comment 5 RHEL Program Management 2010-07-19 13:19:27 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update
release.

Comment 6 Vivek Goyal 2010-09-23 13:02:53 UTC
Committed in 89.37.EL . RPMS are available at http://people.redhat.com/vgoyal/rhel4/

Comment 12 Petr Beňas 2010-12-09 11:43:35 UTC
Reproduced in 89.36.EL and verified in 89.37.EL.

Comment 14 errata-xmlrpc 2011-02-16 16:01:39 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHSA-2011-0263.html


Note You need to log in before you can comment on or make changes to this bug.