diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2007-03-13 13:03:22 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-04-26 01:25:20 -0400 |
commit | cc70ab261c9f997589546100ddec5da6bfd89c4e (patch) | |
tree | 0be6a4f0dc81131747f3d3726dba77d922c6bee9 | |
parent | 2c0fd387b00a6758550b5ca1aae4408374483fe7 (diff) |
[ICMP6]: Introduce icmp6_hdr()
For consistency with all the other skb->h.raw accessors.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/linux/icmpv6.h | 9 | ||||
-rw-r--r-- | net/ipv6/datagram.c | 2 | ||||
-rw-r--r-- | net/ipv6/icmp.c | 8 | ||||
-rw-r--r-- | net/ipv6/mcast.c | 6 | ||||
-rw-r--r-- | net/ipv6/ndisc.c | 2 |
5 files changed, 18 insertions, 9 deletions
diff --git a/include/linux/icmpv6.h b/include/linux/icmpv6.h index 68d3526c3a05..0b5ba5eb7ed2 100644 --- a/include/linux/icmpv6.h +++ b/include/linux/icmpv6.h | |||
@@ -75,6 +75,15 @@ struct icmp6hdr { | |||
75 | #define icmp6_router_pref icmp6_dataun.u_nd_ra.router_pref | 75 | #define icmp6_router_pref icmp6_dataun.u_nd_ra.router_pref |
76 | }; | 76 | }; |
77 | 77 | ||
78 | #ifdef __KERNEL__ | ||
79 | #include <linux/skbuff.h> | ||
80 | |||
81 | static inline struct icmp6hdr *icmp6_hdr(const struct sk_buff *skb) | ||
82 | { | ||
83 | return (struct icmp6hdr *)skb->h.raw; | ||
84 | } | ||
85 | #endif | ||
86 | |||
78 | #define ICMPV6_ROUTER_PREF_LOW 0x3 | 87 | #define ICMPV6_ROUTER_PREF_LOW 0x3 |
79 | #define ICMPV6_ROUTER_PREF_MEDIUM 0x0 | 88 | #define ICMPV6_ROUTER_PREF_MEDIUM 0x0 |
80 | #define ICMPV6_ROUTER_PREF_HIGH 0x1 | 89 | #define ICMPV6_ROUTER_PREF_HIGH 0x1 |
diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c index f429290c2c37..feba6b197fe9 100644 --- a/net/ipv6/datagram.c +++ b/net/ipv6/datagram.c | |||
@@ -209,7 +209,7 @@ void ipv6_icmp_error(struct sock *sk, struct sk_buff *skb, int err, | |||
209 | __be16 port, u32 info, u8 *payload) | 209 | __be16 port, u32 info, u8 *payload) |
210 | { | 210 | { |
211 | struct ipv6_pinfo *np = inet6_sk(sk); | 211 | struct ipv6_pinfo *np = inet6_sk(sk); |
212 | struct icmp6hdr *icmph = (struct icmp6hdr *)skb->h.raw; | 212 | struct icmp6hdr *icmph = icmp6_hdr(skb); |
213 | struct sock_exterr_skb *serr; | 213 | struct sock_exterr_skb *serr; |
214 | 214 | ||
215 | if (!np->recverr) | 215 | if (!np->recverr) |
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c index 3a01effda695..d3edc3cf1ce9 100644 --- a/net/ipv6/icmp.c +++ b/net/ipv6/icmp.c | |||
@@ -222,7 +222,7 @@ static int icmpv6_push_pending_frames(struct sock *sk, struct flowi *fl, struct | |||
222 | if ((skb = skb_peek(&sk->sk_write_queue)) == NULL) | 222 | if ((skb = skb_peek(&sk->sk_write_queue)) == NULL) |
223 | goto out; | 223 | goto out; |
224 | 224 | ||
225 | icmp6h = (struct icmp6hdr*) skb->h.raw; | 225 | icmp6h = icmp6_hdr(skb); |
226 | memcpy(icmp6h, thdr, sizeof(struct icmp6hdr)); | 226 | memcpy(icmp6h, thdr, sizeof(struct icmp6hdr)); |
227 | icmp6h->icmp6_cksum = 0; | 227 | icmp6h->icmp6_cksum = 0; |
228 | 228 | ||
@@ -476,7 +476,7 @@ static void icmpv6_echo_reply(struct sk_buff *skb) | |||
476 | struct inet6_dev *idev; | 476 | struct inet6_dev *idev; |
477 | struct ipv6_pinfo *np; | 477 | struct ipv6_pinfo *np; |
478 | struct in6_addr *saddr = NULL; | 478 | struct in6_addr *saddr = NULL; |
479 | struct icmp6hdr *icmph = (struct icmp6hdr *) skb->h.raw; | 479 | struct icmp6hdr *icmph = icmp6_hdr(skb); |
480 | struct icmp6hdr tmp_hdr; | 480 | struct icmp6hdr tmp_hdr; |
481 | struct flowi fl; | 481 | struct flowi fl; |
482 | struct icmpv6_msg msg; | 482 | struct icmpv6_msg msg; |
@@ -651,7 +651,7 @@ static int icmpv6_rcv(struct sk_buff **pskb) | |||
651 | if (!pskb_pull(skb, sizeof(struct icmp6hdr))) | 651 | if (!pskb_pull(skb, sizeof(struct icmp6hdr))) |
652 | goto discard_it; | 652 | goto discard_it; |
653 | 653 | ||
654 | hdr = (struct icmp6hdr *) skb->h.raw; | 654 | hdr = icmp6_hdr(skb); |
655 | 655 | ||
656 | type = hdr->icmp6_type; | 656 | type = hdr->icmp6_type; |
657 | 657 | ||
@@ -677,7 +677,7 @@ static int icmpv6_rcv(struct sk_buff **pskb) | |||
677 | */ | 677 | */ |
678 | if (!pskb_may_pull(skb, sizeof(struct ipv6hdr))) | 678 | if (!pskb_may_pull(skb, sizeof(struct ipv6hdr))) |
679 | goto discard_it; | 679 | goto discard_it; |
680 | hdr = (struct icmp6hdr *) skb->h.raw; | 680 | hdr = icmp6_hdr(skb); |
681 | orig_hdr = (struct ipv6hdr *) (hdr + 1); | 681 | orig_hdr = (struct ipv6hdr *) (hdr + 1); |
682 | rt6_pmtu_discovery(&orig_hdr->daddr, &orig_hdr->saddr, dev, | 682 | rt6_pmtu_discovery(&orig_hdr->daddr, &orig_hdr->saddr, dev, |
683 | ntohl(hdr->icmp6_mtu)); | 683 | ntohl(hdr->icmp6_mtu)); |
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c index b2b37ba48b9c..1f2a3be9308a 100644 --- a/net/ipv6/mcast.c +++ b/net/ipv6/mcast.c | |||
@@ -988,7 +988,7 @@ int ipv6_is_mld(struct sk_buff *skb, int nexthdr) | |||
988 | if (!pskb_may_pull(skb, sizeof(struct icmp6hdr))) | 988 | if (!pskb_may_pull(skb, sizeof(struct icmp6hdr))) |
989 | return 0; | 989 | return 0; |
990 | 990 | ||
991 | pic = (struct icmp6hdr *)skb->h.raw; | 991 | pic = icmp6_hdr(skb); |
992 | 992 | ||
993 | switch (pic->icmp6_type) { | 993 | switch (pic->icmp6_type) { |
994 | case ICMPV6_MGM_QUERY: | 994 | case ICMPV6_MGM_QUERY: |
@@ -1179,7 +1179,7 @@ int igmp6_event_query(struct sk_buff *skb) | |||
1179 | if (idev == NULL) | 1179 | if (idev == NULL) |
1180 | return 0; | 1180 | return 0; |
1181 | 1181 | ||
1182 | hdr = (struct icmp6hdr *) skb->h.raw; | 1182 | hdr = icmp6_hdr(skb); |
1183 | group = (struct in6_addr *) (hdr + 1); | 1183 | group = (struct in6_addr *) (hdr + 1); |
1184 | group_type = ipv6_addr_type(group); | 1184 | group_type = ipv6_addr_type(group); |
1185 | 1185 | ||
@@ -1300,7 +1300,7 @@ int igmp6_event_report(struct sk_buff *skb) | |||
1300 | if (!pskb_may_pull(skb, sizeof(struct in6_addr))) | 1300 | if (!pskb_may_pull(skb, sizeof(struct in6_addr))) |
1301 | return -EINVAL; | 1301 | return -EINVAL; |
1302 | 1302 | ||
1303 | hdr = (struct icmp6hdr*) skb->h.raw; | 1303 | hdr = icmp6_hdr(skb); |
1304 | 1304 | ||
1305 | /* Drop reports with not link local source */ | 1305 | /* Drop reports with not link local source */ |
1306 | addr_type = ipv6_addr_type(&ipv6_hdr(skb)->saddr); | 1306 | addr_type = ipv6_addr_type(&ipv6_hdr(skb)->saddr); |
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c index 00feb4c4d98b..8b946f56287a 100644 --- a/net/ipv6/ndisc.c +++ b/net/ipv6/ndisc.c | |||
@@ -1366,7 +1366,7 @@ static void ndisc_redirect_rcv(struct sk_buff *skb) | |||
1366 | return; | 1366 | return; |
1367 | } | 1367 | } |
1368 | 1368 | ||
1369 | icmph = (struct icmp6hdr *) skb->h.raw; | 1369 | icmph = icmp6_hdr(skb); |
1370 | target = (struct in6_addr *) (icmph + 1); | 1370 | target = (struct in6_addr *) (icmph + 1); |
1371 | dest = target + 1; | 1371 | dest = target + 1; |
1372 | 1372 | ||