diff options
author | Vijay Subramanian <subramanian.vijay@gmail.com> | 2011-12-20 08:23:24 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-12-21 01:03:23 -0500 |
commit | ab56222a32b9dbaae19c1d37f07b0ac4fc3c27ec (patch) | |
tree | ce5eff7879a1d80c419835171de13e52c24afdfb /net/ipv4 | |
parent | 08f4fc9da9a04d59f5c937e06e375158abb68206 (diff) |
tcp: Replace constants with #define macros
to record the state of SACK/FACK and DSACK for better readability and maintenance.
Signed-off-by: Vijay Subramanian <subramanian.vijay@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r-- | net/ipv4/syncookies.c | 2 | ||||
-rw-r--r-- | net/ipv4/tcp_input.c | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/net/ipv4/syncookies.c b/net/ipv4/syncookies.c index 90f6544c13e2..51fdbb490437 100644 --- a/net/ipv4/syncookies.c +++ b/net/ipv4/syncookies.c | |||
@@ -245,7 +245,7 @@ bool cookie_check_timestamp(struct tcp_options_received *tcp_opt, bool *ecn_ok) | |||
245 | if (!sysctl_tcp_timestamps) | 245 | if (!sysctl_tcp_timestamps) |
246 | return false; | 246 | return false; |
247 | 247 | ||
248 | tcp_opt->sack_ok = (options >> 4) & 0x1; | 248 | tcp_opt->sack_ok = (options & (1 << 4)) ? TCP_SACK_SEEN : 0; |
249 | *ecn_ok = (options >> 5) & 1; | 249 | *ecn_ok = (options >> 5) & 1; |
250 | if (*ecn_ok && !sysctl_tcp_ecn) | 250 | if (*ecn_ok && !sysctl_tcp_ecn) |
251 | return false; | 251 | return false; |
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index f131d92d25ee..2877c3e09587 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -865,13 +865,13 @@ static void tcp_disable_fack(struct tcp_sock *tp) | |||
865 | /* RFC3517 uses different metric in lost marker => reset on change */ | 865 | /* RFC3517 uses different metric in lost marker => reset on change */ |
866 | if (tcp_is_fack(tp)) | 866 | if (tcp_is_fack(tp)) |
867 | tp->lost_skb_hint = NULL; | 867 | tp->lost_skb_hint = NULL; |
868 | tp->rx_opt.sack_ok &= ~2; | 868 | tp->rx_opt.sack_ok &= ~TCP_FACK_ENABLED; |
869 | } | 869 | } |
870 | 870 | ||
871 | /* Take a notice that peer is sending D-SACKs */ | 871 | /* Take a notice that peer is sending D-SACKs */ |
872 | static void tcp_dsack_seen(struct tcp_sock *tp) | 872 | static void tcp_dsack_seen(struct tcp_sock *tp) |
873 | { | 873 | { |
874 | tp->rx_opt.sack_ok |= 4; | 874 | tp->rx_opt.sack_ok |= TCP_DSACK_SEEN; |
875 | } | 875 | } |
876 | 876 | ||
877 | /* Initialize metrics on socket. */ | 877 | /* Initialize metrics on socket. */ |
@@ -3878,7 +3878,7 @@ void tcp_parse_options(const struct sk_buff *skb, struct tcp_options_received *o | |||
3878 | case TCPOPT_SACK_PERM: | 3878 | case TCPOPT_SACK_PERM: |
3879 | if (opsize == TCPOLEN_SACK_PERM && th->syn && | 3879 | if (opsize == TCPOLEN_SACK_PERM && th->syn && |
3880 | !estab && sysctl_tcp_sack) { | 3880 | !estab && sysctl_tcp_sack) { |
3881 | opt_rx->sack_ok = 1; | 3881 | opt_rx->sack_ok = TCP_SACK_SEEN; |
3882 | tcp_sack_reset(opt_rx); | 3882 | tcp_sack_reset(opt_rx); |
3883 | } | 3883 | } |
3884 | break; | 3884 | break; |