Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 2nd, 2012  |  syntax: None  |  size: 1.36 KB  |  hits: 21  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. 112 int tcp_twsk_unique(struct sock *sk, struct sock *sktw, void *twp)
  2. 113 {
  3. 114         const struct tcp_timewait_sock *tcptw = tcp_twsk(sktw);
  4. 115         struct tcp_sock *tp = tcp_sk(sk);
  5. 116
  6. 117         /* With PAWS, it is safe from the viewpoint
  7. 118            of data integrity. Even without PAWS it is safe provided sequence
  8. 119            spaces do not overlap i.e. at data rates <= 80Mbit/sec.
  9. 120
  10. 121            Actually, the idea is close to VJ's one, only timestamp cache is
  11. 122            held not per host, but per port pair and TW bucket is used as state
  12. 123            holder.
  13. 124
  14. 125            If TW bucket has been already destroyed we fall back to VJ's scheme
  15. 126            and use initial timestamp retrieved from peer table.
  16. 127          */
  17. 128         if (tcptw->tw_ts_recent_stamp &&
  18. 129             (twp == NULL || (sysctl_tcp_tw_reuse &&
  19. 130                              get_seconds() - tcptw->tw_ts_recent_stamp > 1))) {
  20. 131                 tp->write_seq = tcptw->tw_snd_nxt + 65535 + 2;
  21. 132                 if (tp->write_seq == 0)
  22. 133                         tp->write_seq = 1;
  23. 134                 tp->rx_opt.ts_recent       = tcptw->tw_ts_recent;
  24. 135                 tp->rx_opt.ts_recent_stamp = tcptw->tw_ts_recent_stamp;
  25. 136                 sock_hold(sktw);
  26. 137                 return 1;
  27. 138         }
  28. 139
  29. 140         return 0;
  30. 141 }