Skip to content

Commit adfb62d

Browse files
committed
Merge branch 'tcp_drop_reason'
Menglong Dong says: ==================== net: add skb drop reasons to TCP packet receive In the commit c504e5c ("net: skb: introduce kfree_skb_reason()"), we added the support of reporting the reasons of skb drops to kfree_skb tracepoint. And in this series patches, reasons for skb drops are added to TCP layer (both TCPv4 and TCPv6 are considered). Following functions are processed: tcp_v4_rcv() tcp_v6_rcv() tcp_v4_inbound_md5_hash() tcp_v6_inbound_md5_hash() tcp_add_backlog() tcp_v4_do_rcv() tcp_v6_do_rcv() tcp_rcv_established() tcp_data_queue() tcp_data_queue_ofo() The functions we handled are mostly for packet ingress, as skb drops hardly happens in the egress path of TCP layer. However, it's a little complex for TCP state processing, as I find that it's hard to report skb drop reasons to where it is freed. For example, when skb is dropped in tcp_rcv_state_process(), the reason can be caused by the call of tcp_v4_conn_request(), and it's hard to return a drop reason from tcp_v4_conn_request(). So such cases are skipped for this moment. Following new drop reasons are introduced (what they mean can be see in the document for them): /* SKB_DROP_REASON_TCP_MD5* corresponding to LINUX_MIB_TCPMD5* */ SKB_DROP_REASON_TCP_MD5NOTFOUND SKB_DROP_REASON_TCP_MD5UNEXPECTED SKB_DROP_REASON_TCP_MD5FAILURE SKB_DROP_REASON_SOCKET_BACKLOG SKB_DROP_REASON_TCP_FLAGS SKB_DROP_REASON_TCP_ZEROWINDOW SKB_DROP_REASON_TCP_OLD_DATA SKB_DROP_REASON_TCP_OVERWINDOW /* corresponding to LINUX_MIB_TCPOFOMERGE */ SKB_DROP_REASON_TCP_OFOMERGE Here is a example to get TCP packet drop reasons from ftrace: $ echo 1 > /sys/kernel/debug/tracing/events/skb/kfree_skb/enable $ cat /sys/kernel/debug/tracing/trace $ <idle>-0 [036] ..s1. 647.428165: kfree_skb: skbaddr=000000004d037db6 protocol=2048 location=0000000074cd1243 reason: NO_SOCKET $ <idle>-0 [020] ..s2. 639.676674: kfree_skb: skbaddr=00000000bcbfa42d protocol=2048 location=00000000bfe89d35 reason: PROTO_MEM From the reason 'PROTO_MEM' we can know that the skb is dropped because the memory configured in net.ipv4.tcp_mem is up to the limition. Changes since v2: - remove the 'inline' of tcp_drop() in the 1th patch, as Jakub suggested Changes since v1: - enrich the document for this series patches in the cover letter, as Eric suggested - fix compile warning report by Jakub in the 6th patch - let NO_SOCKET trump the XFRM failure in the 2th and 3th patches ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 48c77bd + d25e481 commit adfb62d

File tree

6 files changed

+132
-28
lines changed

6 files changed

+132
-28
lines changed

include/linux/skbuff.h

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,40 @@ enum skb_drop_reason {
346346
* udp packet drop out of
347347
* udp_memory_allocated.
348348
*/
349+
SKB_DROP_REASON_TCP_MD5NOTFOUND, /* no MD5 hash and one
350+
* expected, corresponding
351+
* to LINUX_MIB_TCPMD5NOTFOUND
352+
*/
353+
SKB_DROP_REASON_TCP_MD5UNEXPECTED, /* MD5 hash and we're not
354+
* expecting one, corresponding
355+
* to LINUX_MIB_TCPMD5UNEXPECTED
356+
*/
357+
SKB_DROP_REASON_TCP_MD5FAILURE, /* MD5 hash and its wrong,
358+
* corresponding to
359+
* LINUX_MIB_TCPMD5FAILURE
360+
*/
361+
SKB_DROP_REASON_SOCKET_BACKLOG, /* failed to add skb to socket
362+
* backlog (see
363+
* LINUX_MIB_TCPBACKLOGDROP)
364+
*/
365+
SKB_DROP_REASON_TCP_FLAGS, /* TCP flags invalid */
366+
SKB_DROP_REASON_TCP_ZEROWINDOW, /* TCP receive window size is zero,
367+
* see LINUX_MIB_TCPZEROWINDOWDROP
368+
*/
369+
SKB_DROP_REASON_TCP_OLD_DATA, /* the TCP data reveived is already
370+
* received before (spurious retrans
371+
* may happened), see
372+
* LINUX_MIB_DELAYEDACKLOST
373+
*/
374+
SKB_DROP_REASON_TCP_OVERWINDOW, /* the TCP data is out of window,
375+
* the seq of the first byte exceed
376+
* the right edges of receive
377+
* window
378+
*/
379+
SKB_DROP_REASON_TCP_OFOMERGE, /* the data of skb is already in
380+
* the ofo queue, corresponding to
381+
* LINUX_MIB_TCPOFOMERGE
382+
*/
349383
SKB_DROP_REASON_MAX,
350384
};
351385

include/net/tcp.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1367,7 +1367,8 @@ static inline bool tcp_checksum_complete(struct sk_buff *skb)
13671367
__skb_checksum_complete(skb);
13681368
}
13691369

1370-
bool tcp_add_backlog(struct sock *sk, struct sk_buff *skb);
1370+
bool tcp_add_backlog(struct sock *sk, struct sk_buff *skb,
1371+
enum skb_drop_reason *reason);
13711372

13721373
#ifdef CONFIG_INET
13731374
void __sk_defer_free_flush(struct sock *sk);

include/trace/events/skb.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,16 @@
2727
EM(SKB_DROP_REASON_IP_NOPROTO, IP_NOPROTO) \
2828
EM(SKB_DROP_REASON_SOCKET_RCVBUFF, SOCKET_RCVBUFF) \
2929
EM(SKB_DROP_REASON_PROTO_MEM, PROTO_MEM) \
30+
EM(SKB_DROP_REASON_TCP_MD5NOTFOUND, TCP_MD5NOTFOUND) \
31+
EM(SKB_DROP_REASON_TCP_MD5UNEXPECTED, \
32+
TCP_MD5UNEXPECTED) \
33+
EM(SKB_DROP_REASON_TCP_MD5FAILURE, TCP_MD5FAILURE) \
34+
EM(SKB_DROP_REASON_SOCKET_BACKLOG, SOCKET_BACKLOG) \
35+
EM(SKB_DROP_REASON_TCP_FLAGS, TCP_FLAGS) \
36+
EM(SKB_DROP_REASON_TCP_ZEROWINDOW, TCP_ZEROWINDOW) \
37+
EM(SKB_DROP_REASON_TCP_OLD_DATA, TCP_OLD_DATA) \
38+
EM(SKB_DROP_REASON_TCP_OVERWINDOW, TCP_OVERWINDOW) \
39+
EM(SKB_DROP_REASON_TCP_OFOMERGE, TCP_OFOMERGE) \
3040
EMe(SKB_DROP_REASON_MAX, MAX)
3141

3242
#undef EM

net/ipv4/tcp_input.c

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4684,10 +4684,16 @@ static bool tcp_ooo_try_coalesce(struct sock *sk,
46844684
return res;
46854685
}
46864686

4687-
static void tcp_drop(struct sock *sk, struct sk_buff *skb)
4687+
static void tcp_drop_reason(struct sock *sk, struct sk_buff *skb,
4688+
enum skb_drop_reason reason)
46884689
{
46894690
sk_drops_add(sk, skb);
4690-
__kfree_skb(skb);
4691+
kfree_skb_reason(skb, reason);
4692+
}
4693+
4694+
static void tcp_drop(struct sock *sk, struct sk_buff *skb)
4695+
{
4696+
tcp_drop_reason(sk, skb, SKB_DROP_REASON_NOT_SPECIFIED);
46914697
}
46924698

46934699
/* This one checks to see if we can put data from the
@@ -4773,7 +4779,7 @@ static void tcp_data_queue_ofo(struct sock *sk, struct sk_buff *skb)
47734779
if (unlikely(tcp_try_rmem_schedule(sk, skb, skb->truesize))) {
47744780
NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPOFODROP);
47754781
sk->sk_data_ready(sk);
4776-
tcp_drop(sk, skb);
4782+
tcp_drop_reason(sk, skb, SKB_DROP_REASON_PROTO_MEM);
47774783
return;
47784784
}
47794785

@@ -4836,7 +4842,8 @@ static void tcp_data_queue_ofo(struct sock *sk, struct sk_buff *skb)
48364842
/* All the bits are present. Drop. */
48374843
NET_INC_STATS(sock_net(sk),
48384844
LINUX_MIB_TCPOFOMERGE);
4839-
tcp_drop(sk, skb);
4845+
tcp_drop_reason(sk, skb,
4846+
SKB_DROP_REASON_TCP_OFOMERGE);
48404847
skb = NULL;
48414848
tcp_dsack_set(sk, seq, end_seq);
48424849
goto add_sack;
@@ -4855,7 +4862,8 @@ static void tcp_data_queue_ofo(struct sock *sk, struct sk_buff *skb)
48554862
TCP_SKB_CB(skb1)->end_seq);
48564863
NET_INC_STATS(sock_net(sk),
48574864
LINUX_MIB_TCPOFOMERGE);
4858-
tcp_drop(sk, skb1);
4865+
tcp_drop_reason(sk, skb1,
4866+
SKB_DROP_REASON_TCP_OFOMERGE);
48594867
goto merge_right;
48604868
}
48614869
} else if (tcp_ooo_try_coalesce(sk, skb1,
@@ -4883,7 +4891,7 @@ static void tcp_data_queue_ofo(struct sock *sk, struct sk_buff *skb)
48834891
tcp_dsack_extend(sk, TCP_SKB_CB(skb1)->seq,
48844892
TCP_SKB_CB(skb1)->end_seq);
48854893
NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPOFOMERGE);
4886-
tcp_drop(sk, skb1);
4894+
tcp_drop_reason(sk, skb1, SKB_DROP_REASON_TCP_OFOMERGE);
48874895
}
48884896
/* If there is no skb after us, we are the last_skb ! */
48894897
if (!skb1)
@@ -4982,6 +4990,7 @@ void tcp_data_ready(struct sock *sk)
49824990
static void tcp_data_queue(struct sock *sk, struct sk_buff *skb)
49834991
{
49844992
struct tcp_sock *tp = tcp_sk(sk);
4993+
enum skb_drop_reason reason;
49854994
bool fragstolen;
49864995
int eaten;
49874996

@@ -5000,6 +5009,7 @@ static void tcp_data_queue(struct sock *sk, struct sk_buff *skb)
50005009
skb_dst_drop(skb);
50015010
__skb_pull(skb, tcp_hdr(skb)->doff * 4);
50025011

5012+
reason = SKB_DROP_REASON_NOT_SPECIFIED;
50035013
tp->rx_opt.dsack = 0;
50045014

50055015
/* Queue data for delivery to the user.
@@ -5008,6 +5018,7 @@ static void tcp_data_queue(struct sock *sk, struct sk_buff *skb)
50085018
*/
50095019
if (TCP_SKB_CB(skb)->seq == tp->rcv_nxt) {
50105020
if (tcp_receive_window(tp) == 0) {
5021+
reason = SKB_DROP_REASON_TCP_ZEROWINDOW;
50115022
NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPZEROWINDOWDROP);
50125023
goto out_of_window;
50135024
}
@@ -5017,6 +5028,7 @@ static void tcp_data_queue(struct sock *sk, struct sk_buff *skb)
50175028
if (skb_queue_len(&sk->sk_receive_queue) == 0)
50185029
sk_forced_mem_schedule(sk, skb->truesize);
50195030
else if (tcp_try_rmem_schedule(sk, skb, skb->truesize)) {
5031+
reason = SKB_DROP_REASON_PROTO_MEM;
50205032
NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPRCVQDROP);
50215033
sk->sk_data_ready(sk);
50225034
goto drop;
@@ -5053,20 +5065,24 @@ static void tcp_data_queue(struct sock *sk, struct sk_buff *skb)
50535065
if (!after(TCP_SKB_CB(skb)->end_seq, tp->rcv_nxt)) {
50545066
tcp_rcv_spurious_retrans(sk, skb);
50555067
/* A retransmit, 2nd most common case. Force an immediate ack. */
5068+
reason = SKB_DROP_REASON_TCP_OLD_DATA;
50565069
NET_INC_STATS(sock_net(sk), LINUX_MIB_DELAYEDACKLOST);
50575070
tcp_dsack_set(sk, TCP_SKB_CB(skb)->seq, TCP_SKB_CB(skb)->end_seq);
50585071

50595072
out_of_window:
50605073
tcp_enter_quickack_mode(sk, TCP_MAX_QUICKACKS);
50615074
inet_csk_schedule_ack(sk);
50625075
drop:
5063-
tcp_drop(sk, skb);
5076+
tcp_drop_reason(sk, skb, reason);
50645077
return;
50655078
}
50665079

50675080
/* Out of window. F.e. zero window probe. */
5068-
if (!before(TCP_SKB_CB(skb)->seq, tp->rcv_nxt + tcp_receive_window(tp)))
5081+
if (!before(TCP_SKB_CB(skb)->seq,
5082+
tp->rcv_nxt + tcp_receive_window(tp))) {
5083+
reason = SKB_DROP_REASON_TCP_OVERWINDOW;
50695084
goto out_of_window;
5085+
}
50705086

50715087
if (before(TCP_SKB_CB(skb)->seq, tp->rcv_nxt)) {
50725088
/* Partial packet, seq < rcv_next < end_seq */
@@ -5076,6 +5092,7 @@ static void tcp_data_queue(struct sock *sk, struct sk_buff *skb)
50765092
* remembering D-SACK for its head made in previous line.
50775093
*/
50785094
if (!tcp_receive_window(tp)) {
5095+
reason = SKB_DROP_REASON_TCP_ZEROWINDOW;
50795096
NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPZEROWINDOWDROP);
50805097
goto out_of_window;
50815098
}
@@ -5781,6 +5798,7 @@ static bool tcp_validate_incoming(struct sock *sk, struct sk_buff *skb,
57815798
*/
57825799
void tcp_rcv_established(struct sock *sk, struct sk_buff *skb)
57835800
{
5801+
enum skb_drop_reason reason = SKB_DROP_REASON_NOT_SPECIFIED;
57845802
const struct tcphdr *th = (const struct tcphdr *)skb->data;
57855803
struct tcp_sock *tp = tcp_sk(sk);
57865804
unsigned int len = skb->len;
@@ -5869,6 +5887,7 @@ void tcp_rcv_established(struct sock *sk, struct sk_buff *skb)
58695887
tp->rcv_rtt_last_tsecr = tp->rx_opt.rcv_tsecr;
58705888
return;
58715889
} else { /* Header too small */
5890+
reason = SKB_DROP_REASON_PKT_TOO_SMALL;
58725891
TCP_INC_STATS(sock_net(sk), TCP_MIB_INERRS);
58735892
goto discard;
58745893
}
@@ -5924,8 +5943,10 @@ void tcp_rcv_established(struct sock *sk, struct sk_buff *skb)
59245943
if (len < (th->doff << 2) || tcp_checksum_complete(skb))
59255944
goto csum_error;
59265945

5927-
if (!th->ack && !th->rst && !th->syn)
5946+
if (!th->ack && !th->rst && !th->syn) {
5947+
reason = SKB_DROP_REASON_TCP_FLAGS;
59285948
goto discard;
5949+
}
59295950

59305951
/*
59315952
* Standard slow path.
@@ -5951,12 +5972,13 @@ void tcp_rcv_established(struct sock *sk, struct sk_buff *skb)
59515972
return;
59525973

59535974
csum_error:
5975+
reason = SKB_DROP_REASON_TCP_CSUM;
59545976
trace_tcp_bad_csum(skb);
59555977
TCP_INC_STATS(sock_net(sk), TCP_MIB_CSUMERRORS);
59565978
TCP_INC_STATS(sock_net(sk), TCP_MIB_INERRS);
59575979

59585980
discard:
5959-
tcp_drop(sk, skb);
5981+
tcp_drop_reason(sk, skb, reason);
59605982
}
59615983
EXPORT_SYMBOL(tcp_rcv_established);
59625984

net/ipv4/tcp_ipv4.c

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1412,7 +1412,8 @@ EXPORT_SYMBOL(tcp_v4_md5_hash_skb);
14121412
/* Called with rcu_read_lock() */
14131413
static bool tcp_v4_inbound_md5_hash(const struct sock *sk,
14141414
const struct sk_buff *skb,
1415-
int dif, int sdif)
1415+
int dif, int sdif,
1416+
enum skb_drop_reason *reason)
14161417
{
14171418
#ifdef CONFIG_TCP_MD5SIG
14181419
/*
@@ -1445,11 +1446,13 @@ static bool tcp_v4_inbound_md5_hash(const struct sock *sk,
14451446
return false;
14461447

14471448
if (hash_expected && !hash_location) {
1449+
*reason = SKB_DROP_REASON_TCP_MD5NOTFOUND;
14481450
NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPMD5NOTFOUND);
14491451
return true;
14501452
}
14511453

14521454
if (!hash_expected && hash_location) {
1455+
*reason = SKB_DROP_REASON_TCP_MD5UNEXPECTED;
14531456
NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPMD5UNEXPECTED);
14541457
return true;
14551458
}
@@ -1462,6 +1465,7 @@ static bool tcp_v4_inbound_md5_hash(const struct sock *sk,
14621465
NULL, skb);
14631466

14641467
if (genhash || memcmp(hash_location, newhash, 16) != 0) {
1468+
*reason = SKB_DROP_REASON_TCP_MD5FAILURE;
14651469
NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPMD5FAILURE);
14661470
net_info_ratelimited("MD5 Hash failed for (%pI4, %d)->(%pI4, %d)%s L3 index %d\n",
14671471
&iph->saddr, ntohs(th->source),
@@ -1704,6 +1708,7 @@ INDIRECT_CALLABLE_DECLARE(struct dst_entry *ipv4_dst_check(struct dst_entry *,
17041708
*/
17051709
int tcp_v4_do_rcv(struct sock *sk, struct sk_buff *skb)
17061710
{
1711+
enum skb_drop_reason reason;
17071712
struct sock *rsk;
17081713

17091714
if (sk->sk_state == TCP_ESTABLISHED) { /* Fast path */
@@ -1726,6 +1731,7 @@ int tcp_v4_do_rcv(struct sock *sk, struct sk_buff *skb)
17261731
return 0;
17271732
}
17281733

1734+
reason = SKB_DROP_REASON_NOT_SPECIFIED;
17291735
if (tcp_checksum_complete(skb))
17301736
goto csum_err;
17311737

@@ -1753,7 +1759,7 @@ int tcp_v4_do_rcv(struct sock *sk, struct sk_buff *skb)
17531759
reset:
17541760
tcp_v4_send_reset(rsk, skb);
17551761
discard:
1756-
kfree_skb(skb);
1762+
kfree_skb_reason(skb, reason);
17571763
/* Be careful here. If this function gets more complicated and
17581764
* gcc suffers from register pressure on the x86, sk (in %ebx)
17591765
* might be destroyed here. This current version compiles correctly,
@@ -1762,6 +1768,7 @@ int tcp_v4_do_rcv(struct sock *sk, struct sk_buff *skb)
17621768
return 0;
17631769

17641770
csum_err:
1771+
reason = SKB_DROP_REASON_TCP_CSUM;
17651772
trace_tcp_bad_csum(skb);
17661773
TCP_INC_STATS(sock_net(sk), TCP_MIB_CSUMERRORS);
17671774
TCP_INC_STATS(sock_net(sk), TCP_MIB_INERRS);
@@ -1807,7 +1814,8 @@ int tcp_v4_early_demux(struct sk_buff *skb)
18071814
return 0;
18081815
}
18091816

1810-
bool tcp_add_backlog(struct sock *sk, struct sk_buff *skb)
1817+
bool tcp_add_backlog(struct sock *sk, struct sk_buff *skb,
1818+
enum skb_drop_reason *reason)
18111819
{
18121820
u32 limit, tail_gso_size, tail_gso_segs;
18131821
struct skb_shared_info *shinfo;
@@ -1833,6 +1841,7 @@ bool tcp_add_backlog(struct sock *sk, struct sk_buff *skb)
18331841
if (unlikely(tcp_checksum_complete(skb))) {
18341842
bh_unlock_sock(sk);
18351843
trace_tcp_bad_csum(skb);
1844+
*reason = SKB_DROP_REASON_TCP_CSUM;
18361845
__TCP_INC_STATS(sock_net(sk), TCP_MIB_CSUMERRORS);
18371846
__TCP_INC_STATS(sock_net(sk), TCP_MIB_INERRS);
18381847
return true;
@@ -1921,6 +1930,7 @@ bool tcp_add_backlog(struct sock *sk, struct sk_buff *skb)
19211930

19221931
if (unlikely(sk_add_backlog(sk, skb, limit))) {
19231932
bh_unlock_sock(sk);
1933+
*reason = SKB_DROP_REASON_SOCKET_BACKLOG;
19241934
__NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPBACKLOGDROP);
19251935
return true;
19261936
}
@@ -1971,13 +1981,13 @@ static void tcp_v4_fill_cb(struct sk_buff *skb, const struct iphdr *iph,
19711981
int tcp_v4_rcv(struct sk_buff *skb)
19721982
{
19731983
struct net *net = dev_net(skb->dev);
1984+
enum skb_drop_reason drop_reason;
19741985
int sdif = inet_sdif(skb);
19751986
int dif = inet_iif(skb);
19761987
const struct iphdr *iph;
19771988
const struct tcphdr *th;
19781989
bool refcounted;
19791990
struct sock *sk;
1980-
int drop_reason;
19811991
int ret;
19821992

19831993
drop_reason = SKB_DROP_REASON_NOT_SPECIFIED;
@@ -2025,7 +2035,8 @@ int tcp_v4_rcv(struct sk_buff *skb)
20252035
struct sock *nsk;
20262036

20272037
sk = req->rsk_listener;
2028-
if (unlikely(tcp_v4_inbound_md5_hash(sk, skb, dif, sdif))) {
2038+
if (unlikely(tcp_v4_inbound_md5_hash(sk, skb, dif, sdif,
2039+
&drop_reason))) {
20292040
sk_drops_add(sk, skb);
20302041
reqsk_put(req);
20312042
goto discard_it;
@@ -2057,6 +2068,8 @@ int tcp_v4_rcv(struct sk_buff *skb)
20572068
iph = ip_hdr(skb);
20582069
tcp_v4_fill_cb(skb, iph, th);
20592070
nsk = tcp_check_req(sk, skb, req, false, &req_stolen);
2071+
} else {
2072+
drop_reason = SKB_DROP_REASON_SOCKET_FILTER;
20602073
}
20612074
if (!nsk) {
20622075
reqsk_put(req);
@@ -2092,10 +2105,12 @@ int tcp_v4_rcv(struct sk_buff *skb)
20922105
}
20932106
}
20942107

2095-
if (!xfrm4_policy_check(sk, XFRM_POLICY_IN, skb))
2108+
if (!xfrm4_policy_check(sk, XFRM_POLICY_IN, skb)) {
2109+
drop_reason = SKB_DROP_REASON_XFRM_POLICY;
20962110
goto discard_and_relse;
2111+
}
20972112

2098-
if (tcp_v4_inbound_md5_hash(sk, skb, dif, sdif))
2113+
if (tcp_v4_inbound_md5_hash(sk, skb, dif, sdif, &drop_reason))
20992114
goto discard_and_relse;
21002115

21012116
nf_reset_ct(skb);
@@ -2124,7 +2139,7 @@ int tcp_v4_rcv(struct sk_buff *skb)
21242139
if (!sock_owned_by_user(sk)) {
21252140
ret = tcp_v4_do_rcv(sk, skb);
21262141
} else {
2127-
if (tcp_add_backlog(sk, skb))
2142+
if (tcp_add_backlog(sk, skb, &drop_reason))
21282143
goto discard_and_relse;
21292144
}
21302145
bh_unlock_sock(sk);
@@ -2166,6 +2181,7 @@ int tcp_v4_rcv(struct sk_buff *skb)
21662181

21672182
do_time_wait:
21682183
if (!xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb)) {
2184+
drop_reason = SKB_DROP_REASON_XFRM_POLICY;
21692185
inet_twsk_put(inet_twsk(sk));
21702186
goto discard_it;
21712187
}

0 commit comments

Comments
 (0)