aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp_input.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2013-04-22 20:32:51 -0400
committerDavid S. Miller <davem@davemloft.net>2013-04-22 20:32:51 -0400
commit6e0895c2ea326cc4bb11e8fa2f654628d5754c31 (patch)
tree7089303ac11a12edc43a8c4fa1b23974e10937ea /net/ipv4/tcp_input.c
parent55fbbe46e9eb3cbe6c335503f5550855a1128dce (diff)
parent60d509fa6a9c4653a86ad830e4c4b30360b23f0e (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Conflicts: drivers/net/ethernet/emulex/benet/be_main.c drivers/net/ethernet/intel/igb/igb_main.c drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c include/net/scm.h net/batman-adv/routing.c net/ipv4/tcp_input.c The e{uid,gid} --> {uid,gid} credentials fix conflicted with the cleanup in net-next to now pass cred structs around. The be2net driver had a bug fix in 'net' that overlapped with the VLAN interface changes by Patrick McHardy in net-next. An IGB conflict existed because in 'net' the build_skb() support was reverted, and in 'net-next' there was a comment style fix within that code. Several batman-adv conflicts were resolved by making sure that all calls to batadv_is_my_mac() are changed to have a new bat_priv first argument. Eric Dumazet's TS ECR fix in TCP in 'net' conflicted with the F-RTO rewrite in 'net-next', mostly overlapping changes. Thanks to Stephen Rothwell and Antonio Quartulli for help with several of these merge resolutions. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp_input.c')
-rw-r--r--net/ipv4/tcp_input.c64
1 files changed, 31 insertions, 33 deletions
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 6d9ca35f0c35..aafd052865ba 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -111,6 +111,7 @@ int sysctl_tcp_early_retrans __read_mostly = 3;
111#define FLAG_SND_UNA_ADVANCED 0x400 /* Snd_una was changed (!= FLAG_DATA_ACKED) */ 111#define FLAG_SND_UNA_ADVANCED 0x400 /* Snd_una was changed (!= FLAG_DATA_ACKED) */
112#define FLAG_DSACKING_ACK 0x800 /* SACK blocks contained D-SACK info */ 112#define FLAG_DSACKING_ACK 0x800 /* SACK blocks contained D-SACK info */
113#define FLAG_SACK_RENEGING 0x2000 /* snd_una advanced to a sacked seq */ 113#define FLAG_SACK_RENEGING 0x2000 /* snd_una advanced to a sacked seq */
114#define FLAG_UPDATE_TS_RECENT 0x4000 /* tcp_replace_ts_recent() */
114 115
115#define FLAG_ACKED (FLAG_DATA_ACKED|FLAG_SYN_ACKED) 116#define FLAG_ACKED (FLAG_DATA_ACKED|FLAG_SYN_ACKED)
116#define FLAG_NOT_DUP (FLAG_DATA|FLAG_WIN_UPDATE|FLAG_ACKED) 117#define FLAG_NOT_DUP (FLAG_DATA|FLAG_WIN_UPDATE|FLAG_ACKED)
@@ -3265,6 +3266,27 @@ static void tcp_send_challenge_ack(struct sock *sk)
3265 } 3266 }
3266} 3267}
3267 3268
3269static void tcp_store_ts_recent(struct tcp_sock *tp)
3270{
3271 tp->rx_opt.ts_recent = tp->rx_opt.rcv_tsval;
3272 tp->rx_opt.ts_recent_stamp = get_seconds();
3273}
3274
3275static void tcp_replace_ts_recent(struct tcp_sock *tp, u32 seq)
3276{
3277 if (tp->rx_opt.saw_tstamp && !after(seq, tp->rcv_wup)) {
3278 /* PAWS bug workaround wrt. ACK frames, the PAWS discard
3279 * extra check below makes sure this can only happen
3280 * for pure ACK frames. -DaveM
3281 *
3282 * Not only, also it occurs for expired timestamps.
3283 */
3284
3285 if (tcp_paws_check(&tp->rx_opt, 0))
3286 tcp_store_ts_recent(tp);
3287 }
3288}
3289
3268/* This routine deals with acks during a TLP episode. 3290/* This routine deals with acks during a TLP episode.
3269 * Ref: loss detection algorithm in draft-dukkipati-tcpm-tcp-loss-probe. 3291 * Ref: loss detection algorithm in draft-dukkipati-tcpm-tcp-loss-probe.
3270 */ 3292 */
@@ -3340,6 +3362,12 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag)
3340 prior_fackets = tp->fackets_out; 3362 prior_fackets = tp->fackets_out;
3341 prior_in_flight = tcp_packets_in_flight(tp); 3363 prior_in_flight = tcp_packets_in_flight(tp);
3342 3364
3365 /* ts_recent update must be made after we are sure that the packet
3366 * is in window.
3367 */
3368 if (flag & FLAG_UPDATE_TS_RECENT)
3369 tcp_replace_ts_recent(tp, TCP_SKB_CB(skb)->seq);
3370
3343 if (!(flag & FLAG_SLOWPATH) && after(ack, prior_snd_una)) { 3371 if (!(flag & FLAG_SLOWPATH) && after(ack, prior_snd_una)) {
3344 /* Window is constant, pure forward advance. 3372 /* Window is constant, pure forward advance.
3345 * No more checks are required. 3373 * No more checks are required.
@@ -3636,27 +3664,6 @@ const u8 *tcp_parse_md5sig_option(const struct tcphdr *th)
3636EXPORT_SYMBOL(tcp_parse_md5sig_option); 3664EXPORT_SYMBOL(tcp_parse_md5sig_option);
3637#endif 3665#endif
3638 3666
3639static inline void tcp_store_ts_recent(struct tcp_sock *tp)
3640{
3641 tp->rx_opt.ts_recent = tp->rx_opt.rcv_tsval;
3642 tp->rx_opt.ts_recent_stamp = get_seconds();
3643}
3644
3645static inline void tcp_replace_ts_recent(struct tcp_sock *tp, u32 seq)
3646{
3647 if (tp->rx_opt.saw_tstamp && !after(seq, tp->rcv_wup)) {
3648 /* PAWS bug workaround wrt. ACK frames, the PAWS discard
3649 * extra check below makes sure this can only happen
3650 * for pure ACK frames. -DaveM
3651 *
3652 * Not only, also it occurs for expired timestamps.
3653 */
3654
3655 if (tcp_paws_check(&tp->rx_opt, 0))
3656 tcp_store_ts_recent(tp);
3657 }
3658}
3659
3660/* Sorry, PAWS as specified is broken wrt. pure-ACKs -DaveM 3667/* Sorry, PAWS as specified is broken wrt. pure-ACKs -DaveM
3661 * 3668 *
3662 * It is not fatal. If this ACK does _not_ change critical state (seqs, window) 3669 * It is not fatal. If this ACK does _not_ change critical state (seqs, window)
@@ -5250,14 +5257,9 @@ slow_path:
5250 return 0; 5257 return 0;
5251 5258
5252step5: 5259step5:
5253 if (tcp_ack(sk, skb, FLAG_SLOWPATH) < 0) 5260 if (tcp_ack(sk, skb, FLAG_SLOWPATH | FLAG_UPDATE_TS_RECENT) < 0)
5254 goto discard; 5261 goto discard;
5255 5262
5256 /* ts_recent update must be made after we are sure that the packet
5257 * is in window.
5258 */
5259 tcp_replace_ts_recent(tp, TCP_SKB_CB(skb)->seq);
5260
5261 tcp_rcv_rtt_measure_ts(sk, skb); 5263 tcp_rcv_rtt_measure_ts(sk, skb);
5262 5264
5263 /* Process urgent data. */ 5265 /* Process urgent data. */
@@ -5666,7 +5668,8 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
5666 5668
5667 /* step 5: check the ACK field */ 5669 /* step 5: check the ACK field */
5668 if (true) { 5670 if (true) {
5669 int acceptable = tcp_ack(sk, skb, FLAG_SLOWPATH) > 0; 5671 int acceptable = tcp_ack(sk, skb, FLAG_SLOWPATH |
5672 FLAG_UPDATE_TS_RECENT) > 0;
5670 5673
5671 switch (sk->sk_state) { 5674 switch (sk->sk_state) {
5672 case TCP_SYN_RECV: 5675 case TCP_SYN_RECV:
@@ -5817,11 +5820,6 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
5817 } 5820 }
5818 } 5821 }
5819 5822
5820 /* ts_recent update must be made after we are sure that the packet
5821 * is in window.
5822 */
5823 tcp_replace_ts_recent(tp, TCP_SKB_CB(skb)->seq);
5824
5825 /* step 6: check the URG bit */ 5823 /* step 6: check the URG bit */
5826 tcp_urg(sk, skb, th); 5824 tcp_urg(sk, skb, th);
5827 5825