summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2007-04-26 05:04:18 +0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-04-26 09:25:31 +0400
commit9c70220b73908f64792422a2c39c593c4792f2c5 (patch)
tree2090ea10aaa2714a5e095bae8cc02e743c378a3a /include/linux
parenta27ef749e7be3b06fb58df53d94eb97a21f18707 (diff)
downloadlinux-9c70220b73908f64792422a2c39c593c4792f2c5.tar.xz
[SK_BUFF]: Introduce skb_transport_header(skb)
For the places where we need a pointer to the transport header, it is still legal to touch skb->h.raw directly if just adding to, subtracting from or setting it to another layer header. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/atalk.h4
-rw-r--r--include/linux/dccp.h19
-rw-r--r--include/linux/icmp.h2
-rw-r--r--include/linux/icmpv6.h2
-rw-r--r--include/linux/igmp.h6
-rw-r--r--include/linux/ip.h2
-rw-r--r--include/linux/ipv6.h2
-rw-r--r--include/linux/sctp.h2
-rw-r--r--include/linux/skbuff.h5
-rw-r--r--include/linux/tcp.h2
-rw-r--r--include/linux/udp.h2
11 files changed, 29 insertions, 19 deletions
diff --git a/include/linux/atalk.h b/include/linux/atalk.h
index d12984ddaa9f..ced8a1ed080c 100644
--- a/include/linux/atalk.h
+++ b/include/linux/atalk.h
@@ -101,7 +101,7 @@ struct ddpehdr {
static __inline__ struct ddpehdr *ddp_hdr(struct sk_buff *skb)
{
- return (struct ddpehdr *)skb->h.raw;
+ return (struct ddpehdr *)skb_transport_header(skb);
}
/* AppleTalk AARP headers */
@@ -129,7 +129,7 @@ struct elapaarp {
static __inline__ struct elapaarp *aarp_hdr(struct sk_buff *skb)
{
- return (struct elapaarp *)skb->h.raw;
+ return (struct elapaarp *)skb_transport_header(skb);
}
/* Not specified - how long till we drop a resolved entry */
diff --git a/include/linux/dccp.h b/include/linux/dccp.h
index 1f4df61735f7..fdd4217f1047 100644
--- a/include/linux/dccp.h
+++ b/include/linux/dccp.h
@@ -260,19 +260,20 @@ enum {
static inline struct dccp_hdr *dccp_hdr(const struct sk_buff *skb)
{
- return (struct dccp_hdr *)skb->h.raw;
+ return (struct dccp_hdr *)skb_transport_header(skb);
}
static inline struct dccp_hdr *dccp_zeroed_hdr(struct sk_buff *skb, int headlen)
{
skb_push(skb, headlen);
skb_reset_transport_header(skb);
- return memset(skb->h.raw, 0, headlen);
+ return memset(skb_transport_header(skb), 0, headlen);
}
static inline struct dccp_hdr_ext *dccp_hdrx(const struct sk_buff *skb)
{
- return (struct dccp_hdr_ext *)(skb->h.raw + sizeof(struct dccp_hdr));
+ return (struct dccp_hdr_ext *)(skb_transport_header(skb) +
+ sizeof(struct dccp_hdr));
}
static inline unsigned int __dccp_basic_hdr_len(const struct dccp_hdr *dh)
@@ -301,12 +302,14 @@ static inline __u64 dccp_hdr_seq(const struct sk_buff *skb)
static inline struct dccp_hdr_request *dccp_hdr_request(struct sk_buff *skb)
{
- return (struct dccp_hdr_request *)(skb->h.raw + dccp_basic_hdr_len(skb));
+ return (struct dccp_hdr_request *)(skb_transport_header(skb) +
+ dccp_basic_hdr_len(skb));
}
static inline struct dccp_hdr_ack_bits *dccp_hdr_ack_bits(const struct sk_buff *skb)
{
- return (struct dccp_hdr_ack_bits *)(skb->h.raw + dccp_basic_hdr_len(skb));
+ return (struct dccp_hdr_ack_bits *)(skb_transport_header(skb) +
+ dccp_basic_hdr_len(skb));
}
static inline u64 dccp_hdr_ack_seq(const struct sk_buff *skb)
@@ -317,12 +320,14 @@ static inline u64 dccp_hdr_ack_seq(const struct sk_buff *skb)
static inline struct dccp_hdr_response *dccp_hdr_response(struct sk_buff *skb)
{
- return (struct dccp_hdr_response *)(skb->h.raw + dccp_basic_hdr_len(skb));
+ return (struct dccp_hdr_response *)(skb_transport_header(skb) +
+ dccp_basic_hdr_len(skb));
}
static inline struct dccp_hdr_reset *dccp_hdr_reset(struct sk_buff *skb)
{
- return (struct dccp_hdr_reset *)(skb->h.raw + dccp_basic_hdr_len(skb));
+ return (struct dccp_hdr_reset *)(skb_transport_header(skb) +
+ dccp_basic_hdr_len(skb));
}
static inline unsigned int __dccp_hdr_len(const struct dccp_hdr *dh)
diff --git a/include/linux/icmp.h b/include/linux/icmp.h
index cd3017a15789..474f2a51cf0a 100644
--- a/include/linux/icmp.h
+++ b/include/linux/icmp.h
@@ -87,7 +87,7 @@ struct icmphdr {
static inline struct icmphdr *icmp_hdr(const struct sk_buff *skb)
{
- return (struct icmphdr *)skb->h.raw;
+ return (struct icmphdr *)skb_transport_header(skb);
}
#endif
diff --git a/include/linux/icmpv6.h b/include/linux/icmpv6.h
index 0b5ba5eb7ed2..7c5e9817e998 100644
--- a/include/linux/icmpv6.h
+++ b/include/linux/icmpv6.h
@@ -80,7 +80,7 @@ struct icmp6hdr {
static inline struct icmp6hdr *icmp6_hdr(const struct sk_buff *skb)
{
- return (struct icmp6hdr *)skb->h.raw;
+ return (struct icmp6hdr *)skb_transport_header(skb);
}
#endif
diff --git a/include/linux/igmp.h b/include/linux/igmp.h
index ca285527b879..f510e7e382a8 100644
--- a/include/linux/igmp.h
+++ b/include/linux/igmp.h
@@ -85,19 +85,19 @@ struct igmpv3_query {
static inline struct igmphdr *igmp_hdr(const struct sk_buff *skb)
{
- return (struct igmphdr *)skb->h.raw;
+ return (struct igmphdr *)skb_transport_header(skb);
}
static inline struct igmpv3_report *
igmpv3_report_hdr(const struct sk_buff *skb)
{
- return (struct igmpv3_report *)skb->h.raw;
+ return (struct igmpv3_report *)skb_transport_header(skb);
}
static inline struct igmpv3_query *
igmpv3_query_hdr(const struct sk_buff *skb)
{
- return (struct igmpv3_query *)skb->h.raw;
+ return (struct igmpv3_query *)skb_transport_header(skb);
}
#endif
diff --git a/include/linux/ip.h b/include/linux/ip.h
index 19578440b5fc..bd0a2a8631c6 100644
--- a/include/linux/ip.h
+++ b/include/linux/ip.h
@@ -114,7 +114,7 @@ static inline struct iphdr *ip_hdr(const struct sk_buff *skb)
static inline struct iphdr *ipip_hdr(const struct sk_buff *skb)
{
- return (struct iphdr *)skb->h.raw;
+ return (struct iphdr *)skb_transport_header(skb);
}
#endif
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index b768fcc0a4c4..09ea01a8a99c 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -230,7 +230,7 @@ static inline struct ipv6hdr *ipv6_hdr(const struct sk_buff *skb)
static inline struct ipv6hdr *ipipv6_hdr(const struct sk_buff *skb)
{
- return (struct ipv6hdr *)skb->h.raw;
+ return (struct ipv6hdr *)skb_transport_header(skb);
}
/*
diff --git a/include/linux/sctp.h b/include/linux/sctp.h
index d76767dfe59e..d70df61a029f 100644
--- a/include/linux/sctp.h
+++ b/include/linux/sctp.h
@@ -68,7 +68,7 @@ typedef struct sctphdr {
static inline struct sctphdr *sctp_hdr(const struct sk_buff *skb)
{
- return (struct sctphdr *)skb->h.raw;
+ return (struct sctphdr *)skb_transport_header(skb);
}
#endif
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index d3f186230ee2..39a6da243b24 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -951,6 +951,11 @@ static inline void skb_reserve(struct sk_buff *skb, int len)
skb->tail += len;
}
+static inline unsigned char *skb_transport_header(const struct sk_buff *skb)
+{
+ return skb->h.raw;
+}
+
static inline void skb_reset_transport_header(struct sk_buff *skb)
{
skb->h.raw = skb->data;
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 911d937fb4c1..c6b9f92e8289 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -180,7 +180,7 @@ struct tcp_md5sig {
static inline struct tcphdr *tcp_hdr(const struct sk_buff *skb)
{
- return (struct tcphdr *)skb->h.raw;
+ return (struct tcphdr *)skb_transport_header(skb);
}
static inline unsigned int tcp_hdrlen(const struct sk_buff *skb)
diff --git a/include/linux/udp.h b/include/linux/udp.h
index 1f58503af9a6..6de445c31a64 100644
--- a/include/linux/udp.h
+++ b/include/linux/udp.h
@@ -31,7 +31,7 @@ struct udphdr {
static inline struct udphdr *udp_hdr(const struct sk_buff *skb)
{
- return (struct udphdr *)skb->h.raw;
+ return (struct udphdr *)skb_transport_header(skb);
}
#endif