aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2007-04-25 18:04:18 -0700
committerDavid S. Miller <davem@sunset.davemloft.net>2007-04-25 22:25:31 -0700
commit9c70220b73908f64792422a2c39c593c4792f2c5 (patch)
tree2090ea10aaa2714a5e095bae8cc02e743c378a3a /include
parenta27ef749e7be3b06fb58df53d94eb97a21f18707 (diff)
[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')
-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
-rw-r--r--include/net/ipx.h2
-rw-r--r--include/net/pkt_cls.h2
-rw-r--r--include/net/udp.h4
14 files changed, 33 insertions, 23 deletions
diff --git a/include/linux/atalk.h b/include/linux/atalk.h
index d12984ddaa9..ced8a1ed080 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 1f4df61735f..fdd4217f104 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 cd3017a1578..474f2a51cf0 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 0b5ba5eb7ed..7c5e9817e99 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 ca285527b87..f510e7e382a 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 19578440b5f..bd0a2a8631c 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 b768fcc0a4c..09ea01a8a99 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 d76767dfe59..d70df61a029 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 d3f186230ee..39a6da243b2 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 911d937fb4c..c6b9f92e828 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 1f58503af9a..6de445c31a6 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
diff --git a/include/net/ipx.h b/include/net/ipx.h
index c6b2ee61086..4cc0b4eca94 100644
--- a/include/net/ipx.h
+++ b/include/net/ipx.h
@@ -43,7 +43,7 @@ struct ipxhdr {
static __inline__ struct ipxhdr *ipx_hdr(struct sk_buff *skb)
{
- return (struct ipxhdr *)skb->h.raw;
+ return (struct ipxhdr *)skb_transport_header(skb);
}
struct ipx_interface {
diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h
index 880eb7b5416..dcb3a91f136 100644
--- a/include/net/pkt_cls.h
+++ b/include/net/pkt_cls.h
@@ -328,7 +328,7 @@ static inline unsigned char * tcf_get_base_ptr(struct sk_buff *skb, int layer)
case TCF_LAYER_NETWORK:
return skb_network_header(skb);
case TCF_LAYER_TRANSPORT:
- return skb->h.raw;
+ return skb_transport_header(skb);
}
return NULL;
diff --git a/include/net/udp.h b/include/net/udp.h
index 4a9699f7928..4906ed7113e 100644
--- a/include/net/udp.h
+++ b/include/net/udp.h
@@ -89,8 +89,8 @@ static inline int udp_lib_checksum_complete(struct sk_buff *skb)
*/
static inline __wsum udp_csum_outgoing(struct sock *sk, struct sk_buff *skb)
{
- __wsum csum = csum_partial(skb->h.raw, sizeof(struct udphdr), 0);
-
+ __wsum csum = csum_partial(skb_transport_header(skb),
+ sizeof(struct udphdr), 0);
skb_queue_walk(&sk->sk_write_queue, skb) {
csum = csum_add(csum, skb->csum);
}