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/ipv4/ipmr.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/ipv4/ipmr.c')
-rw-r--r-- | net/ipv4/ipmr.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c index 05bc27002def..8f45c95db451 100644 --- a/net/ipv4/ipmr.c +++ b/net/ipv4/ipmr.c | |||
@@ -1437,7 +1437,8 @@ int pim_rcv_v1(struct sk_buff * skb) | |||
1437 | pim->group != PIM_V1_VERSION || pim->code != PIM_V1_REGISTER) | 1437 | pim->group != PIM_V1_VERSION || pim->code != PIM_V1_REGISTER) |
1438 | goto drop; | 1438 | goto drop; |
1439 | 1439 | ||
1440 | encap = (struct iphdr*)(skb->h.raw + sizeof(struct igmphdr)); | 1440 | encap = (struct iphdr *)(skb_transport_header(skb) + |
1441 | sizeof(struct igmphdr)); | ||
1441 | /* | 1442 | /* |
1442 | Check that: | 1443 | Check that: |
1443 | a. packet is really destinted to a multicast group | 1444 | a. packet is really destinted to a multicast group |
@@ -1490,7 +1491,7 @@ static int pim_rcv(struct sk_buff * skb) | |||
1490 | if (!pskb_may_pull(skb, sizeof(*pim) + sizeof(*encap))) | 1491 | if (!pskb_may_pull(skb, sizeof(*pim) + sizeof(*encap))) |
1491 | goto drop; | 1492 | goto drop; |
1492 | 1493 | ||
1493 | pim = (struct pimreghdr*)skb->h.raw; | 1494 | pim = (struct pimreghdr *)skb_transport_header(skb); |
1494 | if (pim->type != ((PIM_VERSION<<4)|(PIM_REGISTER)) || | 1495 | if (pim->type != ((PIM_VERSION<<4)|(PIM_REGISTER)) || |
1495 | (pim->flags&PIM_NULL_REGISTER) || | 1496 | (pim->flags&PIM_NULL_REGISTER) || |
1496 | (ip_compute_csum((void *)pim, sizeof(*pim)) != 0 && | 1497 | (ip_compute_csum((void *)pim, sizeof(*pim)) != 0 && |
@@ -1498,7 +1499,8 @@ static int pim_rcv(struct sk_buff * skb) | |||
1498 | goto drop; | 1499 | goto drop; |
1499 | 1500 | ||
1500 | /* check if the inner packet is destined to mcast group */ | 1501 | /* check if the inner packet is destined to mcast group */ |
1501 | encap = (struct iphdr*)(skb->h.raw + sizeof(struct pimreghdr)); | 1502 | encap = (struct iphdr *)(skb_transport_header(skb) + |
1503 | sizeof(struct pimreghdr)); | ||
1502 | if (!MULTICAST(encap->daddr) || | 1504 | if (!MULTICAST(encap->daddr) || |
1503 | encap->tot_len == 0 || | 1505 | encap->tot_len == 0 || |
1504 | ntohs(encap->tot_len) + sizeof(*pim) > skb->len) | 1506 | ntohs(encap->tot_len) + sizeof(*pim) > skb->len) |