Commit cc70ab26 authored by Arnaldo Carvalho de Melo's avatar Arnaldo Carvalho de Melo Committed by David S. Miller

[ICMP6]: Introduce icmp6_hdr()

For consistency with all the other skb->h.raw accessors.
Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 2c0fd387
......@@ -75,6 +75,15 @@ struct icmp6hdr {
#define icmp6_router_pref icmp6_dataun.u_nd_ra.router_pref
};
#ifdef __KERNEL__
#include <linux/skbuff.h>
static inline struct icmp6hdr *icmp6_hdr(const struct sk_buff *skb)
{
return (struct icmp6hdr *)skb->h.raw;
}
#endif
#define ICMPV6_ROUTER_PREF_LOW 0x3
#define ICMPV6_ROUTER_PREF_MEDIUM 0x0
#define ICMPV6_ROUTER_PREF_HIGH 0x1
......
......@@ -209,7 +209,7 @@ void ipv6_icmp_error(struct sock *sk, struct sk_buff *skb, int err,
__be16 port, u32 info, u8 *payload)
{
struct ipv6_pinfo *np = inet6_sk(sk);
struct icmp6hdr *icmph = (struct icmp6hdr *)skb->h.raw;
struct icmp6hdr *icmph = icmp6_hdr(skb);
struct sock_exterr_skb *serr;
if (!np->recverr)
......
......@@ -222,7 +222,7 @@ static int icmpv6_push_pending_frames(struct sock *sk, struct flowi *fl, struct
if ((skb = skb_peek(&sk->sk_write_queue)) == NULL)
goto out;
icmp6h = (struct icmp6hdr*) skb->h.raw;
icmp6h = icmp6_hdr(skb);
memcpy(icmp6h, thdr, sizeof(struct icmp6hdr));
icmp6h->icmp6_cksum = 0;
......@@ -476,7 +476,7 @@ static void icmpv6_echo_reply(struct sk_buff *skb)
struct inet6_dev *idev;
struct ipv6_pinfo *np;
struct in6_addr *saddr = NULL;
struct icmp6hdr *icmph = (struct icmp6hdr *) skb->h.raw;
struct icmp6hdr *icmph = icmp6_hdr(skb);
struct icmp6hdr tmp_hdr;
struct flowi fl;
struct icmpv6_msg msg;
......@@ -651,7 +651,7 @@ static int icmpv6_rcv(struct sk_buff **pskb)
if (!pskb_pull(skb, sizeof(struct icmp6hdr)))
goto discard_it;
hdr = (struct icmp6hdr *) skb->h.raw;
hdr = icmp6_hdr(skb);
type = hdr->icmp6_type;
......@@ -677,7 +677,7 @@ static int icmpv6_rcv(struct sk_buff **pskb)
*/
if (!pskb_may_pull(skb, sizeof(struct ipv6hdr)))
goto discard_it;
hdr = (struct icmp6hdr *) skb->h.raw;
hdr = icmp6_hdr(skb);
orig_hdr = (struct ipv6hdr *) (hdr + 1);
rt6_pmtu_discovery(&orig_hdr->daddr, &orig_hdr->saddr, dev,
ntohl(hdr->icmp6_mtu));
......
......@@ -988,7 +988,7 @@ int ipv6_is_mld(struct sk_buff *skb, int nexthdr)
if (!pskb_may_pull(skb, sizeof(struct icmp6hdr)))
return 0;
pic = (struct icmp6hdr *)skb->h.raw;
pic = icmp6_hdr(skb);
switch (pic->icmp6_type) {
case ICMPV6_MGM_QUERY:
......@@ -1179,7 +1179,7 @@ int igmp6_event_query(struct sk_buff *skb)
if (idev == NULL)
return 0;
hdr = (struct icmp6hdr *) skb->h.raw;
hdr = icmp6_hdr(skb);
group = (struct in6_addr *) (hdr + 1);
group_type = ipv6_addr_type(group);
......@@ -1300,7 +1300,7 @@ int igmp6_event_report(struct sk_buff *skb)
if (!pskb_may_pull(skb, sizeof(struct in6_addr)))
return -EINVAL;
hdr = (struct icmp6hdr*) skb->h.raw;
hdr = icmp6_hdr(skb);
/* Drop reports with not link local source */
addr_type = ipv6_addr_type(&ipv6_hdr(skb)->saddr);
......
......@@ -1366,7 +1366,7 @@ static void ndisc_redirect_rcv(struct sk_buff *skb)
return;
}
icmph = (struct icmp6hdr *) skb->h.raw;
icmph = icmp6_hdr(skb);
target = (struct in6_addr *) (icmph + 1);
dest = target + 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment