mirror of
https://github.com/adulau/aha.git
synced 2024-12-29 04:06:22 +00:00
[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>
This commit is contained in:
parent
2c0fd387b0
commit
cc70ab261c
5 changed files with 18 additions and 9 deletions
|
@ -75,6 +75,15 @@ struct icmp6hdr {
|
||||||
#define icmp6_router_pref icmp6_dataun.u_nd_ra.router_pref
|
#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_LOW 0x3
|
||||||
#define ICMPV6_ROUTER_PREF_MEDIUM 0x0
|
#define ICMPV6_ROUTER_PREF_MEDIUM 0x0
|
||||||
#define ICMPV6_ROUTER_PREF_HIGH 0x1
|
#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)
|
__be16 port, u32 info, u8 *payload)
|
||||||
{
|
{
|
||||||
struct ipv6_pinfo *np = inet6_sk(sk);
|
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;
|
struct sock_exterr_skb *serr;
|
||||||
|
|
||||||
if (!np->recverr)
|
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)
|
if ((skb = skb_peek(&sk->sk_write_queue)) == NULL)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
icmp6h = (struct icmp6hdr*) skb->h.raw;
|
icmp6h = icmp6_hdr(skb);
|
||||||
memcpy(icmp6h, thdr, sizeof(struct icmp6hdr));
|
memcpy(icmp6h, thdr, sizeof(struct icmp6hdr));
|
||||||
icmp6h->icmp6_cksum = 0;
|
icmp6h->icmp6_cksum = 0;
|
||||||
|
|
||||||
|
@ -476,7 +476,7 @@ static void icmpv6_echo_reply(struct sk_buff *skb)
|
||||||
struct inet6_dev *idev;
|
struct inet6_dev *idev;
|
||||||
struct ipv6_pinfo *np;
|
struct ipv6_pinfo *np;
|
||||||
struct in6_addr *saddr = NULL;
|
struct in6_addr *saddr = NULL;
|
||||||
struct icmp6hdr *icmph = (struct icmp6hdr *) skb->h.raw;
|
struct icmp6hdr *icmph = icmp6_hdr(skb);
|
||||||
struct icmp6hdr tmp_hdr;
|
struct icmp6hdr tmp_hdr;
|
||||||
struct flowi fl;
|
struct flowi fl;
|
||||||
struct icmpv6_msg msg;
|
struct icmpv6_msg msg;
|
||||||
|
@ -651,7 +651,7 @@ static int icmpv6_rcv(struct sk_buff **pskb)
|
||||||
if (!pskb_pull(skb, sizeof(struct icmp6hdr)))
|
if (!pskb_pull(skb, sizeof(struct icmp6hdr)))
|
||||||
goto discard_it;
|
goto discard_it;
|
||||||
|
|
||||||
hdr = (struct icmp6hdr *) skb->h.raw;
|
hdr = icmp6_hdr(skb);
|
||||||
|
|
||||||
type = hdr->icmp6_type;
|
type = hdr->icmp6_type;
|
||||||
|
|
||||||
|
@ -677,7 +677,7 @@ static int icmpv6_rcv(struct sk_buff **pskb)
|
||||||
*/
|
*/
|
||||||
if (!pskb_may_pull(skb, sizeof(struct ipv6hdr)))
|
if (!pskb_may_pull(skb, sizeof(struct ipv6hdr)))
|
||||||
goto discard_it;
|
goto discard_it;
|
||||||
hdr = (struct icmp6hdr *) skb->h.raw;
|
hdr = icmp6_hdr(skb);
|
||||||
orig_hdr = (struct ipv6hdr *) (hdr + 1);
|
orig_hdr = (struct ipv6hdr *) (hdr + 1);
|
||||||
rt6_pmtu_discovery(&orig_hdr->daddr, &orig_hdr->saddr, dev,
|
rt6_pmtu_discovery(&orig_hdr->daddr, &orig_hdr->saddr, dev,
|
||||||
ntohl(hdr->icmp6_mtu));
|
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)))
|
if (!pskb_may_pull(skb, sizeof(struct icmp6hdr)))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
pic = (struct icmp6hdr *)skb->h.raw;
|
pic = icmp6_hdr(skb);
|
||||||
|
|
||||||
switch (pic->icmp6_type) {
|
switch (pic->icmp6_type) {
|
||||||
case ICMPV6_MGM_QUERY:
|
case ICMPV6_MGM_QUERY:
|
||||||
|
@ -1179,7 +1179,7 @@ int igmp6_event_query(struct sk_buff *skb)
|
||||||
if (idev == NULL)
|
if (idev == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
hdr = (struct icmp6hdr *) skb->h.raw;
|
hdr = icmp6_hdr(skb);
|
||||||
group = (struct in6_addr *) (hdr + 1);
|
group = (struct in6_addr *) (hdr + 1);
|
||||||
group_type = ipv6_addr_type(group);
|
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)))
|
if (!pskb_may_pull(skb, sizeof(struct in6_addr)))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
hdr = (struct icmp6hdr*) skb->h.raw;
|
hdr = icmp6_hdr(skb);
|
||||||
|
|
||||||
/* Drop reports with not link local source */
|
/* Drop reports with not link local source */
|
||||||
addr_type = ipv6_addr_type(&ipv6_hdr(skb)->saddr);
|
addr_type = ipv6_addr_type(&ipv6_hdr(skb)->saddr);
|
||||||
|
|
|
@ -1366,7 +1366,7 @@ static void ndisc_redirect_rcv(struct sk_buff *skb)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
icmph = (struct icmp6hdr *) skb->h.raw;
|
icmph = icmp6_hdr(skb);
|
||||||
target = (struct in6_addr *) (icmph + 1);
|
target = (struct in6_addr *) (icmph + 1);
|
||||||
dest = target + 1;
|
dest = target + 1;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue