0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #ifndef _LINUX_IP_H
0014 #define _LINUX_IP_H
0015
0016 #include <linux/skbuff.h>
0017 #include <uapi/linux/ip.h>
0018
0019 static inline struct iphdr *ip_hdr(const struct sk_buff *skb)
0020 {
0021 return (struct iphdr *)skb_network_header(skb);
0022 }
0023
0024 static inline struct iphdr *inner_ip_hdr(const struct sk_buff *skb)
0025 {
0026 return (struct iphdr *)skb_inner_network_header(skb);
0027 }
0028
0029 static inline struct iphdr *ipip_hdr(const struct sk_buff *skb)
0030 {
0031 return (struct iphdr *)skb_transport_header(skb);
0032 }
0033
0034 static inline unsigned int ip_transport_len(const struct sk_buff *skb)
0035 {
0036 return ntohs(ip_hdr(skb)->tot_len) - skb_network_header_len(skb);
0037 }
0038 #endif