diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2007-04-25 21:04:18 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-04-26 01:25:31 -0400 |
commit | 9c70220b73908f64792422a2c39c593c4792f2c5 (patch) | |
tree | 2090ea10aaa2714a5e095bae8cc02e743c378a3a /net/ipv6/ndisc.c | |
parent | a27ef749e7be3b06fb58df53d94eb97a21f18707 (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 'net/ipv6/ndisc.c')
-rw-r--r-- | net/ipv6/ndisc.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c index 8b946f56287a..f9a85ab594db 100644 --- a/net/ipv6/ndisc.c +++ b/net/ipv6/ndisc.c | |||
@@ -760,7 +760,7 @@ static void ndisc_solicit(struct neighbour *neigh, struct sk_buff *skb) | |||
760 | 760 | ||
761 | static void ndisc_recv_ns(struct sk_buff *skb) | 761 | static void ndisc_recv_ns(struct sk_buff *skb) |
762 | { | 762 | { |
763 | struct nd_msg *msg = (struct nd_msg *)skb->h.raw; | 763 | struct nd_msg *msg = (struct nd_msg *)skb_transport_header(skb); |
764 | struct in6_addr *saddr = &ipv6_hdr(skb)->saddr; | 764 | struct in6_addr *saddr = &ipv6_hdr(skb)->saddr; |
765 | struct in6_addr *daddr = &ipv6_hdr(skb)->daddr; | 765 | struct in6_addr *daddr = &ipv6_hdr(skb)->daddr; |
766 | u8 *lladdr = NULL; | 766 | u8 *lladdr = NULL; |
@@ -938,7 +938,7 @@ out: | |||
938 | 938 | ||
939 | static void ndisc_recv_na(struct sk_buff *skb) | 939 | static void ndisc_recv_na(struct sk_buff *skb) |
940 | { | 940 | { |
941 | struct nd_msg *msg = (struct nd_msg *)skb->h.raw; | 941 | struct nd_msg *msg = (struct nd_msg *)skb_transport_header(skb); |
942 | struct in6_addr *saddr = &ipv6_hdr(skb)->saddr; | 942 | struct in6_addr *saddr = &ipv6_hdr(skb)->saddr; |
943 | struct in6_addr *daddr = &ipv6_hdr(skb)->daddr; | 943 | struct in6_addr *daddr = &ipv6_hdr(skb)->daddr; |
944 | u8 *lladdr = NULL; | 944 | u8 *lladdr = NULL; |
@@ -1040,7 +1040,7 @@ out: | |||
1040 | 1040 | ||
1041 | static void ndisc_recv_rs(struct sk_buff *skb) | 1041 | static void ndisc_recv_rs(struct sk_buff *skb) |
1042 | { | 1042 | { |
1043 | struct rs_msg *rs_msg = (struct rs_msg *) skb->h.raw; | 1043 | struct rs_msg *rs_msg = (struct rs_msg *)skb_transport_header(skb); |
1044 | unsigned long ndoptlen = skb->len - sizeof(*rs_msg); | 1044 | unsigned long ndoptlen = skb->len - sizeof(*rs_msg); |
1045 | struct neighbour *neigh; | 1045 | struct neighbour *neigh; |
1046 | struct inet6_dev *idev; | 1046 | struct inet6_dev *idev; |
@@ -1097,7 +1097,7 @@ out: | |||
1097 | 1097 | ||
1098 | static void ndisc_router_discovery(struct sk_buff *skb) | 1098 | static void ndisc_router_discovery(struct sk_buff *skb) |
1099 | { | 1099 | { |
1100 | struct ra_msg *ra_msg = (struct ra_msg *) skb->h.raw; | 1100 | struct ra_msg *ra_msg = (struct ra_msg *)skb_transport_header(skb); |
1101 | struct neighbour *neigh = NULL; | 1101 | struct neighbour *neigh = NULL; |
1102 | struct inet6_dev *in6_dev; | 1102 | struct inet6_dev *in6_dev; |
1103 | struct rt6_info *rt = NULL; | 1103 | struct rt6_info *rt = NULL; |
@@ -1108,7 +1108,8 @@ static void ndisc_router_discovery(struct sk_buff *skb) | |||
1108 | 1108 | ||
1109 | __u8 * opt = (__u8 *)(ra_msg + 1); | 1109 | __u8 * opt = (__u8 *)(ra_msg + 1); |
1110 | 1110 | ||
1111 | optlen = (skb->tail - skb->h.raw) - sizeof(struct ra_msg); | 1111 | optlen = (skb->tail - skb_transport_header(skb)) - |
1112 | sizeof(struct ra_msg); | ||
1112 | 1113 | ||
1113 | if (!(ipv6_addr_type(&ipv6_hdr(skb)->saddr) & IPV6_ADDR_LINKLOCAL)) { | 1114 | if (!(ipv6_addr_type(&ipv6_hdr(skb)->saddr) & IPV6_ADDR_LINKLOCAL)) { |
1114 | ND_PRINTK2(KERN_WARNING | 1115 | ND_PRINTK2(KERN_WARNING |
@@ -1357,7 +1358,7 @@ static void ndisc_redirect_rcv(struct sk_buff *skb) | |||
1357 | return; | 1358 | return; |
1358 | } | 1359 | } |
1359 | 1360 | ||
1360 | optlen = skb->tail - skb->h.raw; | 1361 | optlen = skb->tail - skb_transport_header(skb); |
1361 | optlen -= sizeof(struct icmp6hdr) + 2 * sizeof(struct in6_addr); | 1362 | optlen -= sizeof(struct icmp6hdr) + 2 * sizeof(struct in6_addr); |
1362 | 1363 | ||
1363 | if (optlen < 0) { | 1364 | if (optlen < 0) { |
@@ -1584,9 +1585,9 @@ int ndisc_rcv(struct sk_buff *skb) | |||
1584 | if (!pskb_may_pull(skb, skb->len)) | 1585 | if (!pskb_may_pull(skb, skb->len)) |
1585 | return 0; | 1586 | return 0; |
1586 | 1587 | ||
1587 | msg = (struct nd_msg *) skb->h.raw; | 1588 | msg = (struct nd_msg *)skb_transport_header(skb); |
1588 | 1589 | ||
1589 | __skb_push(skb, skb->data-skb->h.raw); | 1590 | __skb_push(skb, skb->data - skb_transport_header(skb)); |
1590 | 1591 | ||
1591 | if (ipv6_hdr(skb)->hop_limit != 255) { | 1592 | if (ipv6_hdr(skb)->hop_limit != 255) { |
1592 | ND_PRINTK2(KERN_WARNING | 1593 | ND_PRINTK2(KERN_WARNING |