[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>
This commit is contained in:

committed by
David S. Miller

parent
a27ef749e7
commit
9c70220b73
@@ -1437,7 +1437,8 @@ int pim_rcv_v1(struct sk_buff * skb)
|
||||
pim->group != PIM_V1_VERSION || pim->code != PIM_V1_REGISTER)
|
||||
goto drop;
|
||||
|
||||
encap = (struct iphdr*)(skb->h.raw + sizeof(struct igmphdr));
|
||||
encap = (struct iphdr *)(skb_transport_header(skb) +
|
||||
sizeof(struct igmphdr));
|
||||
/*
|
||||
Check that:
|
||||
a. packet is really destinted to a multicast group
|
||||
@@ -1490,7 +1491,7 @@ static int pim_rcv(struct sk_buff * skb)
|
||||
if (!pskb_may_pull(skb, sizeof(*pim) + sizeof(*encap)))
|
||||
goto drop;
|
||||
|
||||
pim = (struct pimreghdr*)skb->h.raw;
|
||||
pim = (struct pimreghdr *)skb_transport_header(skb);
|
||||
if (pim->type != ((PIM_VERSION<<4)|(PIM_REGISTER)) ||
|
||||
(pim->flags&PIM_NULL_REGISTER) ||
|
||||
(ip_compute_csum((void *)pim, sizeof(*pim)) != 0 &&
|
||||
@@ -1498,7 +1499,8 @@ static int pim_rcv(struct sk_buff * skb)
|
||||
goto drop;
|
||||
|
||||
/* check if the inner packet is destined to mcast group */
|
||||
encap = (struct iphdr*)(skb->h.raw + sizeof(struct pimreghdr));
|
||||
encap = (struct iphdr *)(skb_transport_header(skb) +
|
||||
sizeof(struct pimreghdr));
|
||||
if (!MULTICAST(encap->daddr) ||
|
||||
encap->tot_len == 0 ||
|
||||
ntohs(encap->tot_len) + sizeof(*pim) > skb->len)
|
||||
|
Reference in New Issue
Block a user