Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tcp: Change return value of tcp_rcv_established()

tcp_rcv_established() returns only one value namely 0. We change the return
value to void (as suggested by David Miller).

After commit 0c24604b (tcp: implement RFC 5961 4.2), we no longer send RSTs in
response to SYNs. We can remove the check and processing on the return value of
tcp_rcv_established().

We also fix jtcp_rcv_established() in tcp_probe.c to match that of
tcp_rcv_established().

Signed-off-by: Vijay Subramanian <subramanian.vijay@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Vijay Subramanian and committed by
David S. Miller
c995ae22 cc8c6c1b

+12 -18
+2 -2
include/net/tcp.h
··· 371 371 extern int tcp_ioctl(struct sock *sk, int cmd, unsigned long arg); 372 372 extern int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb, 373 373 const struct tcphdr *th, unsigned int len); 374 - extern int tcp_rcv_established(struct sock *sk, struct sk_buff *skb, 375 - const struct tcphdr *th, unsigned int len); 374 + extern void tcp_rcv_established(struct sock *sk, struct sk_buff *skb, 375 + const struct tcphdr *th, unsigned int len); 376 376 extern void tcp_rcv_space_adjust(struct sock *sk); 377 377 extern void tcp_cleanup_rbuf(struct sock *sk, int copied); 378 378 extern int tcp_twsk_unique(struct sock *sk, struct sock *sktw, void *twp);
+6 -7
net/ipv4/tcp_input.c
··· 5049 5049 * the rest is checked inline. Fast processing is turned on in 5050 5050 * tcp_data_queue when everything is OK. 5051 5051 */ 5052 - int tcp_rcv_established(struct sock *sk, struct sk_buff *skb, 5053 - const struct tcphdr *th, unsigned int len) 5052 + void tcp_rcv_established(struct sock *sk, struct sk_buff *skb, 5053 + const struct tcphdr *th, unsigned int len) 5054 5054 { 5055 5055 struct tcp_sock *tp = tcp_sk(sk); 5056 5056 ··· 5127 5127 tcp_ack(sk, skb, 0); 5128 5128 __kfree_skb(skb); 5129 5129 tcp_data_snd_check(sk); 5130 - return 0; 5130 + return; 5131 5131 } else { /* Header too small */ 5132 5132 TCP_INC_STATS_BH(sock_net(sk), TCP_MIB_INERRS); 5133 5133 goto discard; ··· 5220 5220 if (eaten) 5221 5221 kfree_skb_partial(skb, fragstolen); 5222 5222 sk->sk_data_ready(sk, 0); 5223 - return 0; 5223 + return; 5224 5224 } 5225 5225 } 5226 5226 ··· 5236 5236 */ 5237 5237 5238 5238 if (!tcp_validate_incoming(sk, skb, th, 1)) 5239 - return 0; 5239 + return; 5240 5240 5241 5241 step5: 5242 5242 if (tcp_ack(sk, skb, FLAG_SLOWPATH | FLAG_UPDATE_TS_RECENT) < 0) ··· 5252 5252 5253 5253 tcp_data_snd_check(sk); 5254 5254 tcp_ack_snd_check(sk); 5255 - return 0; 5255 + return; 5256 5256 5257 5257 csum_error: 5258 5258 TCP_INC_STATS_BH(sock_net(sk), TCP_MIB_CSUMERRORS); ··· 5260 5260 5261 5261 discard: 5262 5262 __kfree_skb(skb); 5263 - return 0; 5264 5263 } 5265 5264 EXPORT_SYMBOL(tcp_rcv_established); 5266 5265
+1 -4
net/ipv4/tcp_ipv4.c
··· 1799 1799 sk->sk_rx_dst = NULL; 1800 1800 } 1801 1801 } 1802 - if (tcp_rcv_established(sk, skb, tcp_hdr(skb), skb->len)) { 1803 - rsk = sk; 1804 - goto reset; 1805 - } 1802 + tcp_rcv_established(sk, skb, tcp_hdr(skb), skb->len); 1806 1803 return 0; 1807 1804 } 1808 1805
+2 -3
net/ipv4/tcp_probe.c
··· 122 122 * Hook inserted to be called before each receive packet. 123 123 * Note: arguments must match tcp_rcv_established()! 124 124 */ 125 - static int jtcp_rcv_established(struct sock *sk, struct sk_buff *skb, 126 - const struct tcphdr *th, unsigned int len) 125 + static void jtcp_rcv_established(struct sock *sk, struct sk_buff *skb, 126 + const struct tcphdr *th, unsigned int len) 127 127 { 128 128 const struct tcp_sock *tp = tcp_sk(sk); 129 129 const struct inet_sock *inet = inet_sk(sk); ··· 172 172 } 173 173 174 174 jprobe_return(); 175 - return 0; 176 175 } 177 176 178 177 static struct jprobe tcp_jprobe = {
+1 -2
net/ipv6/tcp_ipv6.c
··· 1360 1360 } 1361 1361 } 1362 1362 1363 - if (tcp_rcv_established(sk, skb, tcp_hdr(skb), skb->len)) 1364 - goto reset; 1363 + tcp_rcv_established(sk, skb, tcp_hdr(skb), skb->len); 1365 1364 if (opt_skb) 1366 1365 goto ipv6_pktoptions; 1367 1366 return 0;