Skip to content

Commit

Permalink
tcp: Use skb__nullable in trace_tcp_send_reset
Browse files Browse the repository at this point in the history
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 <lulie@linux.alibaba.com>
  • Loading branch information
Philo Lu authored and intel-lab-lkp committed Sep 5, 2024
1 parent 0742f10 commit 14f7ee8
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions include/trace/events/tcp.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,10 @@ DEFINE_RST_REASON(FN, FN)
TRACE_EVENT(tcp_send_reset,

TP_PROTO(const struct sock *sk,
const struct sk_buff *skb,
const struct sk_buff *skb__nullable,
const enum sk_rst_reason reason),

TP_ARGS(sk, skb, reason),
TP_ARGS(sk, skb__nullable, reason),

TP_STRUCT__entry(
__field(const void *, skbaddr)
Expand All @@ -106,7 +106,7 @@ TRACE_EVENT(tcp_send_reset,
),

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

TP_STORE_ADDR_PORTS(__entry, inet, sk);
} else if (skb) {
const struct tcphdr *th = (const struct tcphdr *)skb->data;
} else if (skb__nullable) {
const struct tcphdr *th = (const struct tcphdr *)skb__nullable->data;
/*
* We should reverse the 4-tuple of skb, so later
* it can print the right flow direction of rst.
*/
TP_STORE_ADDR_PORTS_SKB(skb, th, entry->daddr, entry->saddr);
TP_STORE_ADDR_PORTS_SKB(skb__nullable, th, entry->daddr, entry->saddr);
}
__entry->reason = reason;
),
Expand Down

0 comments on commit 14f7ee8

Please sign in to comment.