问题 I'm trying to implement a netfilter module, while processing sk_buff I found two possible ways to retrieve TCP header: struct iphdr *ip_header = (struct iphdr *)skb_network_header(skb); struct tcphdr *tcp_header = (struct tcphdr *)skb_transport_header(skb); And struct iphdr *ip_header = skb_header_pointer(skb, 0, sizeof(struct iphdr), &_iph) struct tcphdr *tcp_header = skb_header_pointer(skb, ip_header->ihl * 4, sizeof(struct tcphdr), &_tcph); Which one should I use? 回答1: You should use ip