* [PATCH net-2.6.24 0/5] TCP: Cleanups & SACK block validation @ 2007-08-20 13:16 Ilpo Järvinen 2007-08-20 13:16 ` [PATCH 1/5] [TCP]: Remove unnecessary wrapper tcp_packets_out_dec Ilpo Järvinen 0 siblings, 1 reply; 12+ messages in thread From: Ilpo Järvinen @ 2007-08-20 13:16 UTC (permalink / raw) To: David Miller; +Cc: netdev Hi Dave, Here are couple of patches to net-2.6.24. The first three are trivial cleanups. The idea to the last two comes from tcp-2.6 but the validator has been heavily modified (and hopefully improved in the process :-)). I'm not sure though if checking for the undo_marker boundary crossing case is a bit over-engineering (inherited from the original version which already checked for that case). In addition, better names could be invented for MIBs, suggestions? -- i. ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 1/5] [TCP]: Remove unnecessary wrapper tcp_packets_out_dec 2007-08-20 13:16 [PATCH net-2.6.24 0/5] TCP: Cleanups & SACK block validation Ilpo Järvinen @ 2007-08-20 13:16 ` Ilpo Järvinen 2007-08-20 13:16 ` [PATCH 2/5] [TCP]: tcp_packets_out_inc to tcp_output.c (no callers elsewhere) Ilpo Järvinen 2007-08-25 5:43 ` [PATCH 1/5] [TCP]: Remove unnecessary wrapper tcp_packets_out_dec David Miller 0 siblings, 2 replies; 12+ messages in thread From: Ilpo Järvinen @ 2007-08-20 13:16 UTC (permalink / raw) To: David Miller; +Cc: netdev, Ilpo Järvinen From: =?ISO-8859-1?q?Ilpo_J=E4rvinen?= <ilpo.jarvinen@helsinki.fi> Makes caller side more obvious, there's no need to have a wrapper for this oneliner! Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi> --- include/net/tcp.h | 6 ------ net/ipv4/tcp_input.c | 2 +- net/ipv4/tcp_output.c | 2 +- 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/include/net/tcp.h b/include/net/tcp.h index 7c65989..6d586ca 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -626,12 +626,6 @@ static inline void tcp_packets_out_inc(struct sock *sk, inet_csk(sk)->icsk_rto, TCP_RTO_MAX); } -static inline void tcp_packets_out_dec(struct tcp_sock *tp, - const struct sk_buff *skb) -{ - tp->packets_out -= tcp_skb_pcount(skb); -} - /* Events passed to congestion control interface */ enum tcp_ca_event { CA_EVENT_TX_START, /* first transmit when no packets in flight */ diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 96ced89..45ad32c 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -2548,7 +2548,7 @@ static int tcp_clean_rtx_queue(struct sock *sk, __s32 *seq_rtt_p) last_ackt = skb->tstamp; } tcp_dec_pcount_approx(&tp->fackets_out, skb); - tcp_packets_out_dec(tp, skb); + tp->packets_out -= tcp_skb_pcount(skb); tcp_unlink_write_queue(skb, sk); sk_stream_free_skb(sk, skb); clear_all_retrans_hints(tp); diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index a367917..1d65ce1 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -1735,7 +1735,7 @@ static void tcp_retrans_try_collapse(struct sock *sk, struct sk_buff *skb, int m * it is better to underestimate fackets. */ tcp_dec_pcount_approx(&tp->fackets_out, next_skb); - tcp_packets_out_dec(tp, next_skb); + tp->packets_out -= tcp_skb_pcount(next_skb); sk_stream_free_skb(sk, next_skb); } } -- 1.5.0.6 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 2/5] [TCP]: tcp_packets_out_inc to tcp_output.c (no callers elsewhere) 2007-08-20 13:16 ` [PATCH 1/5] [TCP]: Remove unnecessary wrapper tcp_packets_out_dec Ilpo Järvinen @ 2007-08-20 13:16 ` Ilpo Järvinen 2007-08-20 13:16 ` [PATCH 3/5] [TCP]: Rename tcp_ack_packets_out -> tcp_rearm_rto Ilpo Järvinen 2007-08-25 5:44 ` [PATCH 2/5] [TCP]: tcp_packets_out_inc to tcp_output.c (no callers elsewhere) David Miller 2007-08-25 5:43 ` [PATCH 1/5] [TCP]: Remove unnecessary wrapper tcp_packets_out_dec David Miller 1 sibling, 2 replies; 12+ messages in thread From: Ilpo Järvinen @ 2007-08-20 13:16 UTC (permalink / raw) To: David Miller; +Cc: netdev, Ilpo Järvinen From: =?ISO-8859-1?q?Ilpo_J=E4rvinen?= <ilpo.jarvinen@helsinki.fi> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi> --- include/net/tcp.h | 12 ------------ net/ipv4/tcp_output.c | 12 ++++++++++++ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/include/net/tcp.h b/include/net/tcp.h index 6d586ca..f28f382 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -614,18 +614,6 @@ static inline void tcp_dec_pcount_approx(__u32 *count, tcp_dec_pcount_approx_int(count, tcp_skb_pcount(skb)); } -static inline void tcp_packets_out_inc(struct sock *sk, - const struct sk_buff *skb) -{ - struct tcp_sock *tp = tcp_sk(sk); - int orig = tp->packets_out; - - tp->packets_out += tcp_skb_pcount(skb); - if (!orig) - inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS, - inet_csk(sk)->icsk_rto, TCP_RTO_MAX); -} - /* Events passed to congestion control interface */ enum tcp_ca_event { CA_EVENT_TX_START, /* first transmit when no packets in flight */ diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 1d65ce1..a61a3e3 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -61,6 +61,18 @@ int sysctl_tcp_base_mss __read_mostly = 512; /* By default, RFC2861 behavior. */ int sysctl_tcp_slow_start_after_idle __read_mostly = 1; +static inline void tcp_packets_out_inc(struct sock *sk, + const struct sk_buff *skb) +{ + struct tcp_sock *tp = tcp_sk(sk); + int orig = tp->packets_out; + + tp->packets_out += tcp_skb_pcount(skb); + if (!orig) + inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS, + inet_csk(sk)->icsk_rto, TCP_RTO_MAX); +} + static void update_send_head(struct sock *sk, struct sk_buff *skb) { struct tcp_sock *tp = tcp_sk(sk); -- 1.5.0.6 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 3/5] [TCP]: Rename tcp_ack_packets_out -> tcp_rearm_rto 2007-08-20 13:16 ` [PATCH 2/5] [TCP]: tcp_packets_out_inc to tcp_output.c (no callers elsewhere) Ilpo Järvinen @ 2007-08-20 13:16 ` Ilpo Järvinen 2007-08-20 13:16 ` [PATCH 4/5] [TCP]: Discard fuzzy SACK blocks Ilpo Järvinen 2007-08-25 5:53 ` [PATCH 3/5] [TCP]: Rename tcp_ack_packets_out -> tcp_rearm_rto David Miller 2007-08-25 5:44 ` [PATCH 2/5] [TCP]: tcp_packets_out_inc to tcp_output.c (no callers elsewhere) David Miller 1 sibling, 2 replies; 12+ messages in thread From: Ilpo Järvinen @ 2007-08-20 13:16 UTC (permalink / raw) To: David Miller; +Cc: netdev, Ilpo Järvinen From: =?ISO-8859-1?q?Ilpo_J=E4rvinen?= <ilpo.jarvinen@helsinki.fi> Only thing that tiny function does is rearming the RTO (if necessary), name it accordingly. Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi> --- net/ipv4/tcp_input.c | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 45ad32c..2bf3d57 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -2406,8 +2406,7 @@ static void tcp_cong_avoid(struct sock *sk, u32 ack, /* Restart timer after forward progress on connection. * RFC2988 recommends to restart timer to now+rto. */ - -static void tcp_ack_packets_out(struct sock *sk) +static void tcp_rearm_rto(struct sock *sk) { struct tcp_sock *tp = tcp_sk(sk); @@ -2560,7 +2559,7 @@ static int tcp_clean_rtx_queue(struct sock *sk, __s32 *seq_rtt_p) = inet_csk(sk)->icsk_ca_ops; tcp_ack_update_rtt(sk, acked, seq_rtt); - tcp_ack_packets_out(sk); + tcp_rearm_rto(sk); if (tcp_is_reno(tp)) tcp_remove_reno_sacks(sk, pkts_acked); -- 1.5.0.6 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 4/5] [TCP]: Discard fuzzy SACK blocks 2007-08-20 13:16 ` [PATCH 3/5] [TCP]: Rename tcp_ack_packets_out -> tcp_rearm_rto Ilpo Järvinen @ 2007-08-20 13:16 ` Ilpo Järvinen 2007-08-20 13:16 ` [PATCH 5/5] [TCP] MIB: Add counters for discarded " Ilpo Järvinen 2007-08-25 5:55 ` [PATCH 4/5] [TCP]: Discard fuzzy " David Miller 2007-08-25 5:53 ` [PATCH 3/5] [TCP]: Rename tcp_ack_packets_out -> tcp_rearm_rto David Miller 1 sibling, 2 replies; 12+ messages in thread From: Ilpo Järvinen @ 2007-08-20 13:16 UTC (permalink / raw) To: David Miller; +Cc: netdev, Ilpo Järvinen From: =?ISO-8859-1?q?Ilpo_J=E4rvinen?= <ilpo.jarvinen@helsinki.fi> SACK processing code has been a sort of russian roulette as no validation of SACK blocks is previously attempted. Besides, it is not very clear what all kinds of broken SACK blocks really mean (e.g., one that has start and end sequence numbers reversed). So now close the roulette once and for all. Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi> --- net/ipv4/tcp_input.c | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 82 insertions(+), 0 deletions(-) diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 2bf3d57..102aefa 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -1001,7 +1001,86 @@ static void tcp_update_reordering(struct sock *sk, const int metric, * for retransmitted and already SACKed segment -> reordering.. * Both of these heuristics are not used in Loss state, when we cannot * account for retransmits accurately. + * + * SACK block validation. + * ---------------------- + * + * SACK block range validation checks that the received SACK block fits to + * the expected sequence limits, i.e., it is between SND.UNA and SND.NXT. + * Note that SND.UNA is not included to the range though being valid because + * it means that the receiver is rather inconsistent with itself (reports + * SACK reneging when it should advance SND.UNA). + * + * Implements also blockage to start_seq wrap-around. Problem lies in the + * fact that though start_seq (s) is before end_seq (i.e., not reversed), + * there's no guarantee that it will be before snd_nxt (n). The problem + * happens when start_seq resides between end_seq wrap (e_w) and snd_nxt + * wrap (s_w): + * + * <- outs wnd -> <- wrapzone -> + * u e n u_w e_w s n_w + * | | | | | | | + * |<------------+------+----- TCP seqno space --------------+---------->| + * ...-- <2^31 ->| |<--------... + * ...---- >2^31 ------>| |<--------... + * + * Current code wouldn't be vulnerable but it's better still to discard such + * crazy SACK blocks. Doing this check for start_seq alone closes somewhat + * similar case (end_seq after snd_nxt wrap) as earlier reversed check in + * snd_nxt wrap -> snd_una region will then become "well defined", i.e., + * equal to the ideal case (infinite seqno space without wrap caused issues). + * + * With D-SACK the lower bound is extended to cover sequence space below + * SND.UNA down to undo_marker, which is the last point of interest. Yet + * again, DSACK block must not to go across snd_una (for the same reason as + * for the normal SACK blocks, explained above). But there all simplicity + * ends, TCP might receive valid D-SACKs below that. As long as they reside + * fully below undo_marker they do not affect behavior in anyway and can + * therefore be safely ignored. In rare cases (which are more or less + * theoretical ones), the D-SACK will nicely cross that boundary due to skb + * fragmentation and packet reordering past skb's retransmission. To consider + * them correctly, the acceptable range must be extended even more though + * the exact amount is rather hard to quantify. However, tp->max_window can + * be used as an exaggerated estimate. */ +static int tcp_is_sackblock_valid(struct tcp_sock *tp, int is_dsack, + u32 start_seq, u32 end_seq) +{ + /* Too far in future, or reversed (interpretation is ambiguous) */ + if (after(end_seq, tp->snd_nxt) || !before(start_seq, end_seq)) + return 0; + + /* Nasty start_seq wrap-around check (see comments above) */ + if (!before(start_seq, tp->snd_nxt)) + return 0; + + /* In outstanding window? ...This is valid exit for DSACKs too. + * start_seq == snd_una is non-sensical (see comments above) + */ + if (after(start_seq, tp->snd_una)) + return 1; + + if (!is_dsack || !tp->undo_marker) + return 0; + + /* ...Then it's D-SACK, and must reside below snd_una completely */ + if (!after(end_seq, tp->snd_una)) + return 0; + + if (!before(start_seq, tp->undo_marker)) + return 1; + + /* Too old */ + if (!after(end_seq, tp->undo_marker)) + return 0; + + /* Undo_marker boundary crossing (overestimates a lot). Known already: + * start_seq < undo_marker and end_seq >= undo_marker. + */ + return !before(start_seq, end_seq - tp->max_window); +} + + static int tcp_check_dsack(struct tcp_sock *tp, struct sk_buff *ack_skb, struct tcp_sack_block_wire *sp, int num_sacks, u32 prior_snd_una) @@ -1143,6 +1222,9 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_ int fack_count; int dup_sack = (found_dup_sack && (i == first_sack_index)); + if (!tcp_is_sackblock_valid(tp, dup_sack, start_seq, end_seq)) + continue; + skb = cached_skb; fack_count = cached_fack_count; -- 1.5.0.6 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 5/5] [TCP] MIB: Add counters for discarded SACK blocks 2007-08-20 13:16 ` [PATCH 4/5] [TCP]: Discard fuzzy SACK blocks Ilpo Järvinen @ 2007-08-20 13:16 ` Ilpo Järvinen 2007-08-25 5:56 ` David Miller 2007-08-25 5:55 ` [PATCH 4/5] [TCP]: Discard fuzzy " David Miller 1 sibling, 1 reply; 12+ messages in thread From: Ilpo Järvinen @ 2007-08-20 13:16 UTC (permalink / raw) To: David Miller; +Cc: netdev, Ilpo Järvinen From: =?ISO-8859-1?q?Ilpo_J=E4rvinen?= <ilpo.jarvinen@helsinki.fi> In DSACK case, some events are not extraordinary, such as packet duplication generated DSACK. They can arrive easily below snd_una when undo_marker is not set (TCP being in CA_Open), counting such DSACKs amoung SACK discards will likely just mislead if they occur in some scenario when there are other problems as well. Similarly, excessively delayed packets could cause "normal" DSACKs. Therefore, separate counters are allocated for DSACK events. Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi> --- include/linux/snmp.h | 3 +++ net/ipv4/proc.c | 3 +++ net/ipv4/tcp_input.c | 10 +++++++++- 3 files changed, 15 insertions(+), 1 deletions(-) diff --git a/include/linux/snmp.h b/include/linux/snmp.h index 802b3a3..d24c554 100644 --- a/include/linux/snmp.h +++ b/include/linux/snmp.h @@ -231,6 +231,9 @@ enum LINUX_MIB_TCPABORTONLINGER, /* TCPAbortOnLinger */ LINUX_MIB_TCPABORTFAILED, /* TCPAbortFailed */ LINUX_MIB_TCPMEMORYPRESSURES, /* TCPMemoryPressures */ + LINUX_MIB_TCPSACKDISCARD, /* TCPSACKDiscard */ + LINUX_MIB_TCPDSACKIGNOREDOLD, /* TCPSACKIgnoredOld */ + LINUX_MIB_TCPDSACKIGNOREDNOUNDO, /* TCPSACKIgnoredNoUndo */ __LINUX_MIB_MAX }; diff --git a/net/ipv4/proc.c b/net/ipv4/proc.c index 3b690cf..986d1c8 100644 --- a/net/ipv4/proc.c +++ b/net/ipv4/proc.c @@ -244,6 +244,9 @@ static const struct snmp_mib snmp4_net_list[] = { SNMP_MIB_ITEM("TCPAbortOnLinger", LINUX_MIB_TCPABORTONLINGER), SNMP_MIB_ITEM("TCPAbortFailed", LINUX_MIB_TCPABORTFAILED), SNMP_MIB_ITEM("TCPMemoryPressures", LINUX_MIB_TCPMEMORYPRESSURES), + SNMP_MIB_ITEM("TCPSACKDiscard", LINUX_MIB_TCPSACKDISCARD), + SNMP_MIB_ITEM("TCPDSACKIgnoredOld", LINUX_MIB_TCPDSACKIGNOREDOLD), + SNMP_MIB_ITEM("TCPDSACKIgnoredNoUndo", LINUX_MIB_TCPDSACKIGNOREDNOUNDO), SNMP_MIB_SENTINEL }; diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 102aefa..8692d0b 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -1222,8 +1222,16 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_ int fack_count; int dup_sack = (found_dup_sack && (i == first_sack_index)); - if (!tcp_is_sackblock_valid(tp, dup_sack, start_seq, end_seq)) + if (!tcp_is_sackblock_valid(tp, dup_sack, start_seq, end_seq)) { + if (dup_sack) { + if (!tp->undo_marker) + NET_INC_STATS_BH(LINUX_MIB_TCPDSACKIGNOREDNOUNDO); + else + NET_INC_STATS_BH(LINUX_MIB_TCPDSACKIGNOREDOLD); + } else + NET_INC_STATS_BH(LINUX_MIB_TCPSACKDISCARD); continue; + } skb = cached_skb; fack_count = cached_fack_count; -- 1.5.0.6 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH 5/5] [TCP] MIB: Add counters for discarded SACK blocks 2007-08-20 13:16 ` [PATCH 5/5] [TCP] MIB: Add counters for discarded " Ilpo Järvinen @ 2007-08-25 5:56 ` David Miller 0 siblings, 0 replies; 12+ messages in thread From: David Miller @ 2007-08-25 5:56 UTC (permalink / raw) To: ilpo.jarvinen; +Cc: netdev From: "Ilpo_Järvinen" <ilpo.jarvinen@helsinki.fi> Date: Mon, 20 Aug 2007 16:16:33 +0300 > In DSACK case, some events are not extraordinary, such as packet > duplication generated DSACK. They can arrive easily below > snd_una when undo_marker is not set (TCP being in CA_Open), > counting such DSACKs amoung SACK discards will likely just > mislead if they occur in some scenario when there are other > problems as well. Similarly, excessively delayed packets could > cause "normal" DSACKs. Therefore, separate counters are > allocated for DSACK events. > > Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi> Also applied, thanks a lot! ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 4/5] [TCP]: Discard fuzzy SACK blocks 2007-08-20 13:16 ` [PATCH 4/5] [TCP]: Discard fuzzy SACK blocks Ilpo Järvinen 2007-08-20 13:16 ` [PATCH 5/5] [TCP] MIB: Add counters for discarded " Ilpo Järvinen @ 2007-08-25 5:55 ` David Miller 2007-08-25 8:47 ` Ilpo Järvinen 1 sibling, 1 reply; 12+ messages in thread From: David Miller @ 2007-08-25 5:55 UTC (permalink / raw) To: ilpo.jarvinen; +Cc: netdev From: "Ilpo_Järvinen" <ilpo.jarvinen@helsinki.fi> Date: Mon, 20 Aug 2007 16:16:32 +0300 > SACK processing code has been a sort of russian roulette as no > validation of SACK blocks is previously attempted. Besides, it > is not very clear what all kinds of broken SACK blocks really > mean (e.g., one that has start and end sequence numbers > reversed). So now close the roulette once and for all. > > Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi> Thanks a lot for coding this up, I like it a lot, applied. I have some minor worries about the D-SACK lower bound, but it's probably OK and I'm just being paranoid :-) ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 4/5] [TCP]: Discard fuzzy SACK blocks 2007-08-25 5:55 ` [PATCH 4/5] [TCP]: Discard fuzzy " David Miller @ 2007-08-25 8:47 ` Ilpo Järvinen 0 siblings, 0 replies; 12+ messages in thread From: Ilpo Järvinen @ 2007-08-25 8:47 UTC (permalink / raw) To: David Miller; +Cc: Netdev [-- Attachment #1: Type: TEXT/PLAIN, Size: 3971 bytes --] On Fri, 24 Aug 2007, David Miller wrote: > From: "Ilpo_Järvinen" <ilpo.jarvinen@helsinki.fi> > Date: Mon, 20 Aug 2007 16:16:32 +0300 > > > SACK processing code has been a sort of russian roulette as no > > validation of SACK blocks is previously attempted. Besides, it > > is not very clear what all kinds of broken SACK blocks really > > mean (e.g., one that has start and end sequence numbers > > reversed). So now close the roulette once and for all. > > > > Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi> > > Thanks a lot for coding this up, I like it a lot, applied. > > I have some minor worries about the D-SACK lower bound, but > it's probably OK and I'm just being paranoid :-) ...Please tell what is your concern rather than hinting :-), or is it just a hunch?... Elsewhere we do a similar checking anyway (I might eventually end up dropping this check in dsack as duplicate due to other planned changes but it's necessary still as the validation is being done in the mainloop after check_dsack call): /* D-SACK for already forgotten data... Do dumb counting. */ if (dup_sack && !after(end_seq_0, prior_snd_una) && after(end_seq_0, tp->undo_marker)) tp->undo_retrans--; ...It's natural that due to HW duplication that we get DSACK below undo_marker when state <= CA_CWR. In general, they almost always mean exactly that, a HW duplication, so instead IMHO we should account them as DSACK lying bit in sack_ok and disable DSACK undos for that flow (similar case is !EVER_RETRANS skb gets DSACKed). In theory, it could be delayed rexmission or something but we've already lost our state already and cannot verify that, so choosing the conservative dsack-lying bit there seems fine and should even be right thing for majority of the cases anyway. I was planning to do something along those lines later... The key problem here was (in the previous version that was in tcp-2.6), that the whole validation business becomes rather useless, if any invalid SACK blocks (those that really aren't DSACK but due to bug, malicious or whatever reason) below snd_una gets accepted as DSACK, that's basically the thing I wanted to avoid as it will be significant for the half of the seqno space... Now there's hopefully a bit smaller window for such garbage... :-) Key exits from tcp_is_sackblock_valid reside before those checks anyway, so they shouldn't be that problematic in performance wise either. ...I was thinking of adding unlikely to the latter checks but wasn't too sure if that's wise thing to do as malicious entity could push TCP to do them (basically at will), Comments? One additional note: the mainloop operates anyway only in the seqno range above prior_snd_una (earlier skbs already being dropped), that can't ever be < undo_marker (so some of the DSACK checks are not yet strictly necessary but I wanted to do things right from the beginning as I might end up re-placing validation soo ;-)). ...So our discussion currently probably covers seqno range that is not going to have any significance at all... :-) Maybe my "Too old" comment deserves some additional explanation: [PATCH] [TCP]: More verbose comment to DSACK validation Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi> --- net/ipv4/tcp_input.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 8692d0b..cd187c6 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -1070,7 +1070,10 @@ static int tcp_is_sackblock_valid(struct tcp_sock *tp, int is_dsack, if (!before(start_seq, tp->undo_marker)) return 1; - /* Too old */ + /* Too old (it no longer has any significance to TCP state though + * it can be valid; for more complete explanation see comment above + * and similar validation done in tcp_check_dsack()) + */ if (!after(end_seq, tp->undo_marker)) return 0; -- 1.5.0.6 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH 3/5] [TCP]: Rename tcp_ack_packets_out -> tcp_rearm_rto 2007-08-20 13:16 ` [PATCH 3/5] [TCP]: Rename tcp_ack_packets_out -> tcp_rearm_rto Ilpo Järvinen 2007-08-20 13:16 ` [PATCH 4/5] [TCP]: Discard fuzzy SACK blocks Ilpo Järvinen @ 2007-08-25 5:53 ` David Miller 1 sibling, 0 replies; 12+ messages in thread From: David Miller @ 2007-08-25 5:53 UTC (permalink / raw) To: ilpo.jarvinen; +Cc: netdev From: "Ilpo_Järvinen" <ilpo.jarvinen@helsinki.fi> Date: Mon, 20 Aug 2007 16:16:31 +0300 > Only thing that tiny function does is rearming the RTO (if > necessary), name it accordingly. > > Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi> Applied, thanks. ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/5] [TCP]: tcp_packets_out_inc to tcp_output.c (no callers elsewhere) 2007-08-20 13:16 ` [PATCH 2/5] [TCP]: tcp_packets_out_inc to tcp_output.c (no callers elsewhere) Ilpo Järvinen 2007-08-20 13:16 ` [PATCH 3/5] [TCP]: Rename tcp_ack_packets_out -> tcp_rearm_rto Ilpo Järvinen @ 2007-08-25 5:44 ` David Miller 1 sibling, 0 replies; 12+ messages in thread From: David Miller @ 2007-08-25 5:44 UTC (permalink / raw) To: ilpo.jarvinen; +Cc: netdev From: "Ilpo_Järvinen" <ilpo.jarvinen@helsinki.fi> Date: Mon, 20 Aug 2007 16:16:30 +0300 > Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi> Applied. ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/5] [TCP]: Remove unnecessary wrapper tcp_packets_out_dec 2007-08-20 13:16 ` [PATCH 1/5] [TCP]: Remove unnecessary wrapper tcp_packets_out_dec Ilpo Järvinen 2007-08-20 13:16 ` [PATCH 2/5] [TCP]: tcp_packets_out_inc to tcp_output.c (no callers elsewhere) Ilpo Järvinen @ 2007-08-25 5:43 ` David Miller 1 sibling, 0 replies; 12+ messages in thread From: David Miller @ 2007-08-25 5:43 UTC (permalink / raw) To: ilpo.jarvinen; +Cc: netdev From: "Ilpo_Järvinen" <ilpo.jarvinen@helsinki.fi> Date: Mon, 20 Aug 2007 16:16:29 +0300 > Makes caller side more obvious, there's no need to have > a wrapper for this oneliner! > > Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi> Applied, thanks. ^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2007-08-25 8:47 UTC | newest] Thread overview: 12+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2007-08-20 13:16 [PATCH net-2.6.24 0/5] TCP: Cleanups & SACK block validation Ilpo Järvinen 2007-08-20 13:16 ` [PATCH 1/5] [TCP]: Remove unnecessary wrapper tcp_packets_out_dec Ilpo Järvinen 2007-08-20 13:16 ` [PATCH 2/5] [TCP]: tcp_packets_out_inc to tcp_output.c (no callers elsewhere) Ilpo Järvinen 2007-08-20 13:16 ` [PATCH 3/5] [TCP]: Rename tcp_ack_packets_out -> tcp_rearm_rto Ilpo Järvinen 2007-08-20 13:16 ` [PATCH 4/5] [TCP]: Discard fuzzy SACK blocks Ilpo Järvinen 2007-08-20 13:16 ` [PATCH 5/5] [TCP] MIB: Add counters for discarded " Ilpo Järvinen 2007-08-25 5:56 ` David Miller 2007-08-25 5:55 ` [PATCH 4/5] [TCP]: Discard fuzzy " David Miller 2007-08-25 8:47 ` Ilpo Järvinen 2007-08-25 5:53 ` [PATCH 3/5] [TCP]: Rename tcp_ack_packets_out -> tcp_rearm_rto David Miller 2007-08-25 5:44 ` [PATCH 2/5] [TCP]: tcp_packets_out_inc to tcp_output.c (no callers elsewhere) David Miller 2007-08-25 5:43 ` [PATCH 1/5] [TCP]: Remove unnecessary wrapper tcp_packets_out_dec David Miller
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).