Skip to content

Commit edd3f6f

Browse files
LPhghMartin KaFai Lau
authored andcommitted
tcp: Use skb__nullable in trace_tcp_send_reset
Replace skb with skb__nullable as the argument name. The suffix tells bpf verifier through btf that the arg could be NULL and should be checked in tp_btf prog. For now, this is the only nullable argument in tcp tracepoints. Signed-off-by: Philo Lu <[email protected]> Acked-by: Jakub Kicinski <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin KaFai Lau <[email protected]>
1 parent 2060f07 commit edd3f6f

File tree

1 file changed

+6
-6
lines changed
  • include/trace/events

1 file changed

+6
-6
lines changed

include/trace/events/tcp.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,10 @@ DEFINE_RST_REASON(FN, FN)
9191
TRACE_EVENT(tcp_send_reset,
9292

9393
TP_PROTO(const struct sock *sk,
94-
const struct sk_buff *skb,
94+
const struct sk_buff *skb__nullable,
9595
const enum sk_rst_reason reason),
9696

97-
TP_ARGS(sk, skb, reason),
97+
TP_ARGS(sk, skb__nullable, reason),
9898

9999
TP_STRUCT__entry(
100100
__field(const void *, skbaddr)
@@ -106,7 +106,7 @@ TRACE_EVENT(tcp_send_reset,
106106
),
107107

108108
TP_fast_assign(
109-
__entry->skbaddr = skb;
109+
__entry->skbaddr = skb__nullable;
110110
__entry->skaddr = sk;
111111
/* Zero means unknown state. */
112112
__entry->state = sk ? sk->sk_state : 0;
@@ -118,13 +118,13 @@ TRACE_EVENT(tcp_send_reset,
118118
const struct inet_sock *inet = inet_sk(sk);
119119

120120
TP_STORE_ADDR_PORTS(__entry, inet, sk);
121-
} else if (skb) {
122-
const struct tcphdr *th = (const struct tcphdr *)skb->data;
121+
} else if (skb__nullable) {
122+
const struct tcphdr *th = (const struct tcphdr *)skb__nullable->data;
123123
/*
124124
* We should reverse the 4-tuple of skb, so later
125125
* it can print the right flow direction of rst.
126126
*/
127-
TP_STORE_ADDR_PORTS_SKB(skb, th, entry->daddr, entry->saddr);
127+
TP_STORE_ADDR_PORTS_SKB(skb__nullable, th, entry->daddr, entry->saddr);
128128
}
129129
__entry->reason = reason;
130130
),

0 commit comments

Comments
 (0)