举个栗子
sk_buff 的成员
[0x80] __u8 ignore_df : 1;
[0x80] __u8 nf_trace : 1;
[0x80] __u8 ip_summed : 2;
[0x80] __u8 ooo_okay : 1;
[0x81] __u8 l4_hash : 1;
[0x81] __u8 sw_hash : 1;
[0x81] __u8 wifi_acked_valid : 1;
[0x81] __u8 wifi_acked : 1;
[0x81] __u8 no_fcs : 1;
[0x81] __u8 encapsulation : 1;
[0x81] __u8 encap_hdr_csum : 1;
[0x81] __u8 csum_valid : 1;
[0x82] __u8 __pkt_vlan_present_offset[0];
[0x82] __u8 vlan_present : 1;
[0x82] __u8 csum_complete_sw : 1;
判断csum_valid checksum是否有效
echo 'p:xx icmp_rcv csum_valid =+0x81(%di):b1@7/8' > kprobe_events
位宽 1 8bit ,便宜7位为csum_valid
| | | |||| | |
<idle>-0 [003] ..s. 30288.516996: xx: (icmp_rcv+0x0/0x390) csum_valid =1
<idle>-0 [003] .Ns. 30289.519752: xx: (icmp_rcv+0x0/0x390) csum_valid =1
<idle>-0 [003] ..s. 30290.524699: xx: (icmp_rcv+0x0/0x390) csum_valid =1
<idle>-0 [003] ..s. 30291.529767: xx: (icmp_rcv+0x0/0x390) csum_valid =1
参考
https://www.kernel.org/doc/html/latest/trace/kprobetrace.html