Skip to content

Commit c995ae2

Browse files
subravdavem330
authored andcommitted
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 0c24604 (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>
1 parent cc8c6c1 commit c995ae2

File tree

5 files changed

+12
-18
lines changed

5 files changed

+12
-18
lines changed

include/net/tcp.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -371,8 +371,8 @@ extern void tcp_delack_timer_handler(struct sock *sk);
371371
extern int tcp_ioctl(struct sock *sk, int cmd, unsigned long arg);
372372
extern int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
373373
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);
376376
extern void tcp_rcv_space_adjust(struct sock *sk);
377377
extern void tcp_cleanup_rbuf(struct sock *sk, int copied);
378378
extern int tcp_twsk_unique(struct sock *sk, struct sock *sktw, void *twp);

net/ipv4/tcp_input.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5049,8 +5049,8 @@ static bool tcp_validate_incoming(struct sock *sk, struct sk_buff *skb,
50495049
* the rest is checked inline. Fast processing is turned on in
50505050
* tcp_data_queue when everything is OK.
50515051
*/
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)
50545054
{
50555055
struct tcp_sock *tp = tcp_sk(sk);
50565056

@@ -5127,7 +5127,7 @@ int tcp_rcv_established(struct sock *sk, struct sk_buff *skb,
51275127
tcp_ack(sk, skb, 0);
51285128
__kfree_skb(skb);
51295129
tcp_data_snd_check(sk);
5130-
return 0;
5130+
return;
51315131
} else { /* Header too small */
51325132
TCP_INC_STATS_BH(sock_net(sk), TCP_MIB_INERRS);
51335133
goto discard;
@@ -5220,7 +5220,7 @@ int tcp_rcv_established(struct sock *sk, struct sk_buff *skb,
52205220
if (eaten)
52215221
kfree_skb_partial(skb, fragstolen);
52225222
sk->sk_data_ready(sk, 0);
5223-
return 0;
5223+
return;
52245224
}
52255225
}
52265226

@@ -5236,7 +5236,7 @@ int tcp_rcv_established(struct sock *sk, struct sk_buff *skb,
52365236
*/
52375237

52385238
if (!tcp_validate_incoming(sk, skb, th, 1))
5239-
return 0;
5239+
return;
52405240

52415241
step5:
52425242
if (tcp_ack(sk, skb, FLAG_SLOWPATH | FLAG_UPDATE_TS_RECENT) < 0)
@@ -5252,15 +5252,14 @@ int tcp_rcv_established(struct sock *sk, struct sk_buff *skb,
52525252

52535253
tcp_data_snd_check(sk);
52545254
tcp_ack_snd_check(sk);
5255-
return 0;
5255+
return;
52565256

52575257
csum_error:
52585258
TCP_INC_STATS_BH(sock_net(sk), TCP_MIB_CSUMERRORS);
52595259
TCP_INC_STATS_BH(sock_net(sk), TCP_MIB_INERRS);
52605260

52615261
discard:
52625262
__kfree_skb(skb);
5263-
return 0;
52645263
}
52655264
EXPORT_SYMBOL(tcp_rcv_established);
52665265

net/ipv4/tcp_ipv4.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1799,10 +1799,7 @@ int tcp_v4_do_rcv(struct sock *sk, struct sk_buff *skb)
17991799
sk->sk_rx_dst = NULL;
18001800
}
18011801
}
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);
18061803
return 0;
18071804
}
18081805

net/ipv4/tcp_probe.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,8 @@ static inline int tcp_probe_avail(void)
122122
* Hook inserted to be called before each receive packet.
123123
* Note: arguments must match tcp_rcv_established()!
124124
*/
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)
127127
{
128128
const struct tcp_sock *tp = tcp_sk(sk);
129129
const struct inet_sock *inet = inet_sk(sk);
@@ -172,7 +172,6 @@ static int jtcp_rcv_established(struct sock *sk, struct sk_buff *skb,
172172
}
173173

174174
jprobe_return();
175-
return 0;
176175
}
177176

178177
static struct jprobe tcp_jprobe = {

net/ipv6/tcp_ipv6.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1360,8 +1360,7 @@ static int tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb)
13601360
}
13611361
}
13621362

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);
13651364
if (opt_skb)
13661365
goto ipv6_pktoptions;
13671366
return 0;

0 commit comments

Comments
 (0)