diff options
Diffstat (limited to 'net/ipv4')
-rw-r--r-- | net/ipv4/netfilter/ip_conntrack_proto_tcp.c | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/net/ipv4/netfilter/ip_conntrack_proto_tcp.c b/net/ipv4/netfilter/ip_conntrack_proto_tcp.c index 625981676776..aeb7353d4777 100644 --- a/net/ipv4/netfilter/ip_conntrack_proto_tcp.c +++ b/net/ipv4/netfilter/ip_conntrack_proto_tcp.c | |||
@@ -272,9 +272,9 @@ static const enum tcp_conntrack tcp_conntracks[2][6][TCP_CONNTRACK_MAX] = { | |||
272 | * sCL -> sCL | 272 | * sCL -> sCL |
273 | */ | 273 | */ |
274 | /* sNO, sSS, sSR, sES, sFW, sCW, sLA, sTW, sCL, sLI */ | 274 | /* sNO, sSS, sSR, sES, sFW, sCW, sLA, sTW, sCL, sLI */ |
275 | /*ack*/ { sIV, sIV, sSR, sES, sCW, sCW, sTW, sTW, sCL, sIV }, | 275 | /*ack*/ { sIV, sIG, sSR, sES, sCW, sCW, sTW, sTW, sCL, sIV }, |
276 | /* | 276 | /* |
277 | * sSS -> sIV Might be a half-open connection. | 277 | * sSS -> sIG Might be a half-open connection. |
278 | * sSR -> sSR Might answer late resent SYN. | 278 | * sSR -> sSR Might answer late resent SYN. |
279 | * sES -> sES :-) | 279 | * sES -> sES :-) |
280 | * sFW -> sCW Normal close request answered by ACK. | 280 | * sFW -> sCW Normal close request answered by ACK. |
@@ -917,8 +917,12 @@ static int tcp_packet(struct ip_conntrack *conntrack, | |||
917 | 917 | ||
918 | switch (new_state) { | 918 | switch (new_state) { |
919 | case TCP_CONNTRACK_IGNORE: | 919 | case TCP_CONNTRACK_IGNORE: |
920 | /* Either SYN in ORIGINAL | 920 | /* Ignored packets: |
921 | * or SYN/ACK in REPLY. */ | 921 | * |
922 | * a) SYN in ORIGINAL | ||
923 | * b) SYN/ACK in REPLY | ||
924 | * c) ACK in reply direction after initial SYN in original. | ||
925 | */ | ||
922 | if (index == TCP_SYNACK_SET | 926 | if (index == TCP_SYNACK_SET |
923 | && conntrack->proto.tcp.last_index == TCP_SYN_SET | 927 | && conntrack->proto.tcp.last_index == TCP_SYN_SET |
924 | && conntrack->proto.tcp.last_dir != dir | 928 | && conntrack->proto.tcp.last_dir != dir |
@@ -985,13 +989,20 @@ static int tcp_packet(struct ip_conntrack *conntrack, | |||
985 | } | 989 | } |
986 | case TCP_CONNTRACK_CLOSE: | 990 | case TCP_CONNTRACK_CLOSE: |
987 | if (index == TCP_RST_SET | 991 | if (index == TCP_RST_SET |
988 | && test_bit(IPS_SEEN_REPLY_BIT, &conntrack->status) | 992 | && ((test_bit(IPS_SEEN_REPLY_BIT, &conntrack->status) |
989 | && conntrack->proto.tcp.last_index == TCP_SYN_SET | 993 | && conntrack->proto.tcp.last_index == TCP_SYN_SET) |
994 | || (!test_bit(IPS_ASSURED_BIT, &conntrack->status) | ||
995 | && conntrack->proto.tcp.last_index == TCP_ACK_SET)) | ||
990 | && ntohl(th->ack_seq) == conntrack->proto.tcp.last_end) { | 996 | && ntohl(th->ack_seq) == conntrack->proto.tcp.last_end) { |
991 | /* RST sent to invalid SYN we had let trough | 997 | /* RST sent to invalid SYN or ACK we had let trough |
992 | * SYN was in window then, tear down connection. | 998 | * at a) and c) above: |
999 | * | ||
1000 | * a) SYN was in window then | ||
1001 | * c) we hold a half-open connection. | ||
1002 | * | ||
1003 | * Delete our connection entry. | ||
993 | * We skip window checking, because packet might ACK | 1004 | * We skip window checking, because packet might ACK |
994 | * segments we ignored in the SYN. */ | 1005 | * segments we ignored. */ |
995 | goto in_window; | 1006 | goto in_window; |
996 | } | 1007 | } |
997 | /* Just fall trough */ | 1008 | /* Just fall trough */ |